@wavezfm/api 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +338 -0
- package/dist/core/ApiError.d.ts +14 -0
- package/dist/core/ApiError.js +20 -0
- package/dist/core/ApiError.js.map +1 -0
- package/dist/core/api.d.ts +27 -0
- package/dist/core/api.js +327 -0
- package/dist/core/api.js.map +1 -0
- package/dist/core/i18n.d.ts +3 -0
- package/dist/core/i18n.js +97 -0
- package/dist/core/i18n.js.map +1 -0
- package/dist/index.d.ts +379 -0
- package/dist/index.js +47 -0
- package/dist/index.js.map +1 -0
- package/dist/realtime/roomBot.d.ts +2 -0
- package/dist/realtime/roomBot.js +215 -0
- package/dist/realtime/roomBot.js.map +1 -0
- package/dist/resources/auth.d.ts +35 -0
- package/dist/resources/auth.js +30 -0
- package/dist/resources/auth.js.map +1 -0
- package/dist/resources/billing.d.ts +45 -0
- package/dist/resources/billing.js +29 -0
- package/dist/resources/billing.js.map +1 -0
- package/dist/resources/chat.d.ts +27 -0
- package/dist/resources/chat.js +38 -0
- package/dist/resources/chat.js.map +1 -0
- package/dist/resources/friend.d.ts +23 -0
- package/dist/resources/friend.js +35 -0
- package/dist/resources/friend.js.map +1 -0
- package/dist/resources/playlist.d.ts +64 -0
- package/dist/resources/playlist.js +61 -0
- package/dist/resources/playlist.js.map +1 -0
- package/dist/resources/room.d.ts +50 -0
- package/dist/resources/room.js +152 -0
- package/dist/resources/room.js.map +1 -0
- package/dist/resources/roomBot.d.ts +45 -0
- package/dist/resources/roomBot.js +75 -0
- package/dist/resources/roomBot.js.map +1 -0
- package/dist/resources/settings.d.ts +43 -0
- package/dist/resources/settings.js +38 -0
- package/dist/resources/settings.js.map +1 -0
- package/dist/resources/shop.d.ts +11 -0
- package/dist/resources/shop.js +22 -0
- package/dist/resources/shop.js.map +1 -0
- package/dist/resources/source.d.ts +14 -0
- package/dist/resources/source.js +50 -0
- package/dist/resources/source.js.map +1 -0
- package/dist/resources/system.d.ts +6 -0
- package/dist/resources/system.js +20 -0
- package/dist/resources/system.js.map +1 -0
- package/dist/resources/user.d.ts +7 -0
- package/dist/resources/user.js +19 -0
- package/dist/resources/user.js.map +1 -0
- package/dist/types.d.ts +374 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +97 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"roomBot.js","sourceRoot":"","sources":["../../src/realtime/roomBot.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,yBAAyB,EAAE,MAAM,cAAc,CAAC;AAIzD,SAAS,eAAe;IACpB,OAAO,OAAO,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,MAAM,EAAE;SACjD,QAAQ,CAAC,EAAE,CAAC;SACZ,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC;AACxB,CAAC;AAED,SAAS,eAAe;IACpB,OAAO,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;AACpC,CAAC;AAED,SAAS,kBAAkB,CAAC,OAAe;IACvC,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;IAC7B,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC;IAC1D,GAAG,CAAC,QAAQ,GAAG,KAAK,CAAC;IACrB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC;IAChB,GAAG,CAAC,IAAI,GAAG,EAAE,CAAC;IACd,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,oBAAoB,CACzB,OAAoD,EACpD,aAGW;IAEX,IAAI,OAAO,EAAE,CAAC;QACV,OAAO,OAAO,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,SAAS,KAAK,WAAW,EAAE,CAAC;QACnC,OA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,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;YACtB,SAAS,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;YAE/B,OAAO,GAAG,EAAE;gBACR,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;gBACzB,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;oBACtB,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;gBAC5B,CAAC;YACL,CAAC,CAAC;QACN,CAAC;QAED,GAAG,CAAC,KAAK,EAAE,OAAO;YACd,MAAM,QAAQ,GAAG,SAAS,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YACtC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACZ,OAAO;YACX,CAAC;YAED,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YACzB,IAAI,QAAQ,CAAC,IAAI,KAAK,CAAC,EAAE,CAAC;gBACtB,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YAC5B,CAAC;QACL,CAAC;QAED,IAAI,CAAC,KAAK,EAAE,OAAO;YACf,MAAM,WAAW,GAAG,IAAI,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,MAAM,EAAE,EAAE;gBAC1C,WAAW,EAAE,CAAC;gBACd,OAAO,CAAC,MAAM,CAAC,CAAC;YACpB,CAAC,CAAC,CAAC;YAEH,OAAO,WAAW,CAAC;QACvB,CAAC;QAED,SAAS;YACL,OAAO,MAAM,CAAC;QAClB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { ApiLike, AuthUser, TwoFactorStatus } from "../types";
|
|
2
|
+
export declare function createAuthResource(api: ApiLike): {
|
|
3
|
+
login(input: {
|
|
4
|
+
email: string;
|
|
5
|
+
password: string;
|
|
6
|
+
}): Promise<import("..").ApiSuccessResponse<{
|
|
7
|
+
[key: string]: unknown;
|
|
8
|
+
user?: AuthUser;
|
|
9
|
+
}>>;
|
|
10
|
+
register(input: {
|
|
11
|
+
email: string;
|
|
12
|
+
password: string;
|
|
13
|
+
name: string;
|
|
14
|
+
username?: string;
|
|
15
|
+
}): Promise<import("..").ApiSuccessResponse<{
|
|
16
|
+
[key: string]: unknown;
|
|
17
|
+
user?: AuthUser;
|
|
18
|
+
}>>;
|
|
19
|
+
me(): Promise<{
|
|
20
|
+
data: AuthUser | null;
|
|
21
|
+
status: number;
|
|
22
|
+
headers: Headers;
|
|
23
|
+
}>;
|
|
24
|
+
getPendingTwoFactor(): Promise<import("..").ApiSuccessResponse<{
|
|
25
|
+
[key: string]: unknown;
|
|
26
|
+
pending: boolean;
|
|
27
|
+
method?: string | null;
|
|
28
|
+
maskedDestination?: string | null;
|
|
29
|
+
}>>;
|
|
30
|
+
sendPendingTwoFactorCode(input?: Record<string, unknown>): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
31
|
+
verifyPendingTwoFactor(input: {
|
|
32
|
+
code: string;
|
|
33
|
+
}): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
34
|
+
getTwoFactorStatus(): Promise<import("..").ApiSuccessResponse<TwoFactorStatus>>;
|
|
35
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export function createAuthResource(api) {
|
|
2
|
+
return {
|
|
3
|
+
login(input) {
|
|
4
|
+
return api.post("/auth/sign-in/email", input, { authMode: "none" });
|
|
5
|
+
},
|
|
6
|
+
register(input) {
|
|
7
|
+
return api.post("/auth/sign-up/email", input, { authMode: "none" });
|
|
8
|
+
},
|
|
9
|
+
async me() {
|
|
10
|
+
const response = await api.get("/auth/me");
|
|
11
|
+
return {
|
|
12
|
+
...response,
|
|
13
|
+
data: response.data ?? null,
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
getPendingTwoFactor() {
|
|
17
|
+
return api.get("/auth/two-factor/pending", { authMode: "none" });
|
|
18
|
+
},
|
|
19
|
+
sendPendingTwoFactorCode(input) {
|
|
20
|
+
return api.post("/auth/two-factor/pending/send", input ?? {}, { authMode: "none" });
|
|
21
|
+
},
|
|
22
|
+
verifyPendingTwoFactor(input) {
|
|
23
|
+
return api.post("/auth/two-factor/pending/verify", input, { authMode: "none" });
|
|
24
|
+
},
|
|
25
|
+
getTwoFactorStatus() {
|
|
26
|
+
return api.get("/settings/two-factor");
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=auth.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/resources/auth.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC3C,OAAO;QACH,KAAK,CAAC,KAA0C;YAC5C,OAAO,GAAG,CAAC,IAAI,CACX,qBAAqB,EACrB,KAAK,EACL,EAAE,QAAQ,EAAE,MAAM,EAAE,CACvB,CAAC;QACN,CAAC;QAED,QAAQ,CAAC,KAKR;YACG,OAAO,GAAG,CAAC,IAAI,CACX,qBAAqB,EACrB,KAAK,EACL,EAAE,QAAQ,EAAE,MAAM,EAAE,CACvB,CAAC;QACN,CAAC;QAED,KAAK,CAAC,EAAE;YACJ,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAkB,UAAU,CAAC,CAAC;YAC5D,OAAO;gBACH,GAAG,QAAQ;gBACX,IAAI,EAAE,QAAQ,CAAC,IAAI,IAAI,IAAI;aAC9B,CAAC;QACN,CAAC;QAED,mBAAmB;YACf,OAAO,GAAG,CAAC,GAAG,CAKX,0BAA0B,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;QACzD,CAAC;QAED,wBAAwB,CAAC,KAA+B;YACpD,OAAO,GAAG,CAAC,IAAI,CACX,+BAA+B,EAC/B,KAAK,IAAI,EAAE,EACX,EAAE,QAAQ,EAAE,MAAM,EAAE,CACvB,CAAC;QACN,CAAC;QAED,sBAAsB,CAAC,KAAuB;YAC1C,OAAO,GAAG,CAAC,IAAI,CACX,iCAAiC,EACjC,KAAK,EACL,EAAE,QAAQ,EAAE,MAAM,EAAE,CACvB,CAAC;QACN,CAAC;QAED,kBAAkB;YACd,OAAO,GAAG,CAAC,GAAG,CAAkB,sBAAsB,CAAC,CAAC;QAC5D,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { ApiLike, CheckoutSessionResponse } from "../types";
|
|
2
|
+
export declare function createBillingResource(api: ApiLike): {
|
|
3
|
+
createSubscriptionCheckout(input?: {
|
|
4
|
+
cycle?: string | null;
|
|
5
|
+
currency?: string | null;
|
|
6
|
+
returnPath?: string | null;
|
|
7
|
+
}): Promise<import("..").ApiSuccessResponse<CheckoutSessionResponse>>;
|
|
8
|
+
createDiamondCheckout(input?: {
|
|
9
|
+
quantity?: number;
|
|
10
|
+
currency?: string | null;
|
|
11
|
+
returnPath?: string | null;
|
|
12
|
+
}): Promise<import("..").ApiSuccessResponse<CheckoutSessionResponse>>;
|
|
13
|
+
createRoomDonationCheckout(roomId: string, input?: {
|
|
14
|
+
amountCents?: number;
|
|
15
|
+
locale?: string | null;
|
|
16
|
+
returnPath?: string | null;
|
|
17
|
+
}): Promise<import("..").ApiSuccessResponse<CheckoutSessionResponse>>;
|
|
18
|
+
createGlobalDonationCheckout(input?: {
|
|
19
|
+
amountCents?: number;
|
|
20
|
+
locale?: string | null;
|
|
21
|
+
returnPath?: string | null;
|
|
22
|
+
}): Promise<import("..").ApiSuccessResponse<CheckoutSessionResponse>>;
|
|
23
|
+
createDiamondGiftCheckout(input: {
|
|
24
|
+
recipientUsername: string;
|
|
25
|
+
quantity?: number;
|
|
26
|
+
currency?: string | null;
|
|
27
|
+
returnPath?: string | null;
|
|
28
|
+
message?: string | null;
|
|
29
|
+
anonymous?: boolean;
|
|
30
|
+
announceInRoom?: boolean;
|
|
31
|
+
announceRoomSlug?: string | null;
|
|
32
|
+
}): Promise<import("..").ApiSuccessResponse<CheckoutSessionResponse>>;
|
|
33
|
+
createSubscriptionGiftCheckout(input: {
|
|
34
|
+
recipientUsername: string;
|
|
35
|
+
cycle?: string | null;
|
|
36
|
+
currency?: string | null;
|
|
37
|
+
returnPath?: string | null;
|
|
38
|
+
message?: string | null;
|
|
39
|
+
anonymous?: boolean;
|
|
40
|
+
announceInRoom?: boolean;
|
|
41
|
+
announceRoomSlug?: string | null;
|
|
42
|
+
}): Promise<import("..").ApiSuccessResponse<CheckoutSessionResponse>>;
|
|
43
|
+
listPendingGifts(): Promise<import("..").ApiSuccessResponse<unknown[]>>;
|
|
44
|
+
markGiftSeen(giftId: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
45
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function createBillingResource(api) {
|
|
2
|
+
return {
|
|
3
|
+
createSubscriptionCheckout(input) {
|
|
4
|
+
return api.post("/billing/checkout/subscription", input ?? {});
|
|
5
|
+
},
|
|
6
|
+
createDiamondCheckout(input) {
|
|
7
|
+
return api.post("/billing/checkout/diamonds", input ?? {});
|
|
8
|
+
},
|
|
9
|
+
createRoomDonationCheckout(roomId, input) {
|
|
10
|
+
return api.post(`/billing/checkout/rooms/${encodeURIComponent(roomId)}/donation`, input ?? {});
|
|
11
|
+
},
|
|
12
|
+
createGlobalDonationCheckout(input) {
|
|
13
|
+
return api.post("/billing/checkout/global-donation", input ?? {});
|
|
14
|
+
},
|
|
15
|
+
createDiamondGiftCheckout(input) {
|
|
16
|
+
return api.post("/billing/checkout/diamonds/gift", input);
|
|
17
|
+
},
|
|
18
|
+
createSubscriptionGiftCheckout(input) {
|
|
19
|
+
return api.post("/billing/checkout/subscription/gift", input);
|
|
20
|
+
},
|
|
21
|
+
listPendingGifts() {
|
|
22
|
+
return api.get("/billing/gifts/pending");
|
|
23
|
+
},
|
|
24
|
+
markGiftSeen(giftId) {
|
|
25
|
+
return api.post(`/billing/gifts/${encodeURIComponent(giftId)}/seen`, {});
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=billing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"billing.js","sourceRoot":"","sources":["../../src/resources/billing.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,qBAAqB,CAAC,GAAY;IAC9C,OAAO;QACH,0BAA0B,CAAC,KAI1B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,gCAAgC,EAChC,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,qBAAqB,CAAC,KAIrB;YACG,OAAO,GAAG,CAAC,IAAI,CACX,4BAA4B,EAC5B,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,0BAA0B,CACtB,MAAc,EACd,KAIC;YAED,OAAO,GAAG,CAAC,IAAI,CACX,2BAA2B,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAChE,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,4BAA4B,CAAC,KAI5B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,mCAAmC,EACnC,KAAK,IAAI,EAAE,CACd,CAAC;QACN,CAAC;QAED,yBAAyB,CAAC,KASzB;YACG,OAAO,GAAG,CAAC,IAAI,CACX,iCAAiC,EACjC,KAAK,CACR,CAAC;QACN,CAAC;QAED,8BAA8B,CAAC,KAS9B;YACG,OAAO,GAAG,CAAC,IAAI,CACX,qCAAqC,EACrC,KAAK,CACR,CAAC;QACN,CAAC;QAED,gBAAgB;YACZ,OAAO,GAAG,CAAC,GAAG,CAAY,wBAAwB,CAAC,CAAC;QACxD,CAAC;QAED,YAAY,CAAC,MAAc;YACvB,OAAO,GAAG,CAAC,IAAI,CACX,kBAAkB,kBAAkB,CAAC,MAAM,CAAC,OAAO,EACnD,EAAE,CACL,CAAC;QACN,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { ApiLike, ChatMessage } from "../types";
|
|
2
|
+
export declare function createChatResource(api: ApiLike): {
|
|
3
|
+
getMessages(roomId: string, offset?: number, limit?: number): Promise<import("..").ApiSuccessResponse<{
|
|
4
|
+
history: boolean;
|
|
5
|
+
pinnedMessage?: Record<string, unknown> | null;
|
|
6
|
+
messages: ChatMessage[];
|
|
7
|
+
}>>;
|
|
8
|
+
getMessagesBySlug(slug: string, offset?: number, limit?: number): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
9
|
+
deleteMessage(roomId: string, messageId: string, message?: Record<string, unknown>): Promise<import("..").ApiSuccessResponse<{
|
|
10
|
+
success: true;
|
|
11
|
+
}>>;
|
|
12
|
+
updateMessage(roomId: string, messageId: string, input: {
|
|
13
|
+
content: string;
|
|
14
|
+
message?: Record<string, unknown>;
|
|
15
|
+
}): Promise<import("..").ApiSuccessResponse<{
|
|
16
|
+
message: ChatMessage | null;
|
|
17
|
+
}>>;
|
|
18
|
+
pinMessage(roomId: string, messageId: string, message?: Record<string, unknown>): Promise<import("..").ApiSuccessResponse<{
|
|
19
|
+
success: true;
|
|
20
|
+
}>>;
|
|
21
|
+
clearPinnedMessage(roomId: string): Promise<import("..").ApiSuccessResponse<{
|
|
22
|
+
success: true;
|
|
23
|
+
}>>;
|
|
24
|
+
clearChat(roomId: string): Promise<import("..").ApiSuccessResponse<{
|
|
25
|
+
success: true;
|
|
26
|
+
}>>;
|
|
27
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export function createChatResource(api) {
|
|
2
|
+
return {
|
|
3
|
+
getMessages(roomId, offset = 0, limit = 50) {
|
|
4
|
+
return api.get(`/rooms/${encodeURIComponent(roomId)}/messages`, {
|
|
5
|
+
query: {
|
|
6
|
+
offset,
|
|
7
|
+
limit,
|
|
8
|
+
},
|
|
9
|
+
});
|
|
10
|
+
},
|
|
11
|
+
getMessagesBySlug(slug, offset = 0, limit = 50) {
|
|
12
|
+
return api.get(`/rooms/${encodeURIComponent(slug)}/chat`, {
|
|
13
|
+
query: {
|
|
14
|
+
offset,
|
|
15
|
+
limit,
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
deleteMessage(roomId, messageId, message) {
|
|
20
|
+
return api.delete(`/rooms/${encodeURIComponent(roomId)}/messages/${encodeURIComponent(messageId)}`, {
|
|
21
|
+
body: message ? { message } : undefined,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
updateMessage(roomId, messageId, input) {
|
|
25
|
+
return api.patch(`/rooms/${encodeURIComponent(roomId)}/messages/${encodeURIComponent(messageId)}`, input);
|
|
26
|
+
},
|
|
27
|
+
pinMessage(roomId, messageId, message) {
|
|
28
|
+
return api.put(`/rooms/${encodeURIComponent(roomId)}/pinned-message/${encodeURIComponent(messageId)}`, message ? { message } : {});
|
|
29
|
+
},
|
|
30
|
+
clearPinnedMessage(roomId) {
|
|
31
|
+
return api.delete(`/rooms/${encodeURIComponent(roomId)}/pinned-message`);
|
|
32
|
+
},
|
|
33
|
+
clearChat(roomId) {
|
|
34
|
+
return api.post(`/rooms/${encodeURIComponent(roomId)}/clear-chat`, {});
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=chat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../src/resources/chat.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC3C,OAAO;QACH,WAAW,CAAC,MAAc,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE;YAC9C,OAAO,GAAG,CAAC,GAAG,CAIX,UAAU,kBAAkB,CAAC,MAAM,CAAC,WAAW,EAAE;gBAChD,KAAK,EAAE;oBACH,MAAM;oBACN,KAAK;iBACR;aACJ,CAAC,CAAC;QACP,CAAC;QAED,iBAAiB,CAAC,IAAY,EAAE,MAAM,GAAG,CAAC,EAAE,KAAK,GAAG,EAA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createFriendResource(api: ApiLike): {
|
|
3
|
+
list(): Promise<import("..").ApiSuccessResponse<UserProfile[]>>;
|
|
4
|
+
pending(): Promise<import("..").ApiSuccessResponse<UserProfile[]>>;
|
|
5
|
+
sendRequest(userId: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
6
|
+
acceptRequest(requestId: string): Promise<import("..").ApiSuccessResponse<{
|
|
7
|
+
success: true;
|
|
8
|
+
}>>;
|
|
9
|
+
rejectRequest(requestId: string): Promise<import("..").ApiSuccessResponse<{
|
|
10
|
+
success: true;
|
|
11
|
+
}>>;
|
|
12
|
+
remove(friendshipId: string): Promise<import("..").ApiSuccessResponse<{
|
|
13
|
+
success: true;
|
|
14
|
+
}>>;
|
|
15
|
+
follow(userId: string): Promise<import("..").ApiSuccessResponse<{
|
|
16
|
+
success: true;
|
|
17
|
+
}>>;
|
|
18
|
+
unfollow(userId: string): Promise<import("..").ApiSuccessResponse<{
|
|
19
|
+
success: true;
|
|
20
|
+
}>>;
|
|
21
|
+
followers(): Promise<import("..").ApiSuccessResponse<UserProfile[]>>;
|
|
22
|
+
following(): Promise<import("..").ApiSuccessResponse<UserProfile[]>>;
|
|
23
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
export function createFriendResource(api) {
|
|
2
|
+
return {
|
|
3
|
+
list() {
|
|
4
|
+
return api.get("/friends");
|
|
5
|
+
},
|
|
6
|
+
pending() {
|
|
7
|
+
return api.get("/friends/pending");
|
|
8
|
+
},
|
|
9
|
+
sendRequest(userId) {
|
|
10
|
+
return api.post(`/friends/request/${encodeURIComponent(userId)}`, {});
|
|
11
|
+
},
|
|
12
|
+
acceptRequest(requestId) {
|
|
13
|
+
return api.post(`/friends/accept/${encodeURIComponent(requestId)}`, {});
|
|
14
|
+
},
|
|
15
|
+
rejectRequest(requestId) {
|
|
16
|
+
return api.post(`/friends/reject/${encodeURIComponent(requestId)}`, {});
|
|
17
|
+
},
|
|
18
|
+
remove(friendshipId) {
|
|
19
|
+
return api.delete(`/friends/${encodeURIComponent(friendshipId)}`);
|
|
20
|
+
},
|
|
21
|
+
follow(userId) {
|
|
22
|
+
return api.post(`/fans/${encodeURIComponent(userId)}`, {});
|
|
23
|
+
},
|
|
24
|
+
unfollow(userId) {
|
|
25
|
+
return api.delete(`/fans/${encodeURIComponent(userId)}`);
|
|
26
|
+
},
|
|
27
|
+
followers() {
|
|
28
|
+
return api.get("/fans/followers");
|
|
29
|
+
},
|
|
30
|
+
following() {
|
|
31
|
+
return api.get("/fans/following");
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=friend.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"friend.js","sourceRoot":"","sources":["../../src/resources/friend.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,GAAY;IAC7C,OAAO;QACH,IAAI;YACA,OAAO,GAAG,CAAC,GAAG,CAAgB,UAAU,CAAC,CAAC;QAC9C,CAAC;QAED,OAAO;YACH,OAAO,GAAG,CAAC,GAAG,CAAgB,kBAAkB,CAAC,CAAC;QACtD,CAAC;QAED,WAAW,CAAC,MAAc;YACtB,OAAO,GAAG,CAAC,IAAI,CACX,oBAAoB,kBAAkB,CAAC,MAAM,CAAC,EAAE,EAChD,EAAE,CACL,CAAC;QACN,CAAC;QAED,aAAa,CAAC,SAAiB;YAC3B,OAAO,GAAG,CAAC,IAAI,CACX,mBAAmB,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAClD,EAAE,CACL,CAAC;QACN,CAAC;QAED,aAAa,CAAC,SAAiB;YAC3B,OAAO,GAAG,CAAC,IAAI,CACX,mBAAmB,kBAAkB,CAAC,SAAS,CAAC,EAAE,EAClD,EAAE,CACL,CAAC;QACN,CAAC;QAED,MAAM,CAAC,YAAoB;YACvB,OAAO,GAAG,CAAC,MAAM,CACb,YAAY,kBAAkB,CAAC,YAAY,CAAC,EAAE,CACjD,CAAC;QACN,CAAC;QAED,MAAM,CAAC,MAAc;YACjB,OAAO,GAAG,CAAC,IAAI,CACX,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,EACrC,EAAE,CACL,CAAC;QACN,CAAC;QAED,QAAQ,CAAC,MAAc;YACnB,OAAO,GAAG,CAAC,MAAM,CACb,SAAS,kBAAkB,CAAC,MAAM,CAAC,EAAE,CACxC,CAAC;QACN,CAAC;QAED,SAAS;YACL,OAAO,GAAG,CAAC,GAAG,CAAgB,iBAAiB,CAAC,CAAC;QACrD,CAAC;QAED,SAAS;YACL,OAAO,GAAG,CAAC,GAAG,CAAgB,iBAAiB,CAAC,CAAC;QACrD,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ApiLike, MediaSearchResult, PlaylistSummary, PlaylistTrack } from "../types";
|
|
2
|
+
export declare function createPlaylistResource(api: ApiLike): {
|
|
3
|
+
list(): Promise<import("..").ApiSuccessResponse<PlaylistSummary[]>>;
|
|
4
|
+
create(input: {
|
|
5
|
+
name: string;
|
|
6
|
+
} | string): Promise<import("..").ApiSuccessResponse<PlaylistSummary>>;
|
|
7
|
+
update(playlistId: string, input: {
|
|
8
|
+
name?: string;
|
|
9
|
+
isActive?: boolean;
|
|
10
|
+
}): Promise<import("..").ApiSuccessResponse<{
|
|
11
|
+
success: true;
|
|
12
|
+
}>>;
|
|
13
|
+
remove(playlistId: string): Promise<import("..").ApiSuccessResponse<{
|
|
14
|
+
success: true;
|
|
15
|
+
}>>;
|
|
16
|
+
getTracks(playlistId: string): Promise<import("..").ApiSuccessResponse<PlaylistTrack[]>>;
|
|
17
|
+
previewUrl(url: string): Promise<import("..").ApiSuccessResponse<{
|
|
18
|
+
kind: "track";
|
|
19
|
+
sourceId: string;
|
|
20
|
+
source: string;
|
|
21
|
+
title: string;
|
|
22
|
+
artist?: string;
|
|
23
|
+
thumbnailUrl?: string | null;
|
|
24
|
+
} | {
|
|
25
|
+
kind: "playlist";
|
|
26
|
+
importSource: string;
|
|
27
|
+
sourceUrl: string;
|
|
28
|
+
title: string;
|
|
29
|
+
totalTracks: number;
|
|
30
|
+
thumbnailUrl?: string | null;
|
|
31
|
+
truncated?: boolean;
|
|
32
|
+
}>>;
|
|
33
|
+
addTrack(playlistId: string, input: {
|
|
34
|
+
url?: string;
|
|
35
|
+
sourceId?: string;
|
|
36
|
+
source?: string;
|
|
37
|
+
title?: string;
|
|
38
|
+
artist?: string;
|
|
39
|
+
durationMs?: number;
|
|
40
|
+
thumbnailUrl?: string | null;
|
|
41
|
+
}): Promise<import("..").ApiSuccessResponse<PlaylistTrack>>;
|
|
42
|
+
reorderTracks(playlistId: string, trackIds: string[]): Promise<import("..").ApiSuccessResponse<{
|
|
43
|
+
success: true;
|
|
44
|
+
}>>;
|
|
45
|
+
removeTrack(playlistId: string, trackId: string): Promise<import("..").ApiSuccessResponse<{
|
|
46
|
+
success: true;
|
|
47
|
+
}>>;
|
|
48
|
+
listImports(): Promise<import("..").ApiSuccessResponse<unknown[]>>;
|
|
49
|
+
getImport(jobId: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
50
|
+
startSpotifyImport(input: {
|
|
51
|
+
playlistId: string;
|
|
52
|
+
url: string;
|
|
53
|
+
}): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
54
|
+
importYouTubePlaylist(input: {
|
|
55
|
+
playlistId: string;
|
|
56
|
+
url: string;
|
|
57
|
+
}): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
58
|
+
importSoundCloudPlaylist(input: {
|
|
59
|
+
playlistId: string;
|
|
60
|
+
url: string;
|
|
61
|
+
}): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
62
|
+
cancelImport(jobId: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
63
|
+
searchPreview(query: string, source?: string, limit?: number): Promise<import("..").ApiSuccessResponse<MediaSearchResult[]>>;
|
|
64
|
+
};
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
export function createPlaylistResource(api) {
|
|
2
|
+
return {
|
|
3
|
+
list() {
|
|
4
|
+
return api.get("/playlists");
|
|
5
|
+
},
|
|
6
|
+
create(input) {
|
|
7
|
+
return api.post("/playlists", typeof input === "string" ? { name: input } : input);
|
|
8
|
+
},
|
|
9
|
+
update(playlistId, input) {
|
|
10
|
+
return api.put(`/playlists/${encodeURIComponent(playlistId)}`, input);
|
|
11
|
+
},
|
|
12
|
+
remove(playlistId) {
|
|
13
|
+
return api.delete(`/playlists/${encodeURIComponent(playlistId)}`);
|
|
14
|
+
},
|
|
15
|
+
getTracks(playlistId) {
|
|
16
|
+
return api.get(`/playlists/${encodeURIComponent(playlistId)}/tracks`);
|
|
17
|
+
},
|
|
18
|
+
previewUrl(url) {
|
|
19
|
+
return api.get("/playlists/preview", {
|
|
20
|
+
query: { url },
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
addTrack(playlistId, input) {
|
|
24
|
+
return api.post(`/playlists/${encodeURIComponent(playlistId)}/tracks`, input);
|
|
25
|
+
},
|
|
26
|
+
reorderTracks(playlistId, trackIds) {
|
|
27
|
+
return api.put(`/playlists/${encodeURIComponent(playlistId)}/tracks/reorder`, { trackIds });
|
|
28
|
+
},
|
|
29
|
+
removeTrack(playlistId, trackId) {
|
|
30
|
+
return api.delete(`/playlists/${encodeURIComponent(playlistId)}/tracks/${encodeURIComponent(trackId)}`);
|
|
31
|
+
},
|
|
32
|
+
listImports() {
|
|
33
|
+
return api.get("/playlists/imports");
|
|
34
|
+
},
|
|
35
|
+
getImport(jobId) {
|
|
36
|
+
return api.get(`/playlists/imports/${encodeURIComponent(jobId)}`);
|
|
37
|
+
},
|
|
38
|
+
startSpotifyImport(input) {
|
|
39
|
+
return api.post("/playlists/imports/spotify", input);
|
|
40
|
+
},
|
|
41
|
+
importYouTubePlaylist(input) {
|
|
42
|
+
return api.post("/playlists/imports/youtube", input);
|
|
43
|
+
},
|
|
44
|
+
importSoundCloudPlaylist(input) {
|
|
45
|
+
return api.post("/playlists/imports/soundcloud", input);
|
|
46
|
+
},
|
|
47
|
+
cancelImport(jobId) {
|
|
48
|
+
return api.post(`/playlists/imports/${encodeURIComponent(jobId)}/cancel`, {});
|
|
49
|
+
},
|
|
50
|
+
searchPreview(query, source = "youtube", limit = 8) {
|
|
51
|
+
return api.get("/media/search", {
|
|
52
|
+
query: {
|
|
53
|
+
q: query,
|
|
54
|
+
source,
|
|
55
|
+
limit,
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=playlist.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playlist.js","sourceRoot":"","sources":["../../src/resources/playlist.ts"],"names":[],"mappings":"AAOA,MAAM,UAAU,sBAAsB,CAAC,GAAY;IAC/C,OAAO;QACH,IAAI;YACA,OAAO,GAAG,CAAC,GAAG,CAAoB,YAAY,CAAC,CAAC;QACpD,CAAC;QAED,MAAM,CAAC,KAAgC;YACnC,OAAO,GAAG,CAAC,IAAI,CACX,YAAY,EACZ,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CACtD,CAAC;QACN,CAAC;QAED,MAAM,CACF,UAAkB,EAClB,KAGC;YAED,OAAO,GAAG,CAAC,GAAG,CACV,cAAc,kBAAkB,CAAC,UAAU,CAAC,EAAE,EAC9C,KAAK,CACR,CAAC;QACN,CAAC;QAED,MAAM,CAAC,UAAkB;YACrB,OAAO,GAAG,CAAC,MAAM,CACb,cAAc,kBAAkB,CAAC,UAAU,CAAC,EAAE,CACjD,CAAC;QACN,CAAC;QAED,SAAS,CAAC,UAAkB;YACxB,OAAO,GAAG,CAAC,GAAG,CACV,cAAc,kBAAkB,CAAC,UAAU,CAAC,SAAS,CACxD,CAAC;QACN,CAAC;QAED,UA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CACL,CAAC;QACN,CAAC;QAED,aAAa,CAAC,KAAa,EAAE,MAAM,GAAG,SAAS,EAAE,KAAK,GAAG,CAAC;YACtD,OAAO,GAAG,CAAC,GAAG,CAAsB,eAAe,EAAE;gBACjD,KAAK,EAAE;oBACH,CAAC,EAAE,KAAK;oBACR,MAAM;oBACN,KAAK;iBACR;aACJ,CAAC,CAAC;QACP,CAAC;KACJ,CAAC;AACN,CAAC"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ApiLike, RoomBotPermission, RoomBotToken, RoomSummary } from "../types";
|
|
2
|
+
export declare function createRoomResource(api: ApiLike): {
|
|
3
|
+
list(): Promise<import("..").ApiSuccessResponse<RoomSummary[]>>;
|
|
4
|
+
featured(): Promise<{
|
|
5
|
+
data: RoomSummary[];
|
|
6
|
+
status: number;
|
|
7
|
+
headers: Headers;
|
|
8
|
+
}>;
|
|
9
|
+
getBySlug(slug: string): Promise<import("..").ApiSuccessResponse<RoomSummary>>;
|
|
10
|
+
getJoinPreview(slug: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
11
|
+
getWaitlist(slug: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
12
|
+
create(input: {
|
|
13
|
+
name: string;
|
|
14
|
+
slug: string;
|
|
15
|
+
description?: string;
|
|
16
|
+
capacity?: number;
|
|
17
|
+
isPrivate?: boolean;
|
|
18
|
+
}): Promise<import("..").ApiSuccessResponse<RoomSummary>>;
|
|
19
|
+
join(roomIdOrSlug: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
20
|
+
favorite(roomId: string): Promise<import("..").ApiSuccessResponse<void>>;
|
|
21
|
+
unfavorite(roomId: string): Promise<import("..").ApiSuccessResponse<void>>;
|
|
22
|
+
getManagement(roomId: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
23
|
+
createBotToken(roomId: string, input: {
|
|
24
|
+
botName: string;
|
|
25
|
+
botAvatarUrl?: string;
|
|
26
|
+
commandPrefix?: string;
|
|
27
|
+
permissions?: RoomBotPermission[];
|
|
28
|
+
expiresInHours?: number;
|
|
29
|
+
}): Promise<import("..").ApiSuccessResponse<RoomBotToken>>;
|
|
30
|
+
listEmojis(roomId: string): Promise<import("..").ApiSuccessResponse<unknown[]>>;
|
|
31
|
+
listAuditLogs(roomId: string, limit?: number): Promise<import("..").ApiSuccessResponse<{
|
|
32
|
+
logs: unknown[];
|
|
33
|
+
}>>;
|
|
34
|
+
updateSettings(roomId: string, input: Record<string, unknown>): Promise<import("..").ApiSuccessResponse<{
|
|
35
|
+
room: Record<string, unknown>;
|
|
36
|
+
}>>;
|
|
37
|
+
updateLinkFilters(roomId: string, input: {
|
|
38
|
+
blockAllLinks: boolean;
|
|
39
|
+
blockedLinkPatterns: string[];
|
|
40
|
+
commandAnnouncement?: Record<string, unknown>;
|
|
41
|
+
}): Promise<import("..").ApiSuccessResponse<{
|
|
42
|
+
room: Record<string, unknown>;
|
|
43
|
+
}>>;
|
|
44
|
+
setRole(roomId: string, userId: string, role: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
45
|
+
setQueueAccess(roomId: string, userId: string, blocked: boolean): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
46
|
+
unban(roomId: string, userId: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
47
|
+
createEmoji(roomId: string, input: Record<string, unknown>): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
48
|
+
updateEmoji(roomId: string, emojiId: string, input: Record<string, unknown>): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
49
|
+
deleteEmoji(roomId: string, emojiId: string): Promise<import("..").ApiSuccessResponse<Record<string, unknown>>>;
|
|
50
|
+
};
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { ApiError } from "../core/ApiError";
|
|
2
|
+
const DIRECT_HTTP_IMAGE_REGEX = /\.(?:png|jpe?g|gif|webp|avif|apng)(?:\?[^#\s]*)?(?:#[^\s]*)?$/i;
|
|
3
|
+
const ROOM_BOT_PERMISSION_SET = new Set([
|
|
4
|
+
"read_state",
|
|
5
|
+
"read_chat",
|
|
6
|
+
"send_chat",
|
|
7
|
+
"manage_room",
|
|
8
|
+
]);
|
|
9
|
+
function createValidationError(api, messageKey, code) {
|
|
10
|
+
return new ApiError(api.formatMessage(messageKey), {
|
|
11
|
+
status: 400,
|
|
12
|
+
statusText: "Bad Request",
|
|
13
|
+
code,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
function validateCreateBotTokenInput(api, input) {
|
|
17
|
+
const normalizedBotName = input.botName.trim();
|
|
18
|
+
if (normalizedBotName.length < 2 || normalizedBotName.length > 40) {
|
|
19
|
+
throw createValidationError(api, "roomBotCreateNameLengthInvalid", "ROOM_BOT_NAME_INVALID");
|
|
20
|
+
}
|
|
21
|
+
if (typeof input.botAvatarUrl === "string" && input.botAvatarUrl.trim()) {
|
|
22
|
+
let parsedUrl;
|
|
23
|
+
try {
|
|
24
|
+
parsedUrl = new URL(input.botAvatarUrl.trim());
|
|
25
|
+
}
|
|
26
|
+
catch {
|
|
27
|
+
throw createValidationError(api, "roomBotCreateAvatarUrlInvalid", "ROOM_BOT_AVATAR_URL_INVALID");
|
|
28
|
+
}
|
|
29
|
+
if (!["http:", "https:"].includes(parsedUrl.protocol)) {
|
|
30
|
+
throw createValidationError(api, "roomBotCreateAvatarUrlInvalid", "ROOM_BOT_AVATAR_URL_INVALID");
|
|
31
|
+
}
|
|
32
|
+
if (!DIRECT_HTTP_IMAGE_REGEX.test(parsedUrl.pathname)) {
|
|
33
|
+
throw createValidationError(api, "roomBotCreateAvatarUrlDirectImageRequired", "ROOM_BOT_AVATAR_URL_NOT_IMAGE");
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
const normalizedPrefix = typeof input.commandPrefix === "string" && input.commandPrefix.trim()
|
|
37
|
+
? input.commandPrefix.trim()
|
|
38
|
+
: "!";
|
|
39
|
+
if (normalizedPrefix.length < 1 || normalizedPrefix.length > 12) {
|
|
40
|
+
throw createValidationError(api, "roomBotCreatePrefixLengthInvalid", "ROOM_BOT_PREFIX_INVALID");
|
|
41
|
+
}
|
|
42
|
+
if (/\s/.test(normalizedPrefix)) {
|
|
43
|
+
throw createValidationError(api, "roomBotCreatePrefixWhitespaceInvalid", "ROOM_BOT_PREFIX_WHITESPACE");
|
|
44
|
+
}
|
|
45
|
+
if (input.permissions !== undefined) {
|
|
46
|
+
if (!Array.isArray(input.permissions)) {
|
|
47
|
+
throw createValidationError(api, "roomBotCreatePermissionsArrayRequired", "ROOM_BOT_PERMISSIONS_INVALID");
|
|
48
|
+
}
|
|
49
|
+
if (input.permissions.length === 0) {
|
|
50
|
+
throw createValidationError(api, "roomBotCreatePermissionRequired", "ROOM_BOT_PERMISSION_REQUIRED");
|
|
51
|
+
}
|
|
52
|
+
if (input.permissions.some((permission) => !ROOM_BOT_PERMISSION_SET.has(permission))) {
|
|
53
|
+
throw createValidationError(api, "roomBotCreatePermissionInvalid", "ROOM_BOT_PERMISSION_INVALID");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
if (input.expiresInHours !== undefined) {
|
|
57
|
+
if (!Number.isFinite(input.expiresInHours)) {
|
|
58
|
+
throw createValidationError(api, "roomBotCreateExpiryNumberInvalid", "ROOM_BOT_EXPIRY_INVALID");
|
|
59
|
+
}
|
|
60
|
+
const roundedValue = Math.round(input.expiresInHours);
|
|
61
|
+
if (roundedValue < 1 || roundedValue > 24 * 30) {
|
|
62
|
+
throw createValidationError(api, "roomBotCreateExpiryRangeInvalid", "ROOM_BOT_EXPIRY_RANGE_INVALID");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function looksLikeUuid(value) {
|
|
67
|
+
return /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
|
|
68
|
+
}
|
|
69
|
+
export function createRoomResource(api) {
|
|
70
|
+
return {
|
|
71
|
+
list() {
|
|
72
|
+
return api.get("/rooms", { authMode: "none" });
|
|
73
|
+
},
|
|
74
|
+
async featured() {
|
|
75
|
+
const response = await api.get("/rooms", {
|
|
76
|
+
authMode: "none",
|
|
77
|
+
});
|
|
78
|
+
return {
|
|
79
|
+
...response,
|
|
80
|
+
data: response.data.filter((room) => Boolean(room.isFeatured)),
|
|
81
|
+
};
|
|
82
|
+
},
|
|
83
|
+
getBySlug(slug) {
|
|
84
|
+
return api.get(`/rooms/${encodeURIComponent(slug)}`, {
|
|
85
|
+
authMode: "none",
|
|
86
|
+
});
|
|
87
|
+
},
|
|
88
|
+
getJoinPreview(slug) {
|
|
89
|
+
return api.get(`/rooms/${encodeURIComponent(slug)}/join`);
|
|
90
|
+
},
|
|
91
|
+
getWaitlist(slug) {
|
|
92
|
+
return api.get(`/rooms/${encodeURIComponent(slug)}/waitlist`, { authMode: "none" });
|
|
93
|
+
},
|
|
94
|
+
create(input) {
|
|
95
|
+
return api.post("/rooms", input);
|
|
96
|
+
},
|
|
97
|
+
async join(roomIdOrSlug) {
|
|
98
|
+
let roomId = roomIdOrSlug;
|
|
99
|
+
if (!looksLikeUuid(roomIdOrSlug)) {
|
|
100
|
+
const room = await api.get(`/rooms/${encodeURIComponent(roomIdOrSlug)}`, { authMode: "none" });
|
|
101
|
+
roomId = room.data.id;
|
|
102
|
+
}
|
|
103
|
+
return api.post("/rooms/join", { roomId });
|
|
104
|
+
},
|
|
105
|
+
favorite(roomId) {
|
|
106
|
+
return api.post(`/rooms/${encodeURIComponent(roomId)}/favorite`, {}, { parseAs: "void" });
|
|
107
|
+
},
|
|
108
|
+
unfavorite(roomId) {
|
|
109
|
+
return api.delete(`/rooms/${encodeURIComponent(roomId)}/favorite`, { parseAs: "void" });
|
|
110
|
+
},
|
|
111
|
+
getManagement(roomId) {
|
|
112
|
+
return api.get(`/rooms/${encodeURIComponent(roomId)}/management`);
|
|
113
|
+
},
|
|
114
|
+
createBotToken(roomId, input) {
|
|
115
|
+
validateCreateBotTokenInput(api, input);
|
|
116
|
+
return api.post(`/rooms/${encodeURIComponent(roomId)}/bot-tokens`, input);
|
|
117
|
+
},
|
|
118
|
+
listEmojis(roomId) {
|
|
119
|
+
return api.get(`/rooms/${encodeURIComponent(roomId)}/emojis`);
|
|
120
|
+
},
|
|
121
|
+
listAuditLogs(roomId, limit) {
|
|
122
|
+
return api.get(`/rooms/${encodeURIComponent(roomId)}/audit-logs`, {
|
|
123
|
+
query: limit ? { limit } : undefined,
|
|
124
|
+
});
|
|
125
|
+
},
|
|
126
|
+
updateSettings(roomId, input) {
|
|
127
|
+
return api.patch(`/rooms/${encodeURIComponent(roomId)}/settings`, input);
|
|
128
|
+
},
|
|
129
|
+
updateLinkFilters(roomId, input) {
|
|
130
|
+
return api.patch(`/rooms/${encodeURIComponent(roomId)}/link-filters`, input);
|
|
131
|
+
},
|
|
132
|
+
setRole(roomId, userId, role) {
|
|
133
|
+
return api.put(`/rooms/${encodeURIComponent(roomId)}/roles/${encodeURIComponent(userId)}`, { role });
|
|
134
|
+
},
|
|
135
|
+
setQueueAccess(roomId, userId, blocked) {
|
|
136
|
+
return api.put(`/rooms/${encodeURIComponent(roomId)}/queue-access/${encodeURIComponent(userId)}`, { blocked });
|
|
137
|
+
},
|
|
138
|
+
unban(roomId, userId) {
|
|
139
|
+
return api.delete(`/rooms/${encodeURIComponent(roomId)}/bans/${encodeURIComponent(userId)}`);
|
|
140
|
+
},
|
|
141
|
+
createEmoji(roomId, input) {
|
|
142
|
+
return api.post(`/rooms/${encodeURIComponent(roomId)}/emojis`, input);
|
|
143
|
+
},
|
|
144
|
+
updateEmoji(roomId, emojiId, input) {
|
|
145
|
+
return api.patch(`/rooms/${encodeURIComponent(roomId)}/emojis/${encodeURIComponent(emojiId)}`, input);
|
|
146
|
+
},
|
|
147
|
+
deleteEmoji(roomId, emojiId) {
|
|
148
|
+
return api.delete(`/rooms/${encodeURIComponent(roomId)}/emojis/${encodeURIComponent(emojiId)}`);
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=room.js.map
|