A robust wrapper designed to seamlessly interact with the DBDTeam API, offering enhanced functionality and comprehensive type support for a smoother development experience.
npm
npm install @dbdteam/api.js
pnpm
pnpm install @dbdteam/api.js
yarn
yarn add @dbdteam/api.js
import { DBDTeamClient, Endpoint, EndpointType } from "@dbdteam/api.js";
const api_key = "your_api_key_here";
const client = new DBDTeamClient(api_key, {
debug: true,
});
const Canvas = new Endpoint(EndpointType.Canvas, client);
const Fun = new Endpoint(EndpointType.Fun, client);
// Example usage of the 'canvas/clyde' endpoint
const clyde = await Canvas.get("clyde", { text: "Hello World!" });
console.log(clyde.data.url);
// Example usage of the 'fun/joke' endpoint
const joke = await Fun.get("joke");
console.log("Joke: ", joke.data.joke);
apiKey
: Your DBDTeam API key.options
: Optional configuration object.debug
: Enable debug mode (default isfalse
).
type
: The type of endpoint to create (e.g.,EndpointType.Canvas
).client
: The DBDTeamClient instance.
path
: The API endpoint path.params
: Optional parameters to include in the request.
Returns a promise with the API response.
const canvas = new Endpoint(EndpointType.Canvas, client);
// Get a response from the Canvas endpoint
const image = await canvas.get("clyde", { text: "Hello World!" });
console.log(image.data.url);
This project is licensed under the MIT License - see the LICENSE file for details.
Made by Chewawi with <3