mirror of
https://github.com/stoatchat/javascript-client-sdk.git
synced 2026-07-19 17:13:31 -04:00
fix: patch user and invite routes
This commit is contained in:
+4
-4
@@ -10,7 +10,7 @@ import type {
|
||||
SendableEmbed
|
||||
} from "revolt-api/types/Channels";
|
||||
import type { RevoltConfiguration } from "revolt-api/types/Core";
|
||||
import type { RetrievedInvite, ServerInvite } from "revolt-api/types/Invites";
|
||||
import type { Invite, RetrievedInvite, ServerInvite } from "revolt-api/types/Invites";
|
||||
import type {
|
||||
Ban,
|
||||
Category,
|
||||
@@ -210,7 +210,7 @@ type Routes =
|
||||
| {
|
||||
// Edit user.
|
||||
method: "PATCH";
|
||||
route: `/users/${Id}`;
|
||||
route: `/users/@me`;
|
||||
data: {
|
||||
status?: Status;
|
||||
profile?: {
|
||||
@@ -225,7 +225,7 @@ type Routes =
|
||||
| {
|
||||
// Change username.
|
||||
method: "PATCH";
|
||||
route: `/users/${Id}/username`;
|
||||
route: `/users/@me/username`;
|
||||
data: {
|
||||
username: string;
|
||||
password: string;
|
||||
@@ -373,7 +373,7 @@ type Routes =
|
||||
method: "POST";
|
||||
route: `/channels/${Id}/invites`;
|
||||
data: undefined;
|
||||
response: { code: string };
|
||||
response: Invite;
|
||||
}
|
||||
| {
|
||||
// Add member to group.
|
||||
|
||||
@@ -566,11 +566,10 @@ export class Channel {
|
||||
* @returns Newly created invite code
|
||||
*/
|
||||
async createInvite() {
|
||||
const res = await this.client.req(
|
||||
return await this.client.req(
|
||||
"POST",
|
||||
`/channels/${this._id}/invites` as "/channels/id/invites",
|
||||
);
|
||||
return res.code;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+3
-3
@@ -291,8 +291,8 @@ export default class Users extends Collection<string, User> {
|
||||
* Edit the current user
|
||||
* @param data User edit data object
|
||||
*/
|
||||
async edit(data: Route<"PATCH", "/users/id">["data"]) {
|
||||
await this.client.req("PATCH", "/users/id", data);
|
||||
async edit(data: Route<"PATCH", "/users/@me">["data"]) {
|
||||
await this.client.req("PATCH", "/users/@me", data);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,7 +301,7 @@ export default class Users extends Collection<string, User> {
|
||||
* @param password Current password
|
||||
*/
|
||||
async changeUsername(username: string, password: string) {
|
||||
return await this.client.req("PATCH", "/users/id/username", {
|
||||
return await this.client.req("PATCH", "/users/@me/username", {
|
||||
username,
|
||||
password,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user