https://github.com/upryzing/api-typescript
TypeScript typings for Upryzing's API
https://github.com/upryzing/api-typescript
Last synced: over 1 year ago
JSON representation
TypeScript typings for Upryzing's API
- Host: GitHub
- URL: https://github.com/upryzing/api-typescript
- Owner: upryzing
- License: mit
- Created: 2024-09-07T12:57:25.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-12-17T03:16:22.000Z (over 1 year ago)
- Last Synced: 2025-02-28T13:21:25.750Z (over 1 year ago)
- Language: TypeScript
- Homepage:
- Size: 564 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @upryzing/api

This package contains typings for objects in the Upryzing API and a fully typed API request builder.
### Example Usage
If you just need access to types:
```typescript
import type { User } from '@upryzing/api';
```
If you want to send requests:
```typescript
import { API } from '@upryzing/api';
// Initialise a new API client:
const client = new API();
// or with authentication:
const client = new API({ authentication: { revolt: 'bot-token' } });
// Make requests with ease:
client.get('/users/@me')
// Fully typed responses!
.then(user => user.username);
// No need to worry about the details:
let channel_id = "some channel id";
client.post(`/channels/${channel_id}/messages`, {
// Parameters given are fully typed as well!
content: "some content"
});
```
For more details on how this works, see the [README of @insertish/oapi](https://github.com/insertish/oapi#example).