Delete src directory
This commit is contained in:
parent
08e984b00b
commit
6cd9b56293
4 changed files with 0 additions and 65 deletions
|
@ -1,35 +0,0 @@
|
||||||
const axios = require("axios");
|
|
||||||
const config = require("../utils/config.json");
|
|
||||||
/**
|
|
||||||
* @class APIClient
|
|
||||||
**/
|
|
||||||
class APIClient {
|
|
||||||
/**
|
|
||||||
* @name APIClient
|
|
||||||
* @kind constructor
|
|
||||||
* @param {String} key Authorization Key for API (Only for CODM commands)
|
|
||||||
* @param {String} [options.key]
|
|
||||||
*/
|
|
||||||
constructor(key, options = {}) {
|
|
||||||
if (key && typeof key !== "string")
|
|
||||||
throw new TypeError("API key must be a string");
|
|
||||||
if (key) this.key = key;
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* Sends a CODM perk object
|
|
||||||
* @returns {Promise<Object>}
|
|
||||||
* @param {String} name
|
|
||||||
*/
|
|
||||||
async getperk(name) {
|
|
||||||
const data = await axios
|
|
||||||
.get(`${config.api}/api/v1/codm/perks?name=${name}`, {
|
|
||||||
headers: {
|
|
||||||
Authorization: this.key,
|
|
||||||
},
|
|
||||||
})
|
|
||||||
.then(res => res.data)
|
|
||||||
.catch(err => console.error(`Unauthorized to use`));
|
|
||||||
return data;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
module.exports = APIClient;
|
|
|
@ -1,13 +0,0 @@
|
||||||
const axios = require("axios");
|
|
||||||
const config = require("../utils/config.json");
|
|
||||||
/**
|
|
||||||
* Sends a 8ball response
|
|
||||||
* @returns {Promise<String>}
|
|
||||||
*/
|
|
||||||
async function random() {
|
|
||||||
const data = await axios
|
|
||||||
.get(`${config.api}/api/v1/fun/8ball`)
|
|
||||||
.then(res => res.data);
|
|
||||||
return data.answer;
|
|
||||||
}
|
|
||||||
module.exports = random;
|
|
14
src/typings/index.d.ts
vendored
14
src/typings/index.d.ts
vendored
|
@ -1,14 +0,0 @@
|
||||||
declare module "cath" {
|
|
||||||
export class APIClient {
|
|
||||||
public constructor(key: string, options?: APIClientOptions);
|
|
||||||
|
|
||||||
private key: string;
|
|
||||||
public options?: APIClientOptions;
|
|
||||||
|
|
||||||
public random8ball(): Promise<String>;
|
|
||||||
public getperk(perk: string): Promise<Object>;
|
|
||||||
}
|
|
||||||
export type APIClientOptions = {
|
|
||||||
codm?: string;
|
|
||||||
};
|
|
||||||
}
|
|
|
@ -1,3 +0,0 @@
|
||||||
{
|
|
||||||
"api": "https://www.cathapi.gq"
|
|
||||||
}
|
|
Loading…
Reference in a new issue