API Wrapper of The future of code sharing platform.
Codeboard is an open source code sharing platform thats better in every way. https://cdeboard.vercel.app/docs
- First-party API Wrapper (Made by the same dev as CodeBoard)
- Much Efficient
- Easier approach
- Type safe
- Better Intellisense
All Class functions/methods returns a Promise so you should await it and should be located inside an
asyncfunction. Or your project should be configured totop-level await
- new CodeBoard() (Class)
Access the future of code sharing platform with this first-party wrapper
const { CodeBoard } = require("@codeboard/api");
const board = new CodeBoard("API_KEY");- Required:
API_KEY
The API Key used to access the privileged endpoints like save and fetch. Get your key here
new CodeBoard(key: string): CodeBoardGet the ping latency of the api.
- Returns
One-way travellatency [API --> Client] - Multiply the return value by 2 if you need
Two-way travellatency [Client <--> API]
const { CodeBoard } = require("@codeboard/api");
const board = new CodeBoard("API_KEY");
await board.ping();This returns a Promise so you should await it and should be located inside an
asyncfunction. Or your project should be configured totop-level await
async ping(): Promise<number>Im a teapot
A very old developers april joke. We won't let it fade away ;)
const { CodeBoard } = require("@codeboard/api");
const board = new CodeBoard("API_KEY");
await board.teapot();This returns a Promise so you should await it and should be located inside an
asyncfunction. Or your project should be configured totop-level await
async teapot(): Promise<"Im a teapot">Save a board to the CodeBoard
const { CodeBoard } = require("@codeboard/api");
const board = new CodeBoard("API_KEY");
await board.save({
name: "BOARD_NAME",
description: "BOARD_DESC",
files: [
{
name: "FILE_NAME",
language: "FILE_LANGUAGE_IN_FULLNAME",
value: "CODE_SNIPPET",
},
],
});This returns a Promise so you should await it and should be located inside an
asyncfunction. Or your project should be configured totop-level await
async save(body: SaveBody): Promise<SaveResponse>{
name: string;
description?: string;
files: BoardFile[];
}{
message: string;
board: string;
status: number;
created: boolean;
url: string;
}Fetch a board from the CodeBoard with a board id
const { CodeBoard } = require("@codeboard/api");
const board = new CodeBoard("API_KEY");
await board.fetch("BOARD_ID");This returns a Promise so you should await it and should be located inside an
asyncfunction. Or your project should be configured totop-level await
async fetch(id: string): Promise<FetchBody>{
name: string;
description: string;
files: BoardFile[]; // BoardFile type shown below
url: string;
key: string;
createdAt: number;
encrypted: boolean;
autoVanish: boolean;
fork: {
status: boolean;
key: string;
name: string;
};
author?: string | null;
bot: boolean;
status: number; // HTTP Status Code
}{
name: string;
language: string;
value: string;
}https://cdeboard.vercel.app/support Let's build a better community, together.