@devgoe/coc.js
TypeScript icon, indicating that this package has built-in type declarations

1.5.5 • Public • Published

npm version

coc.js

Description

This pakage is created out of the swagger description of the COC API. To use it you need a token.

Installation

import { Api } from "@devgoe/coc.js";
const client = new Api({
  baseApiParams: {
    headers: {
      Authorization: `Bearer ${process.env.COC_TOKEN}`,
    },
  },
});

Use the process.env.COC_TOKEN to store your token in your .env File

After the initial creation of the API you can use all features listed on the coc API description. This package also supports TypeScript

For example you can search for Clans using the .clans syntax

client.clans
  .searchClans({
    name: "example",
    limit: 10,
  })
  .then((res) =>
    res.data.items.forEach((clan) => {
      console.log(clan.name);
    })
  );
const clans = await client.clans.searchClans({
  name: "example",
  limit: 10,
});

Roadmap

Next steps i want to implement:

  • [ ] Bring the Token as variable

/@devgoe/coc.js/

    Package Sidebar

    Install

    npm i @devgoe/coc.js

    Weekly Downloads

    9

    Version

    1.5.5

    License

    ISC

    Unpacked Size

    128 kB

    Total Files

    7

    Last publish

    Collaborators

    • devgoe