mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-21 04:25:27 -04:00
Add registration helper.
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "revolt.js",
|
||||
"version": "3.0.0-beta.3",
|
||||
"version": "3.0.0-beta.4",
|
||||
"main": "dist/index.js",
|
||||
"repository": "https://gitlab.insrt.uk/revolt/revolt.js",
|
||||
"author": "Paul Makles <insrt.uk>",
|
||||
|
||||
@@ -120,6 +120,10 @@ export class Client extends EventEmitter {
|
||||
/**
|
||||
* Utility functions.
|
||||
*/
|
||||
async register(apiURL: string, data: Auth.CreateRequest): Promise<Auth.CreateResponse> {
|
||||
return (await Axios.post('/auth/create', data, { baseURL: apiURL })).data;
|
||||
}
|
||||
|
||||
async addFriend(username: string) {
|
||||
await this.Axios.put(`/users/${username}/friend`);
|
||||
}
|
||||
|
||||
@@ -6,6 +6,16 @@ export namespace Auth {
|
||||
device_name: string
|
||||
}
|
||||
|
||||
// POST /auth/create
|
||||
export interface CreateRequest {
|
||||
email: string,
|
||||
password: string
|
||||
}
|
||||
|
||||
export interface CreateResponse {
|
||||
user_id: string
|
||||
}
|
||||
|
||||
export interface Session {
|
||||
id?: string,
|
||||
user_id: string,
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ export const API_VERSION = {
|
||||
};
|
||||
|
||||
export const LIBRARY_VERSION = {
|
||||
str: '3.0.0-beta.3',
|
||||
str: '3.0.0-beta.4',
|
||||
major: 3,
|
||||
minor: 0,
|
||||
patch: 0
|
||||
|
||||
Reference in New Issue
Block a user