Skip to content

hannaxd/revolt-api-fetch

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Revolt API Fetch

This package contains object types and a fully typed request builder for the Revolt API

Disclaimer

This thing is very much unstable, I'm working on it.

Package Usage

Importing types:

import type { Message } from '@rawrxd/revolt-api';

Using the request builder:

import { API } from '@rawrxd/revolt-api';

const client = new API({
    authentication: {
        revolt: "bot token here"
    }
});

// Sending a get request
const me = await client.get('/users/@me');

// sending a post request with URL parameters and body content
const channel_id = "something";
client.post(`/channels/${channel_id}/messages`, {
    content: "message :3"
});

Rebuilding types

As of now this package doesn't contain an automated approach to updating the necessary openapi.json file. The current version can always be obtained from the revolt api directly, for example via wget:

wget https://api.revolt.chat/openapi.json

After that, rebuild the base files by running the build task through deno.

Attribution

This repository currently includes revolts openapi.json file. This file is licensed under the AGPLv3 and powers the entire generator, but isn't shipped with the final result.

Revolt: https://revolt.chat Backend Source: https://github.com/revoltchat/backend

About

revolt-api using fetch instead of axios

Resources

License

Stars

Watchers

Forks