@notidotbot/noti-api-client 1.4.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/cname.js +3 -0
- package/dist/classes/@me.d.ts +122 -0
- package/dist/classes/@me.js +59 -0
- package/dist/classes/admin.d.ts +71 -0
- package/dist/classes/admin.js +26 -0
- package/dist/classes/client.d.ts +156 -0
- package/dist/classes/client.js +116 -0
- package/dist/classes/emotes.d.ts +31 -0
- package/dist/classes/emotes.js +24 -0
- package/dist/classes/files.d.ts +36 -0
- package/dist/classes/files.js +36 -0
- package/dist/classes/guild.d.ts +187 -0
- package/dist/classes/guild.js +140 -0
- package/dist/classes/guildDrops.d.ts +58 -0
- package/dist/classes/guildDrops.js +32 -0
- package/dist/classes/guildGiveaway.d.ts +110 -0
- package/dist/classes/guildGiveaway.js +76 -0
- package/dist/classes/guildPlatform.d.ts +163 -0
- package/dist/classes/guildPlatform.js +99 -0
- package/dist/classes/guildPlatformAction.d.ts +67 -0
- package/dist/classes/guildPlatformAction.js +26 -0
- package/dist/classes/guildStarboard.d.ts +66 -0
- package/dist/classes/guildStarboard.js +36 -0
- package/dist/classes/linked.d.ts +26 -0
- package/dist/classes/linked.js +32 -0
- package/dist/classes/other.d.ts +83 -0
- package/dist/classes/other.js +53 -0
- package/dist/classes/platform.d.ts +227 -0
- package/dist/classes/platform.js +30 -0
- package/dist/classes/premium.d.ts +179 -0
- package/dist/classes/premium.js +76 -0
- package/dist/classes/sessions.d.ts +42 -0
- package/dist/classes/sessions.js +30 -0
- package/dist/classes/teams.d.ts +88 -0
- package/dist/classes/teams.js +66 -0
- package/dist/classes/telemetry.d.ts +32 -0
- package/dist/classes/telemetry.js +28 -0
- package/dist/classes/user.d.ts +40 -0
- package/dist/classes/user.js +30 -0
- package/dist/classes/vods.d.ts +55 -0
- package/dist/classes/vods.js +38 -0
- package/dist/core/manager.d.ts +57 -0
- package/dist/core/manager.js +78 -0
- package/dist/core/utils.d.ts +4 -0
- package/dist/core/utils.js +26 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +42 -0
- package/dist/modules/stripe.d.ts +12 -0
- package/dist/modules/stripe.js +18 -0
- package/dist/other/bitfields.d.ts +283 -0
- package/dist/other/bitfields.js +323 -0
- package/dist/other/enums.d.ts +2 -0
- package/dist/other/enums.js +10 -0
- package/dist/other/prisma.d.ts +76 -0
- package/dist/other/prisma.js +9 -0
- package/dist/other/templates.d.ts +795 -0
- package/dist/other/templates.js +706 -0
- package/dist/other/types.d.ts +45 -0
- package/dist/other/types.js +17 -0
- package/dist/other/utils.d.ts +5 -0
- package/dist/other/utils.js +51 -0
- package/dist/other/zod/client.zod.d.ts +349 -0
- package/dist/other/zod/client.zod.js +63 -0
- package/dist/other/zod/drops.zod.d.ts +16 -0
- package/dist/other/zod/drops.zod.js +93 -0
- package/dist/other/zod/giveaways.zod.d.ts +382 -0
- package/dist/other/zod/giveaways.zod.js +72 -0
- package/dist/other/zod/guild.zod.d.ts +1638 -0
- package/dist/other/zod/guild.zod.js +139 -0
- package/dist/other/zod/kickStreamer.zod.d.ts +761 -0
- package/dist/other/zod/kickStreamer.zod.js +92 -0
- package/dist/other/zod/member.zod.d.ts +22 -0
- package/dist/other/zod/member.zod.js +15 -0
- package/dist/other/zod/r2Storage.zod.d.ts +56 -0
- package/dist/other/zod/r2Storage.zod.js +21 -0
- package/dist/other/zod/rumbleStreamer.zod.d.ts +530 -0
- package/dist/other/zod/rumbleStreamer.zod.js +45 -0
- package/dist/other/zod/schema.zod.d.ts +25 -0
- package/dist/other/zod/schema.zod.js +168 -0
- package/dist/other/zod/starboard.zod.d.ts +167 -0
- package/dist/other/zod/starboard.zod.js +46 -0
- package/dist/other/zod/team.zod.d.ts +107 -0
- package/dist/other/zod/team.zod.js +30 -0
- package/dist/other/zod/tiktokStreamer.zod.d.ts +473 -0
- package/dist/other/zod/tiktokStreamer.zod.js +46 -0
- package/dist/other/zod/twitchStreamer.zod.d.ts +473 -0
- package/dist/other/zod/twitchStreamer.zod.js +46 -0
- package/dist/other/zod/user.zod.d.ts +678 -0
- package/dist/other/zod/user.zod.js +124 -0
- package/dist/other/zod/youtubeStreamer.zod.d.ts +476 -0
- package/dist/other/zod/youtubeStreamer.zod.js +47 -0
- package/dist/other/zod/zod.d.ts +177 -0
- package/dist/other/zod/zod.js +60 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +37 -0
- package/dist/types.js +2 -0
- package/package.json +63 -0
- package/prisma/generated/index.ts +25 -0
- package/prisma/generated/ts-prisma.d.ts +91725 -0
- package/prisma/schema/models/client.prisma +89 -0
- package/prisma/schema/models/drops.prisma +167 -0
- package/prisma/schema/models/giveaways.prisma +82 -0
- package/prisma/schema/models/guild.prisma +368 -0
- package/prisma/schema/models/kickStreamer.prisma +202 -0
- package/prisma/schema/models/member.prisma +10 -0
- package/prisma/schema/models/r2Storage.prisma +22 -0
- package/prisma/schema/models/rumbleStreamer.prisma +121 -0
- package/prisma/schema/models/starboard.prisma +66 -0
- package/prisma/schema/models/team.prisma +38 -0
- package/prisma/schema/models/tiktokStreamer.prisma +121 -0
- package/prisma/schema/models/twitchStreamer.prisma +122 -0
- package/prisma/schema/models/user.prisma +212 -0
- package/prisma/schema/models/youtubeStreamer.prisma +123 -0
- package/prisma/schema/schema.prisma +182 -0
- package/prisma.config.ts +6 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APITeams = void 0;
|
|
4
|
+
// Data.
|
|
5
|
+
class APITeams {
|
|
6
|
+
web;
|
|
7
|
+
constructor(web) {
|
|
8
|
+
this.web = web;
|
|
9
|
+
}
|
|
10
|
+
// Methods.
|
|
11
|
+
async getAllUserTeams({ auth }) {
|
|
12
|
+
return await this.web.request({
|
|
13
|
+
method: 'GET', auth,
|
|
14
|
+
endpoint: this.web.qp('/data/teams'),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async createTeam({ auth, teamName }) {
|
|
18
|
+
return await this.web.request({
|
|
19
|
+
method: 'POST', auth,
|
|
20
|
+
endpoint: this.web.qp('/data/teams'),
|
|
21
|
+
body: { teamName },
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
async joinOrLeaveTeam({ auth, teamOrCode, action }) {
|
|
25
|
+
const query = action === 'join' ? { code: teamOrCode } : { teamId: teamOrCode };
|
|
26
|
+
return await this.web.request({
|
|
27
|
+
method: 'PUT', auth,
|
|
28
|
+
endpoint: this.web.qp(`/data/teams/${action}`, query),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async createTeamInvite({ auth, teamId, maxUses, bitfieldToSet, expiresAt }) {
|
|
32
|
+
return await this.web.request({
|
|
33
|
+
method: 'PUT', auth,
|
|
34
|
+
endpoint: this.web.qp(`/data/teams/${teamId}/invite`),
|
|
35
|
+
body: { maxUses, bitfieldToSet, expiresAt },
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
async kickTeamMember({ auth, teamId, userId }) {
|
|
39
|
+
return await this.web.request({
|
|
40
|
+
method: 'PUT', auth,
|
|
41
|
+
endpoint: this.web.qp(`/data/teams/${teamId}/kick`),
|
|
42
|
+
body: { userId },
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
async updateMemberPermissions({ auth, teamId, userId, bitfieldToSet }) {
|
|
46
|
+
return await this.web.request({
|
|
47
|
+
method: 'PUT', auth,
|
|
48
|
+
endpoint: this.web.qp(`/data/teams/${teamId}/update`),
|
|
49
|
+
body: { userId, bitfieldToSet },
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
async updateTeamName({ auth, teamId, teamName }) {
|
|
53
|
+
return await this.web.request({
|
|
54
|
+
method: 'PATCH', auth,
|
|
55
|
+
endpoint: this.web.qp(`/data/teams/${teamId}`),
|
|
56
|
+
body: { teamName },
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async deleteTeam({ auth, teamId }) {
|
|
60
|
+
return await this.web.request({
|
|
61
|
+
method: 'DELETE', auth,
|
|
62
|
+
endpoint: this.web.qp(`/data/teams/${teamId}`),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.APITeams = APITeams;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { WebDataManager } from '../core/manager';
|
|
2
|
+
import { CancelOutWebResponses } from '../types';
|
|
3
|
+
import { Guild, User } from '../other/prisma';
|
|
4
|
+
export declare class APITelemetry {
|
|
5
|
+
private web;
|
|
6
|
+
constructor(web: WebDataManager);
|
|
7
|
+
getTelemetry<T extends string>({ auth, guildId }: TelemetryFunctionsInput<T>['getTelemetry']): Promise<import("../types").WebResponse<Telemetry<T>>>;
|
|
8
|
+
toggleTelemetry({ auth, type, ...rest }: TelemetryFunctionsInput['toggleTelemetry']): Promise<import("../types").WebResponse<string>>;
|
|
9
|
+
}
|
|
10
|
+
export type TelemetryFunctionsInput<T extends string = never> = {
|
|
11
|
+
'getTelemetry': {
|
|
12
|
+
auth: string;
|
|
13
|
+
guildId?: T;
|
|
14
|
+
};
|
|
15
|
+
'toggleTelemetry': {
|
|
16
|
+
auth: string;
|
|
17
|
+
} & ({
|
|
18
|
+
guildId?: T;
|
|
19
|
+
type: 'dismissAds';
|
|
20
|
+
} | {
|
|
21
|
+
type: 'overlayGenerated';
|
|
22
|
+
});
|
|
23
|
+
};
|
|
24
|
+
export type TelemetryReturnTypes = {
|
|
25
|
+
'getTelemetryRaw': Awaited<ReturnType<APITelemetry['getTelemetry']>>;
|
|
26
|
+
'getTelemetrySuccess': CancelOutWebResponses<Awaited<ReturnType<APITelemetry['getTelemetry']>>>;
|
|
27
|
+
'toggleTelemetryRaw': Awaited<ReturnType<APITelemetry['toggleTelemetry']>>;
|
|
28
|
+
'toggleTelemetrySuccess': CancelOutWebResponses<Awaited<ReturnType<APITelemetry['toggleTelemetry']>>>;
|
|
29
|
+
};
|
|
30
|
+
export type Telemetry<GuildId extends string = never> = GuildId extends string ? GuildTelemetry : UserTelemetry;
|
|
31
|
+
export type UserTelemetry = NonNullable<User['gettingStarted']>;
|
|
32
|
+
export type GuildTelemetry = NonNullable<Guild['gettingStarted']>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APITelemetry = void 0;
|
|
4
|
+
// Data.
|
|
5
|
+
class APITelemetry {
|
|
6
|
+
web;
|
|
7
|
+
constructor(web) {
|
|
8
|
+
this.web = web;
|
|
9
|
+
}
|
|
10
|
+
// Methods.
|
|
11
|
+
async getTelemetry({ auth, guildId }) {
|
|
12
|
+
return await this.web.request({
|
|
13
|
+
method: 'GET', auth,
|
|
14
|
+
endpoint: this.web.qp('/telemetry', {
|
|
15
|
+
guild: guildId,
|
|
16
|
+
}),
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
async toggleTelemetry({ auth, type, ...rest }) {
|
|
20
|
+
return await this.web.request({
|
|
21
|
+
method: 'POST', auth,
|
|
22
|
+
endpoint: this.web.qp(`/telemetry/${type}`, {
|
|
23
|
+
guild: 'guildId' in rest ? rest.guildId : undefined,
|
|
24
|
+
}),
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.APITelemetry = APITelemetry;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { CancelOutWebResponses, DeepPartial } from '../types';
|
|
2
|
+
import { WebDataManager } from '../core/manager';
|
|
3
|
+
import { UserZod } from '../other/prisma';
|
|
4
|
+
import { CurrentUser } from './@me';
|
|
5
|
+
export declare class APIUser {
|
|
6
|
+
private web;
|
|
7
|
+
constructor(web: WebDataManager);
|
|
8
|
+
getUser({ auth, userId }: UserFunctionsInput['getUser']): Promise<import("../types").WebResponse<UserResponse>>;
|
|
9
|
+
updateUser({ auth, userId, user }: UserFunctionsInput['updateUser']): Promise<import("../types").WebResponse<string>>;
|
|
10
|
+
deleteUser({ auth, userId }: UserFunctionsInput['getUser']): Promise<import("../types").WebResponse<string>>;
|
|
11
|
+
}
|
|
12
|
+
export type UserFunctionsInput = {
|
|
13
|
+
'getUser': {
|
|
14
|
+
auth: string;
|
|
15
|
+
userId: string;
|
|
16
|
+
};
|
|
17
|
+
'updateUser': {
|
|
18
|
+
auth: string;
|
|
19
|
+
userId: string;
|
|
20
|
+
user: DeepPartial<UserZod>;
|
|
21
|
+
};
|
|
22
|
+
'deleteUser': {
|
|
23
|
+
auth: string;
|
|
24
|
+
userId: string;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
export type UserReturnTypes = {
|
|
28
|
+
'getUserRaw': Awaited<ReturnType<APIUser['getUser']>>;
|
|
29
|
+
'getUserSuccess': CancelOutWebResponses<Awaited<ReturnType<APIUser['getUser']>>>;
|
|
30
|
+
'updateUserRaw': Awaited<ReturnType<APIUser['updateUser']>>;
|
|
31
|
+
'updateUserSuccess': CancelOutWebResponses<Awaited<ReturnType<APIUser['updateUser']>>>;
|
|
32
|
+
'deleteUserRaw': Awaited<ReturnType<APIUser['deleteUser']>>;
|
|
33
|
+
'deleteUserSuccess': CancelOutWebResponses<Awaited<ReturnType<APIUser['deleteUser']>>>;
|
|
34
|
+
};
|
|
35
|
+
export type UserResponse = Omit<CurrentUser, 'discord' | 'database'> & UserWithPremium;
|
|
36
|
+
export type UserWithPremium = CurrentUser['database'] & {
|
|
37
|
+
premium: {
|
|
38
|
+
enabled: boolean;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APIUser = void 0;
|
|
4
|
+
// Data.
|
|
5
|
+
class APIUser {
|
|
6
|
+
web;
|
|
7
|
+
constructor(web) {
|
|
8
|
+
this.web = web;
|
|
9
|
+
}
|
|
10
|
+
// Methods.
|
|
11
|
+
async getUser({ auth, userId }) {
|
|
12
|
+
return await this.web.request({
|
|
13
|
+
method: 'GET', auth,
|
|
14
|
+
endpoint: this.web.qp('/data/user/' + userId),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async updateUser({ auth, userId, user }) {
|
|
18
|
+
return await this.web.request({
|
|
19
|
+
method: 'PATCH', auth, body: user,
|
|
20
|
+
endpoint: this.web.qp('/data/user/' + userId),
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async deleteUser({ auth, userId }) {
|
|
24
|
+
return await this.web.request({
|
|
25
|
+
method: 'DELETE', auth,
|
|
26
|
+
endpoint: this.web.qp('/data/user/' + userId),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.APIUser = APIUser;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { WebDataManager } from '../core/manager';
|
|
2
|
+
import { CancelOutWebResponses } from '../types';
|
|
3
|
+
export declare class APIVods {
|
|
4
|
+
private web;
|
|
5
|
+
constructor(web: WebDataManager);
|
|
6
|
+
getTotalFiles({ auth }: VodsFunctionsInput['getTotalFiles']): Promise<import("../types").WebResponse<VodResponse>>;
|
|
7
|
+
getGuildFileVodData({ guildId, fileKey }: VodsFunctionsInput['getGuildFileVodData']): Promise<import("../types").WebResponse<VodGuildFileData>>;
|
|
8
|
+
getVodFileData({ auth, fileKey }: VodsFunctionsInput['getVodFileData']): Promise<import("../types").WebResponse<VodFileData>>;
|
|
9
|
+
deleteVod({ auth, fileKey }: VodsFunctionsInput['deleteVod']): Promise<import("../types").WebResponse<true>>;
|
|
10
|
+
}
|
|
11
|
+
export type VodsFunctionsInput = {
|
|
12
|
+
'getTotalFiles': {
|
|
13
|
+
auth: string;
|
|
14
|
+
};
|
|
15
|
+
'getGuildFileVodData': {
|
|
16
|
+
guildId: string;
|
|
17
|
+
fileKey: string;
|
|
18
|
+
};
|
|
19
|
+
'getVodFileData': {
|
|
20
|
+
auth: string;
|
|
21
|
+
fileKey: string;
|
|
22
|
+
};
|
|
23
|
+
'deleteVod': {
|
|
24
|
+
auth: string;
|
|
25
|
+
fileKey: string;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export type R2ReturnTypes = {
|
|
29
|
+
'getTotalFilesRaw': Awaited<ReturnType<APIVods['getTotalFiles']>>;
|
|
30
|
+
'getTotalFilesSuccess': CancelOutWebResponses<Awaited<ReturnType<APIVods['getTotalFiles']>>>;
|
|
31
|
+
'getGuildFileVodDataRaw': Awaited<ReturnType<APIVods['getGuildFileVodData']>>;
|
|
32
|
+
'getGuildFileVodDataSuccess': CancelOutWebResponses<Awaited<ReturnType<APIVods['getGuildFileVodData']>>>;
|
|
33
|
+
'getVodFileDataRaw': Awaited<ReturnType<APIVods['getVodFileData']>>;
|
|
34
|
+
'getVodFileDataSuccess': CancelOutWebResponses<Awaited<ReturnType<APIVods['getVodFileData']>>>;
|
|
35
|
+
'deleteVodRaw': Awaited<ReturnType<APIVods['deleteVod']>>;
|
|
36
|
+
'deleteVodSuccess': CancelOutWebResponses<Awaited<ReturnType<APIVods['deleteVod']>>>;
|
|
37
|
+
};
|
|
38
|
+
export type VodResponse = {
|
|
39
|
+
totalVodsInR2: number;
|
|
40
|
+
registeredFiles: number;
|
|
41
|
+
};
|
|
42
|
+
export type VodGuildFileData = {
|
|
43
|
+
guildId: string;
|
|
44
|
+
allowedUntil: Date;
|
|
45
|
+
tempUrl: string;
|
|
46
|
+
};
|
|
47
|
+
export type VodFileData = {
|
|
48
|
+
key: string;
|
|
49
|
+
contentType?: string;
|
|
50
|
+
contentLength?: number;
|
|
51
|
+
lastModified?: number;
|
|
52
|
+
expiresAt?: string;
|
|
53
|
+
allowedGuilds: string[];
|
|
54
|
+
tempUrl: string;
|
|
55
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.APIVods = void 0;
|
|
4
|
+
// Data.
|
|
5
|
+
class APIVods {
|
|
6
|
+
web;
|
|
7
|
+
constructor(web) {
|
|
8
|
+
this.web = web;
|
|
9
|
+
}
|
|
10
|
+
// Methods.
|
|
11
|
+
async getTotalFiles({ auth }) {
|
|
12
|
+
return await this.web.request({
|
|
13
|
+
method: 'GET', auth,
|
|
14
|
+
endpoint: this.web.qp('/data/vods'),
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
async getGuildFileVodData({ guildId, fileKey }) {
|
|
18
|
+
return await this.web.request({
|
|
19
|
+
method: 'GET',
|
|
20
|
+
endpoint: this.web.qp('/data/vods/' + guildId + '/' + fileKey, {
|
|
21
|
+
noRedirect: true,
|
|
22
|
+
}),
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
async getVodFileData({ auth, fileKey }) {
|
|
26
|
+
return await this.web.request({
|
|
27
|
+
method: 'GET', auth,
|
|
28
|
+
endpoint: this.web.qp('/data/vods/' + fileKey),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
async deleteVod({ auth, fileKey }) {
|
|
32
|
+
return await this.web.request({
|
|
33
|
+
method: 'DELETE', auth,
|
|
34
|
+
endpoint: this.web.qp('/data/vods/' + fileKey),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.APIVods = APIVods;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { APIPlatformAction } from '../classes/guildPlatformAction';
|
|
2
|
+
import { APIGuildStarboard } from '../classes/guildStarboard';
|
|
3
|
+
import { APIGuildPlatform } from '../classes/guildPlatform';
|
|
4
|
+
import { APIGuildGiveaway } from '../classes/guildGiveaway';
|
|
5
|
+
import { AxiosResponse } from 'axios';
|
|
6
|
+
import { RequestMethod, WebResponse } from '../types';
|
|
7
|
+
import { APITelemetry } from '../classes/telemetry';
|
|
8
|
+
import { APISessions } from '../classes/sessions';
|
|
9
|
+
import { APIPlatform } from '../classes/platform';
|
|
10
|
+
import { APIPremium } from '../classes/premium';
|
|
11
|
+
import { APILinked } from '../classes/linked';
|
|
12
|
+
import { APIClient } from '../classes/client';
|
|
13
|
+
import { APITeams } from '../classes/teams';
|
|
14
|
+
import { APIOther } from '../classes/other';
|
|
15
|
+
import { APIGuild } from '../classes/guild';
|
|
16
|
+
import { APIFiles } from '../classes/files';
|
|
17
|
+
import { APIAdmin } from '../classes/admin';
|
|
18
|
+
import { APIVods } from '../classes/vods';
|
|
19
|
+
import { APIUser } from '../classes/user';
|
|
20
|
+
import { APIMe } from '../classes/@me';
|
|
21
|
+
export declare class WebDataManager {
|
|
22
|
+
url: string;
|
|
23
|
+
options?: {
|
|
24
|
+
log?: boolean;
|
|
25
|
+
} | undefined;
|
|
26
|
+
readonly me: APIMe;
|
|
27
|
+
readonly user: APIUser;
|
|
28
|
+
readonly vods: APIVods;
|
|
29
|
+
readonly files: APIFiles;
|
|
30
|
+
readonly admin: APIAdmin;
|
|
31
|
+
readonly other: APIOther;
|
|
32
|
+
readonly guild: APIGuild;
|
|
33
|
+
readonly teams: APITeams;
|
|
34
|
+
readonly client: APIClient;
|
|
35
|
+
readonly linked: APILinked;
|
|
36
|
+
readonly premium: APIPremium;
|
|
37
|
+
readonly platform: APIPlatform;
|
|
38
|
+
readonly sessions: APISessions;
|
|
39
|
+
readonly telemetry: APITelemetry;
|
|
40
|
+
readonly guildPlatform: APIGuildPlatform;
|
|
41
|
+
readonly guildGiveaway: APIGuildGiveaway;
|
|
42
|
+
readonly guildStarboard: APIGuildStarboard;
|
|
43
|
+
readonly guildPlatformAction: APIPlatformAction;
|
|
44
|
+
constructor(url: string, options?: {
|
|
45
|
+
log?: boolean;
|
|
46
|
+
} | undefined);
|
|
47
|
+
request<O, T = unknown, C extends boolean = false>(data: {
|
|
48
|
+
method: RequestMethod;
|
|
49
|
+
endpoint: string;
|
|
50
|
+
body?: T;
|
|
51
|
+
auth?: string;
|
|
52
|
+
raw?: C;
|
|
53
|
+
headers?: Record<string, string> | null;
|
|
54
|
+
doNotStringify?: boolean;
|
|
55
|
+
}): Promise<C extends false ? WebResponse<O> : AxiosResponse<O>>;
|
|
56
|
+
qp<T extends Record<string, unknown>>(url: string, params?: T): string;
|
|
57
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.WebDataManager = void 0;
|
|
7
|
+
const guildPlatformAction_1 = require("../classes/guildPlatformAction");
|
|
8
|
+
const guildStarboard_1 = require("../classes/guildStarboard");
|
|
9
|
+
const guildPlatform_1 = require("../classes/guildPlatform");
|
|
10
|
+
const guildGiveaway_1 = require("../classes/guildGiveaway");
|
|
11
|
+
const axios_1 = __importDefault(require("axios"));
|
|
12
|
+
const telemetry_1 = require("../classes/telemetry");
|
|
13
|
+
const sessions_1 = require("../classes/sessions");
|
|
14
|
+
const platform_1 = require("../classes/platform");
|
|
15
|
+
const premium_1 = require("../classes/premium");
|
|
16
|
+
const linked_1 = require("../classes/linked");
|
|
17
|
+
const client_1 = require("../classes/client");
|
|
18
|
+
const teams_1 = require("../classes/teams");
|
|
19
|
+
const other_1 = require("../classes/other");
|
|
20
|
+
const guild_1 = require("../classes/guild");
|
|
21
|
+
const files_1 = require("../classes/files");
|
|
22
|
+
const admin_1 = require("../classes/admin");
|
|
23
|
+
const vods_1 = require("../classes/vods");
|
|
24
|
+
const user_1 = require("../classes/user");
|
|
25
|
+
const utils_1 = require("./utils");
|
|
26
|
+
const _me_1 = require("../classes/@me");
|
|
27
|
+
class WebDataManager {
|
|
28
|
+
url;
|
|
29
|
+
options;
|
|
30
|
+
me = new _me_1.APIMe(this);
|
|
31
|
+
user = new user_1.APIUser(this);
|
|
32
|
+
vods = new vods_1.APIVods(this);
|
|
33
|
+
files = new files_1.APIFiles(this);
|
|
34
|
+
admin = new admin_1.APIAdmin(this);
|
|
35
|
+
other = new other_1.APIOther(this);
|
|
36
|
+
guild = new guild_1.APIGuild(this);
|
|
37
|
+
teams = new teams_1.APITeams(this);
|
|
38
|
+
client = new client_1.APIClient(this);
|
|
39
|
+
linked = new linked_1.APILinked(this);
|
|
40
|
+
premium = new premium_1.APIPremium(this);
|
|
41
|
+
platform = new platform_1.APIPlatform(this);
|
|
42
|
+
sessions = new sessions_1.APISessions(this);
|
|
43
|
+
telemetry = new telemetry_1.APITelemetry(this);
|
|
44
|
+
guildPlatform = new guildPlatform_1.APIGuildPlatform(this);
|
|
45
|
+
guildGiveaway = new guildGiveaway_1.APIGuildGiveaway(this);
|
|
46
|
+
guildStarboard = new guildStarboard_1.APIGuildStarboard(this);
|
|
47
|
+
guildPlatformAction = new guildPlatformAction_1.APIPlatformAction(this);
|
|
48
|
+
constructor(url, options) {
|
|
49
|
+
this.url = url;
|
|
50
|
+
this.options = options;
|
|
51
|
+
}
|
|
52
|
+
async request(data) {
|
|
53
|
+
axios_1.default.interceptors.response.use(utils_1.transformDates);
|
|
54
|
+
return await (0, axios_1.default)(this.url + data.endpoint, {
|
|
55
|
+
method: data.method,
|
|
56
|
+
data: data.body ? data.doNotStringify ? data.body : JSON.stringify(data.body) : undefined,
|
|
57
|
+
headers: {
|
|
58
|
+
...(data.headers === null ? {} : { 'Content-Type': 'application/json' }),
|
|
59
|
+
...(data.auth ? { 'Authorization': data.auth } : {}),
|
|
60
|
+
...(data.headers || {}),
|
|
61
|
+
},
|
|
62
|
+
})
|
|
63
|
+
.then((res) => data.raw ? res : res.data)
|
|
64
|
+
.catch((err) => data.raw ? err.response : err.response?.data);
|
|
65
|
+
}
|
|
66
|
+
qp(url, params) {
|
|
67
|
+
if (!params)
|
|
68
|
+
return url;
|
|
69
|
+
const query = new URLSearchParams();
|
|
70
|
+
for (const [key, value] of Object.entries(params)) {
|
|
71
|
+
if (value === undefined)
|
|
72
|
+
continue;
|
|
73
|
+
query.append(key, String(value));
|
|
74
|
+
}
|
|
75
|
+
return url + '?' + query.toString();
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
exports.WebDataManager = WebDataManager;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isDateStringRegex = isDateStringRegex;
|
|
4
|
+
exports.recursiveDateConversion = recursiveDateConversion;
|
|
5
|
+
exports.transformDates = transformDates;
|
|
6
|
+
function isDateStringRegex(value) {
|
|
7
|
+
const isoPattern = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d{1,3})?Z$/;
|
|
8
|
+
return typeof value === 'string' && isoPattern.test(value);
|
|
9
|
+
}
|
|
10
|
+
function recursiveDateConversion(data) {
|
|
11
|
+
if (data instanceof Date)
|
|
12
|
+
return new Date(data);
|
|
13
|
+
if (Array.isArray(data))
|
|
14
|
+
return data.map(recursiveDateConversion);
|
|
15
|
+
if (typeof data === 'object' && data !== null) {
|
|
16
|
+
for (const key in data) {
|
|
17
|
+
data[key] = recursiveDateConversion(data[key]);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return isDateStringRegex(data) ? new Date(data) : data;
|
|
21
|
+
}
|
|
22
|
+
function transformDates(response) {
|
|
23
|
+
if (response.data)
|
|
24
|
+
response.data = recursiveDateConversion(response.data);
|
|
25
|
+
return response;
|
|
26
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export * from './core/manager';
|
|
2
|
+
export * from './types';
|
|
3
|
+
export * from './classes/@me';
|
|
4
|
+
export * from './classes/user';
|
|
5
|
+
export * from './classes/admin';
|
|
6
|
+
export * from './classes/files';
|
|
7
|
+
export * from './classes/other';
|
|
8
|
+
export * from './classes/guild';
|
|
9
|
+
export * from './classes/teams';
|
|
10
|
+
export * from './classes/client';
|
|
11
|
+
export * from './classes/linked';
|
|
12
|
+
export * from './classes/premium';
|
|
13
|
+
export * from './classes/platform';
|
|
14
|
+
export * from './classes/sessions';
|
|
15
|
+
export * from './classes/telemetry';
|
|
16
|
+
export * from './classes/guildPlatform';
|
|
17
|
+
export * from './classes/guildGiveaway';
|
|
18
|
+
export * from './classes/guildStarboard';
|
|
19
|
+
export * from './classes/guildPlatformAction';
|
|
20
|
+
export { GuildMessageTypeEnum, StreamerMessageTypeEnum, PlatformEnum, $Enums } from './other/enums';
|
|
21
|
+
export type { Prisma, TSPrisma } from '@prisma/client';
|
|
22
|
+
export type { ClientChangelog, Guild, User, Team, Member, KickStreamer, TwitchStreamer, YoutubeStreamer, TiktokStreamer, RumbleStreamer, GuildGiveaway } from '@prisma/client';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.$Enums = exports.PlatformEnum = exports.StreamerMessageTypeEnum = exports.GuildMessageTypeEnum = void 0;
|
|
18
|
+
__exportStar(require("./core/manager"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
20
|
+
__exportStar(require("./classes/@me"), exports);
|
|
21
|
+
__exportStar(require("./classes/user"), exports);
|
|
22
|
+
__exportStar(require("./classes/admin"), exports);
|
|
23
|
+
__exportStar(require("./classes/files"), exports);
|
|
24
|
+
__exportStar(require("./classes/other"), exports);
|
|
25
|
+
__exportStar(require("./classes/guild"), exports);
|
|
26
|
+
__exportStar(require("./classes/teams"), exports);
|
|
27
|
+
__exportStar(require("./classes/client"), exports);
|
|
28
|
+
__exportStar(require("./classes/linked"), exports);
|
|
29
|
+
__exportStar(require("./classes/premium"), exports);
|
|
30
|
+
__exportStar(require("./classes/platform"), exports);
|
|
31
|
+
__exportStar(require("./classes/sessions"), exports);
|
|
32
|
+
__exportStar(require("./classes/telemetry"), exports);
|
|
33
|
+
__exportStar(require("./classes/guildPlatform"), exports);
|
|
34
|
+
__exportStar(require("./classes/guildGiveaway"), exports);
|
|
35
|
+
__exportStar(require("./classes/guildStarboard"), exports);
|
|
36
|
+
__exportStar(require("./classes/guildPlatformAction"), exports);
|
|
37
|
+
// Re-export Prisma generated enums (browser-safe)
|
|
38
|
+
var enums_1 = require("./other/enums");
|
|
39
|
+
Object.defineProperty(exports, "GuildMessageTypeEnum", { enumerable: true, get: function () { return enums_1.GuildMessageTypeEnum; } });
|
|
40
|
+
Object.defineProperty(exports, "StreamerMessageTypeEnum", { enumerable: true, get: function () { return enums_1.StreamerMessageTypeEnum; } });
|
|
41
|
+
Object.defineProperty(exports, "PlatformEnum", { enumerable: true, get: function () { return enums_1.PlatformEnum; } });
|
|
42
|
+
Object.defineProperty(exports, "$Enums", { enumerable: true, get: function () { return enums_1.$Enums; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { DeepNonNullable, DeepRequired } from '../types';
|
|
2
|
+
import { RemoveDBIds } from 'ts-prisma';
|
|
3
|
+
import { Guild } from '../other/prisma';
|
|
4
|
+
export declare const addonKeys: (keyof ListOfAdditionalAddons)[];
|
|
5
|
+
export type AdditionalNames = keyof ListOfAdditionalAddons;
|
|
6
|
+
export type AddDefault<T> = T extends string ? `default${T}` : never;
|
|
7
|
+
export type RemoveAdditional<T> = T extends `additional${infer R}` ? R : T;
|
|
8
|
+
export type AddonNames = RemoveAdditional<keyof ListOfAdditionalAddons> & string;
|
|
9
|
+
export type DefaultAddons = AddDefault<AddonNames>;
|
|
10
|
+
export declare const addonNames: AddonNames[];
|
|
11
|
+
export declare const defaultAddons: DefaultAddons[];
|
|
12
|
+
export type ListOfAdditionalAddons = RemoveDBIds<DeepNonNullable<Omit<NonNullable<DeepRequired<Guild>['premium']>, 'tier' | 'enabled'>>, 'dbId' | 'guildId'>;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.defaultAddons = exports.addonNames = exports.addonKeys = void 0;
|
|
4
|
+
exports.addonKeys = [
|
|
5
|
+
'additionalStickyMessages',
|
|
6
|
+
'additionalAutoLiveRoles',
|
|
7
|
+
'additionalLinkedRoles',
|
|
8
|
+
'additionalStatusRoles',
|
|
9
|
+
'additionalStarboards',
|
|
10
|
+
'additionalOverrides',
|
|
11
|
+
'additionalKickConnections',
|
|
12
|
+
'additionalRumbleConnections',
|
|
13
|
+
'additionalTwitchConnections',
|
|
14
|
+
'additionalYoutubeConnections',
|
|
15
|
+
'additionalTiktokConnections',
|
|
16
|
+
];
|
|
17
|
+
exports.addonNames = exports.addonKeys.map((k) => k.replace('additional', ''));
|
|
18
|
+
exports.defaultAddons = exports.addonNames.map((k) => `default${k}`);
|