@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.
Files changed (115) hide show
  1. package/cname.js +3 -0
  2. package/dist/classes/@me.d.ts +122 -0
  3. package/dist/classes/@me.js +59 -0
  4. package/dist/classes/admin.d.ts +71 -0
  5. package/dist/classes/admin.js +26 -0
  6. package/dist/classes/client.d.ts +156 -0
  7. package/dist/classes/client.js +116 -0
  8. package/dist/classes/emotes.d.ts +31 -0
  9. package/dist/classes/emotes.js +24 -0
  10. package/dist/classes/files.d.ts +36 -0
  11. package/dist/classes/files.js +36 -0
  12. package/dist/classes/guild.d.ts +187 -0
  13. package/dist/classes/guild.js +140 -0
  14. package/dist/classes/guildDrops.d.ts +58 -0
  15. package/dist/classes/guildDrops.js +32 -0
  16. package/dist/classes/guildGiveaway.d.ts +110 -0
  17. package/dist/classes/guildGiveaway.js +76 -0
  18. package/dist/classes/guildPlatform.d.ts +163 -0
  19. package/dist/classes/guildPlatform.js +99 -0
  20. package/dist/classes/guildPlatformAction.d.ts +67 -0
  21. package/dist/classes/guildPlatformAction.js +26 -0
  22. package/dist/classes/guildStarboard.d.ts +66 -0
  23. package/dist/classes/guildStarboard.js +36 -0
  24. package/dist/classes/linked.d.ts +26 -0
  25. package/dist/classes/linked.js +32 -0
  26. package/dist/classes/other.d.ts +83 -0
  27. package/dist/classes/other.js +53 -0
  28. package/dist/classes/platform.d.ts +227 -0
  29. package/dist/classes/platform.js +30 -0
  30. package/dist/classes/premium.d.ts +179 -0
  31. package/dist/classes/premium.js +76 -0
  32. package/dist/classes/sessions.d.ts +42 -0
  33. package/dist/classes/sessions.js +30 -0
  34. package/dist/classes/teams.d.ts +88 -0
  35. package/dist/classes/teams.js +66 -0
  36. package/dist/classes/telemetry.d.ts +32 -0
  37. package/dist/classes/telemetry.js +28 -0
  38. package/dist/classes/user.d.ts +40 -0
  39. package/dist/classes/user.js +30 -0
  40. package/dist/classes/vods.d.ts +55 -0
  41. package/dist/classes/vods.js +38 -0
  42. package/dist/core/manager.d.ts +57 -0
  43. package/dist/core/manager.js +78 -0
  44. package/dist/core/utils.d.ts +4 -0
  45. package/dist/core/utils.js +26 -0
  46. package/dist/index.d.ts +22 -0
  47. package/dist/index.js +42 -0
  48. package/dist/modules/stripe.d.ts +12 -0
  49. package/dist/modules/stripe.js +18 -0
  50. package/dist/other/bitfields.d.ts +283 -0
  51. package/dist/other/bitfields.js +323 -0
  52. package/dist/other/enums.d.ts +2 -0
  53. package/dist/other/enums.js +10 -0
  54. package/dist/other/prisma.d.ts +76 -0
  55. package/dist/other/prisma.js +9 -0
  56. package/dist/other/templates.d.ts +795 -0
  57. package/dist/other/templates.js +706 -0
  58. package/dist/other/types.d.ts +45 -0
  59. package/dist/other/types.js +17 -0
  60. package/dist/other/utils.d.ts +5 -0
  61. package/dist/other/utils.js +51 -0
  62. package/dist/other/zod/client.zod.d.ts +349 -0
  63. package/dist/other/zod/client.zod.js +63 -0
  64. package/dist/other/zod/drops.zod.d.ts +16 -0
  65. package/dist/other/zod/drops.zod.js +93 -0
  66. package/dist/other/zod/giveaways.zod.d.ts +382 -0
  67. package/dist/other/zod/giveaways.zod.js +72 -0
  68. package/dist/other/zod/guild.zod.d.ts +1638 -0
  69. package/dist/other/zod/guild.zod.js +139 -0
  70. package/dist/other/zod/kickStreamer.zod.d.ts +761 -0
  71. package/dist/other/zod/kickStreamer.zod.js +92 -0
  72. package/dist/other/zod/member.zod.d.ts +22 -0
  73. package/dist/other/zod/member.zod.js +15 -0
  74. package/dist/other/zod/r2Storage.zod.d.ts +56 -0
  75. package/dist/other/zod/r2Storage.zod.js +21 -0
  76. package/dist/other/zod/rumbleStreamer.zod.d.ts +530 -0
  77. package/dist/other/zod/rumbleStreamer.zod.js +45 -0
  78. package/dist/other/zod/schema.zod.d.ts +25 -0
  79. package/dist/other/zod/schema.zod.js +168 -0
  80. package/dist/other/zod/starboard.zod.d.ts +167 -0
  81. package/dist/other/zod/starboard.zod.js +46 -0
  82. package/dist/other/zod/team.zod.d.ts +107 -0
  83. package/dist/other/zod/team.zod.js +30 -0
  84. package/dist/other/zod/tiktokStreamer.zod.d.ts +473 -0
  85. package/dist/other/zod/tiktokStreamer.zod.js +46 -0
  86. package/dist/other/zod/twitchStreamer.zod.d.ts +473 -0
  87. package/dist/other/zod/twitchStreamer.zod.js +46 -0
  88. package/dist/other/zod/user.zod.d.ts +678 -0
  89. package/dist/other/zod/user.zod.js +124 -0
  90. package/dist/other/zod/youtubeStreamer.zod.d.ts +476 -0
  91. package/dist/other/zod/youtubeStreamer.zod.js +47 -0
  92. package/dist/other/zod/zod.d.ts +177 -0
  93. package/dist/other/zod/zod.js +60 -0
  94. package/dist/tsconfig.tsbuildinfo +1 -0
  95. package/dist/types.d.ts +37 -0
  96. package/dist/types.js +2 -0
  97. package/package.json +63 -0
  98. package/prisma/generated/index.ts +25 -0
  99. package/prisma/generated/ts-prisma.d.ts +91725 -0
  100. package/prisma/schema/models/client.prisma +89 -0
  101. package/prisma/schema/models/drops.prisma +167 -0
  102. package/prisma/schema/models/giveaways.prisma +82 -0
  103. package/prisma/schema/models/guild.prisma +368 -0
  104. package/prisma/schema/models/kickStreamer.prisma +202 -0
  105. package/prisma/schema/models/member.prisma +10 -0
  106. package/prisma/schema/models/r2Storage.prisma +22 -0
  107. package/prisma/schema/models/rumbleStreamer.prisma +121 -0
  108. package/prisma/schema/models/starboard.prisma +66 -0
  109. package/prisma/schema/models/team.prisma +38 -0
  110. package/prisma/schema/models/tiktokStreamer.prisma +121 -0
  111. package/prisma/schema/models/twitchStreamer.prisma +122 -0
  112. package/prisma/schema/models/user.prisma +212 -0
  113. package/prisma/schema/models/youtubeStreamer.prisma +123 -0
  114. package/prisma/schema/schema.prisma +182 -0
  115. package/prisma.config.ts +6 -0
@@ -0,0 +1,227 @@
1
+ import { WebDataManager } from '../core/manager';
2
+ import { CancelOutWebResponses } from '../types';
3
+ import { AllPlatforms } from '../other/prisma';
4
+ export declare class APIPlatform {
5
+ private web;
6
+ constructor(web: WebDataManager);
7
+ getActivePlatforms({ auth }: PlatformFunctionsInput['getActivePlatforms']): Promise<import("../types").WebResponse<string[]>>;
8
+ getPlatformWorkerStats<P extends AllPlatforms>({ auth, platform }: PlatformFunctionsInput<P>['getPlatformWorkerStats']): Promise<import("../types").WebResponse<PlatformStats>>;
9
+ getGuildsForStreamer<P extends AllPlatforms>({ auth, platform, username }: PlatformFunctionsInput<P>['getGuildsForStreamer']): Promise<import("../types").WebResponse<GuildsForStreamer>>;
10
+ }
11
+ export type PlatformFunctionsInput<P extends AllPlatforms = never> = {
12
+ 'getActivePlatforms': {
13
+ auth: string;
14
+ };
15
+ 'getPlatformWorkerStats': {
16
+ auth: string;
17
+ platform: P;
18
+ };
19
+ 'getGuildsForStreamer': {
20
+ auth: string;
21
+ platform: P;
22
+ username: string;
23
+ };
24
+ };
25
+ export type PlatformReturnTypes = {
26
+ 'getActivePlatformsRaw': Awaited<ReturnType<APIPlatform['getActivePlatforms']>>;
27
+ 'getActivePlatformsSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPlatform['getActivePlatforms']>>>;
28
+ 'getPlatformWorkerStatsRaw': Awaited<ReturnType<APIPlatform['getPlatformWorkerStats']>>;
29
+ 'getPlatformWorkerStatsSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPlatform['getPlatformWorkerStats']>>>;
30
+ 'getGuildsForStreamerRaw': Awaited<ReturnType<APIPlatform['getGuildsForStreamer']>>;
31
+ 'getGuildsForStreamerSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPlatform['getGuildsForStreamer']>>>;
32
+ };
33
+ export type PlatformStats = {
34
+ monitoredUsernames: string[];
35
+ status: 'online' | 'offline';
36
+ lastUpdated: number;
37
+ workerId: number;
38
+ }[];
39
+ export type GuildsForStreamer = {
40
+ streamerUsername: string;
41
+ guilds: string[];
42
+ };
43
+ export type PlatformUser<T extends AllPlatforms> = T extends 'kick' ? KickStreamerRaw : T extends 'twitch' ? TwitchStreamerRaw : T extends 'rumble' ? RumbleStreamerRaw : T extends 'tiktok' ? TikTokStreamerRaw : never;
44
+ export type KickStreamerRaw = {
45
+ id: number;
46
+ user_id: number;
47
+ slug: string;
48
+ is_banned: boolean;
49
+ playback_url: string;
50
+ vod_enabled: boolean;
51
+ subscription_enabled: boolean;
52
+ followers_count: number;
53
+ subscriber_badges: {
54
+ id: number;
55
+ channel_id: number;
56
+ months: number;
57
+ badge_image: {
58
+ srcset: string;
59
+ src: string;
60
+ };
61
+ }[];
62
+ banner_image?: {
63
+ url: string;
64
+ };
65
+ livestream?: {
66
+ id: number;
67
+ slug: string;
68
+ channel_id: number;
69
+ created_at: string;
70
+ session_title: string;
71
+ is_live: boolean;
72
+ risk_level_id: unknown;
73
+ source: unknown;
74
+ twitch_channel: unknown;
75
+ duration: number;
76
+ language: string;
77
+ is_mature: boolean;
78
+ viewer_count: number;
79
+ thumbnail?: {
80
+ url: string;
81
+ };
82
+ categories: {
83
+ id: number;
84
+ category_id: number;
85
+ name: string;
86
+ slug: string;
87
+ tags: string[];
88
+ description: unknown;
89
+ deleted_at: unknown;
90
+ viewers: number;
91
+ category: {
92
+ id: number;
93
+ name: string;
94
+ slug: string;
95
+ icon: string;
96
+ };
97
+ }[];
98
+ tags: unknown[];
99
+ } | null;
100
+ role: string;
101
+ muted: boolean;
102
+ follower_badges: unknown[];
103
+ offline_banner_image: string;
104
+ verified: boolean;
105
+ recent_categories: {
106
+ id: number;
107
+ category_id: number;
108
+ name: string;
109
+ slug: string;
110
+ tags: string[];
111
+ description: string;
112
+ deleted_at: unknown;
113
+ viewers: number;
114
+ banner: {
115
+ responsive: string;
116
+ url: string;
117
+ };
118
+ category: {
119
+ id: number;
120
+ name: string;
121
+ slug: string;
122
+ icon: string;
123
+ };
124
+ }[];
125
+ can_host: boolean;
126
+ user: {
127
+ id: number;
128
+ username: string;
129
+ agreed_to_terms: boolean;
130
+ email_verified_at: string;
131
+ bio: string;
132
+ country: string;
133
+ state: string;
134
+ city: string;
135
+ instagram: string;
136
+ twitter: string;
137
+ youtube: string;
138
+ discord: string;
139
+ tiktok: string;
140
+ facebook: string;
141
+ profile_pic: string;
142
+ };
143
+ chatroom: {
144
+ id: number;
145
+ chatable_type: string;
146
+ channel_id: number;
147
+ created_at: string;
148
+ updated_at: string;
149
+ chat_mode_old: string;
150
+ chat_mode: string;
151
+ slow_mode: boolean;
152
+ chatable_id: number;
153
+ followers_mode: boolean;
154
+ subscribers_mode: boolean;
155
+ emotes_mode: boolean;
156
+ message_interval: number;
157
+ following_min_duration: number;
158
+ };
159
+ };
160
+ export type TwitchStreamerRaw = {
161
+ id: string;
162
+ login: string;
163
+ display_name: string;
164
+ description: string;
165
+ type: 'staff' | 'admin' | 'global_mod' | '';
166
+ broadcaster_type: 'partner' | 'affiliate' | '';
167
+ profile_image_url: string;
168
+ offline_image_url: string;
169
+ view_count: number;
170
+ created_at: string;
171
+ };
172
+ export type RumbleStreamerRaw = {
173
+ name: string;
174
+ followers: number;
175
+ verified: boolean;
176
+ pfp: string | null;
177
+ isLive: boolean;
178
+ liveStream: {
179
+ title: string;
180
+ views: number;
181
+ } | null;
182
+ };
183
+ export type TikTokStreamerRaw = {
184
+ liveData?: {
185
+ coverUrl: string;
186
+ liveSubOnly: number;
187
+ startTime: number;
188
+ streamId: string;
189
+ title: string;
190
+ stats?: {
191
+ followerCount: number;
192
+ followingCount: number;
193
+ };
194
+ user?: {
195
+ avatarLarger: string;
196
+ avatarMedium: string;
197
+ avatarThumb: string;
198
+ id: string;
199
+ nickname: string;
200
+ roomId: string;
201
+ secUid: string;
202
+ secret: boolean;
203
+ signature: string;
204
+ uniqueId: string;
205
+ verified: boolean;
206
+ };
207
+ } | null;
208
+ userData: {
209
+ avatarLarger: string;
210
+ avatarMedium: string;
211
+ avatarThumb: string;
212
+ nickname: string;
213
+ openFavorite: boolean;
214
+ privateAccount: boolean;
215
+ secret: boolean;
216
+ signature: string;
217
+ uniqueId: string;
218
+ verified: boolean;
219
+ stats: {
220
+ followerCount: number;
221
+ followingCount: number;
222
+ friendCount: number;
223
+ heartCount: number;
224
+ videoCount: number;
225
+ };
226
+ };
227
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIPlatform = void 0;
4
+ // Data.
5
+ class APIPlatform {
6
+ web;
7
+ constructor(web) {
8
+ this.web = web;
9
+ }
10
+ // Methods.
11
+ async getActivePlatforms({ auth }) {
12
+ return await this.web.request({
13
+ method: 'GET', auth,
14
+ endpoint: this.web.qp('/data/platforms'),
15
+ });
16
+ }
17
+ async getPlatformWorkerStats({ auth, platform }) {
18
+ return await this.web.request({
19
+ method: 'GET', auth,
20
+ endpoint: this.web.qp('/data/platforms/' + platform),
21
+ });
22
+ }
23
+ async getGuildsForStreamer({ auth, platform, username }) {
24
+ return await this.web.request({
25
+ method: 'GET', auth,
26
+ endpoint: this.web.qp('/data/platforms/' + platform + '/' + username),
27
+ });
28
+ }
29
+ }
30
+ exports.APIPlatform = APIPlatform;
@@ -0,0 +1,179 @@
1
+ import { CancelOutWebResponses, DeepRequired } from '../types';
2
+ import { WebDataManager } from '../core/manager';
3
+ import { PremiumPlanType } from '../other/types';
4
+ import { Guild, User } from '../other/prisma';
5
+ export declare class APIPremium {
6
+ private web;
7
+ constructor(web: WebDataManager);
8
+ getPremumData<T extends 'guild' | 'user' = never>({ auth, type, id }: PremiumFunctionsInput<T>['getPremumData']): Promise<import("../types").WebResponse<PremiumData<T>>>;
9
+ changePremiumData<T extends 'guild' | 'user' = never>({ auth, type, id, body }: PremiumFunctionsInput<T>['changePremiumData']): Promise<import("../types").WebResponse<true>>;
10
+ getPremiumPlans({ refreshCache }: PremiumFunctionsInput['getPremiumPlans']): Promise<import("../types").WebResponse<PremiumPlans>>;
11
+ getPremiumPlan<T extends boolean>({ planId, includeFreeAmountOfAddons }: PremiumFunctionsInput<never, T>['getPremiumPlan']): Promise<import("../types").WebResponse<PremiumPlan<T>>>;
12
+ createCheckoutSession<T extends 'guild' | 'user'>({ auth, body, type }: PremiumFunctionsInput<T>['createCheckoutSession']): Promise<import("../types").WebResponse<string>>;
13
+ getAllUserSubscriptions({ auth }: PremiumFunctionsInput<never>['getAllUserSubscriptions']): Promise<import("../types").WebResponse<AllSubscriptions>>;
14
+ changePaymentMethods({ auth }: PremiumFunctionsInput<never>['changePaymentMethods']): Promise<import("../types").WebResponse<string>>;
15
+ changeSubscriptionTier({ auth, body }: PremiumFunctionsInput<never>['changeSubscriptionTier']): Promise<import("../types").WebResponse<string>>;
16
+ changeSubscriptionAddons({ auth, body }: PremiumFunctionsInput<never>['changeSubscriptionAddons']): Promise<import("../types").WebResponse<string>>;
17
+ cancelSubscription({ auth, subscriptionId }: PremiumFunctionsInput<never>['cancelSubscription']): Promise<import("../types").WebResponse<string>>;
18
+ }
19
+ export type PremiumFunctionsInput<T extends 'guild' | 'user' = never, I extends boolean = never> = {
20
+ 'getPremumData': {
21
+ auth: string;
22
+ type: T;
23
+ id: string;
24
+ };
25
+ 'changePremiumData': {
26
+ auth: string;
27
+ type: T;
28
+ id: string;
29
+ body: UpdatePremiumData<T>;
30
+ };
31
+ 'getPremiumPlans': {
32
+ refreshCache?: boolean;
33
+ };
34
+ 'getPremiumPlan': {
35
+ planId: string;
36
+ includeFreeAmountOfAddons?: I;
37
+ };
38
+ 'createCheckoutSession': {
39
+ auth: string;
40
+ body: CreateCheckoutSessionBody<T>;
41
+ type: T;
42
+ };
43
+ 'getAllUserSubscriptions': {
44
+ auth: string;
45
+ };
46
+ 'changePaymentMethods': {
47
+ auth: string;
48
+ };
49
+ 'changeSubscriptionTier': {
50
+ auth: string;
51
+ body: ChangeSubscriptionTierBody;
52
+ };
53
+ 'changeSubscriptionAddons': {
54
+ auth: string;
55
+ body: ChangeSubscriptionAddonsBody;
56
+ };
57
+ 'cancelSubscription': {
58
+ auth: string;
59
+ subscriptionId: string;
60
+ };
61
+ };
62
+ export type PremiumReturnTypes = {
63
+ 'getPremumDataRaw': Awaited<ReturnType<APIPremium['getPremumData']>>;
64
+ 'getPremumDataSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['getPremumData']>>>;
65
+ 'changePremiumDataRaw': Awaited<ReturnType<APIPremium['changePremiumData']>>;
66
+ 'changePremiumDataSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['changePremiumData']>>>;
67
+ 'getPremiumPlansRaw': Awaited<ReturnType<APIPremium['getPremiumPlans']>>;
68
+ 'getPremiumPlansSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['getPremiumPlans']>>>;
69
+ 'getPremiumPlanRaw': Awaited<ReturnType<APIPremium['getPremiumPlan']>>;
70
+ 'getPremiumPlanSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['getPremiumPlan']>>>;
71
+ 'createCheckoutSessionRaw': Awaited<ReturnType<APIPremium['createCheckoutSession']>>;
72
+ 'createCheckoutSessionSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['createCheckoutSession']>>>;
73
+ 'getAllUserSubscriptionsRaw': Awaited<ReturnType<APIPremium['getAllUserSubscriptions']>>;
74
+ 'getAllUserSubscriptionsSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['getAllUserSubscriptions']>>>;
75
+ 'changePaymentMethodsRaw': Awaited<ReturnType<APIPremium['changePaymentMethods']>>;
76
+ 'changePaymentMethodsSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['changePaymentMethods']>>>;
77
+ 'changeSubscriptionTierRaw': Awaited<ReturnType<APIPremium['changeSubscriptionTier']>>;
78
+ 'changeSubscriptionTierSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['changeSubscriptionTier']>>>;
79
+ 'changeSubscriptionAddonsRaw': Awaited<ReturnType<APIPremium['changeSubscriptionAddons']>>;
80
+ 'changeSubscriptionAddonsSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['changeSubscriptionAddons']>>>;
81
+ 'cancelSubscriptionRaw': Awaited<ReturnType<APIPremium['cancelSubscription']>>;
82
+ 'cancelSubscriptionSuccess': CancelOutWebResponses<Awaited<ReturnType<APIPremium['cancelSubscription']>>>;
83
+ };
84
+ export type CreateCheckoutSessionBody<T extends 'guild' | 'user'> = T extends 'guild' ? {
85
+ email: string;
86
+ userId: string;
87
+ annual?: boolean;
88
+ guildId: string;
89
+ subscriptionTierId: string;
90
+ affiliate?: string;
91
+ trialDays?: number;
92
+ } & ListOfDefaultItems : T extends 'user' ? {
93
+ email: string;
94
+ userId: string;
95
+ annual?: boolean;
96
+ subscriptionTierId: string;
97
+ affiliate?: string;
98
+ trialDays?: number;
99
+ } : never;
100
+ export type OneTimePaymentUrlBody = {
101
+ cents: number;
102
+ metadata: Record<string, string>;
103
+ } & UserData;
104
+ export type PremiumPlans = {
105
+ tiers: PremiumPlanType[];
106
+ addons: {
107
+ type: 'guild' | 'user';
108
+ name: string;
109
+ addonId: string;
110
+ priceCents: number;
111
+ isActive: boolean;
112
+ }[];
113
+ };
114
+ export type PortalData = {
115
+ intention?: 'subscription_cancel' | 'payment_method_update';
116
+ } & UserData;
117
+ export type UserData = {
118
+ email: string;
119
+ userId: string;
120
+ } | {
121
+ customerId: string;
122
+ };
123
+ export type PremiumPlan<T extends boolean> = T extends true ? PremiumPlanType & {
124
+ freeTierInfo: SliceAdditionalFromItem;
125
+ } : PremiumPlanType;
126
+ export type UpdatePremiumData<T extends 'guild' | 'user'> = T extends 'guild' ? {
127
+ newPlanId?: string;
128
+ newBitfield?: string;
129
+ overrideBranding?: boolean;
130
+ } & ListOfDefaultItems : T extends 'user' ? {
131
+ newPlanId: string;
132
+ } : never;
133
+ export type ListOfDefaultItems = Partial<Omit<NonNullable<DeepRequired<Guild>['premium']>, 'tier' | 'enabled' | 'dbId' | 'guildId'>>;
134
+ export type RemoveAdditional<T> = T extends `additional${infer Rest}` ? Rest : T;
135
+ export type JoinWithDefault<T> = T extends string ? `default${T}` : never;
136
+ export type SliceAdditionalFromItem = {
137
+ [K in keyof ListOfDefaultItems as K extends string ? JoinWithDefault<RemoveAdditional<K>> : never]: ListOfDefaultItems[K];
138
+ };
139
+ export type PremiumData<T extends 'guild' | 'user'> = T extends 'guild' ? {
140
+ bitfield: Guild['bitfield'];
141
+ premium: Guild['premium'];
142
+ overrideBranding: Guild['overrideBranding'];
143
+ freeTierInfo: SliceAdditionalFromItem;
144
+ } : T extends 'user' ? {
145
+ badges: User['badges'];
146
+ bitfield: User['bitfield'];
147
+ premium: User['premium'];
148
+ oneServerPremium: User['oneServerPremium'];
149
+ serverPremiumCooldown: User['serverPremiumCooldown'];
150
+ } : never;
151
+ export type PremiumSubscription = {
152
+ id: string;
153
+ title: string | null;
154
+ isAnnual: boolean;
155
+ tierId: string | undefined;
156
+ status: 'active' | 'canceled' | 'incomplete' | 'incomplete_expired' | 'past_due' | 'paused' | 'trialing' | 'unpaid';
157
+ endedAt: Date | null;
158
+ periodEnd: Date;
159
+ canceledAt: Date | null;
160
+ trialEndsAt: Date | null;
161
+ priceCents: number;
162
+ };
163
+ export type AllSubscriptions = {
164
+ user: PremiumSubscription | null;
165
+ guilds: (PremiumSubscription & {
166
+ guildId: string;
167
+ })[];
168
+ };
169
+ export type ChangeSubscriptionTierBody = {
170
+ subscriptionId: string;
171
+ newTierId: string;
172
+ };
173
+ export type ChangeSubscriptionAddonsBody = {
174
+ subscriptionId: string;
175
+ newAddons: {
176
+ addonId: string;
177
+ quantity: number;
178
+ }[];
179
+ };
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APIPremium = void 0;
4
+ // Data.
5
+ class APIPremium {
6
+ web;
7
+ constructor(web) {
8
+ this.web = web;
9
+ }
10
+ // Methods.
11
+ async getPremumData({ auth, type, id }) {
12
+ return await this.web.request({
13
+ method: 'GET', auth,
14
+ endpoint: this.web.qp('/premium/manage/' + type + '/' + id),
15
+ });
16
+ }
17
+ async changePremiumData({ auth, type, id, body }) {
18
+ return await this.web.request({
19
+ method: 'PATCH', auth, body,
20
+ endpoint: this.web.qp('/premium/manage/' + type + '/' + id),
21
+ });
22
+ }
23
+ async getPremiumPlans({ refreshCache }) {
24
+ return await this.web.request({
25
+ method: 'GET',
26
+ endpoint: this.web.qp('/premium/plans', {
27
+ all: refreshCache || false,
28
+ }),
29
+ });
30
+ }
31
+ async getPremiumPlan({ planId, includeFreeAmountOfAddons }) {
32
+ return await this.web.request({
33
+ method: 'GET',
34
+ endpoint: this.web.qp('/premium/plans/' + planId, {
35
+ ifcd: includeFreeAmountOfAddons || false,
36
+ }),
37
+ });
38
+ }
39
+ async createCheckoutSession({ auth, body, type }) {
40
+ return await this.web.request({
41
+ method: 'POST', auth, body,
42
+ endpoint: this.web.qp('/stripe/sessions/' + type),
43
+ });
44
+ }
45
+ async getAllUserSubscriptions({ auth }) {
46
+ return await this.web.request({
47
+ method: 'GET', auth,
48
+ endpoint: this.web.qp('/stripe/subscriptions'),
49
+ });
50
+ }
51
+ async changePaymentMethods({ auth }) {
52
+ return await this.web.request({
53
+ method: 'GET', auth,
54
+ endpoint: this.web.qp('/stripe/payments'),
55
+ });
56
+ }
57
+ async changeSubscriptionTier({ auth, body }) {
58
+ return await this.web.request({
59
+ method: 'PATCH', auth, body,
60
+ endpoint: this.web.qp('/stripe/subscriptions/tier'),
61
+ });
62
+ }
63
+ async changeSubscriptionAddons({ auth, body }) {
64
+ return await this.web.request({
65
+ method: 'PATCH', auth, body,
66
+ endpoint: this.web.qp('/stripe/subscriptions/addons'),
67
+ });
68
+ }
69
+ async cancelSubscription({ auth, subscriptionId }) {
70
+ return await this.web.request({
71
+ method: 'DELETE', auth,
72
+ endpoint: this.web.qp('/stripe/subscriptions/' + subscriptionId),
73
+ });
74
+ }
75
+ }
76
+ exports.APIPremium = APIPremium;
@@ -0,0 +1,42 @@
1
+ import { CancelOutWebResponses } from '../types';
2
+ import { WebDataManager } from '../core/manager';
3
+ import { CurrentUser } from './@me';
4
+ export declare class APISessions {
5
+ private web;
6
+ constructor(web: WebDataManager);
7
+ checkSession({ auth }: SessionsFunctionsInput['checkSession']): Promise<import("../types").WebResponse<boolean>>;
8
+ postSession({ code, auth, addToServer }: SessionsFunctionsInput['postSession']): Promise<import("../types").WebResponse<SessionPostReturnType>>;
9
+ deleteSession({ auth }: SessionsFunctionsInput['deleteSession']): Promise<import("../types").WebResponse<true>>;
10
+ }
11
+ export type SessionsFunctionsInput = {
12
+ 'checkSession': {
13
+ auth: string;
14
+ };
15
+ 'postSession': {
16
+ code: string;
17
+ auth: string;
18
+ addToServer?: boolean;
19
+ };
20
+ 'deleteSession': {
21
+ auth: string;
22
+ };
23
+ };
24
+ export type SessionsReturnTypes = {
25
+ 'checkSessionRaw': Awaited<ReturnType<APISessions['checkSession']>>;
26
+ 'checkSessionSuccess': CancelOutWebResponses<Awaited<ReturnType<APISessions['checkSession']>>>;
27
+ 'postSessionRaw': Awaited<ReturnType<APISessions['postSession']>>;
28
+ 'postSessionSuccess': CancelOutWebResponses<Awaited<ReturnType<APISessions['postSession']>>>;
29
+ 'deleteSessionRaw': Awaited<ReturnType<APISessions['deleteSession']>>;
30
+ 'deleteSessionSuccess': CancelOutWebResponses<Awaited<ReturnType<APISessions['deleteSession']>>>;
31
+ };
32
+ export type SessionPostReturnType = {
33
+ customToken: string;
34
+ guilds: {
35
+ icon: string | null;
36
+ banner: string | null;
37
+ isBotIn: boolean;
38
+ id: string;
39
+ name: string;
40
+ }[];
41
+ user: CurrentUser;
42
+ };
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.APISessions = void 0;
4
+ // Data.
5
+ class APISessions {
6
+ web;
7
+ constructor(web) {
8
+ this.web = web;
9
+ }
10
+ // Methods.
11
+ async checkSession({ auth }) {
12
+ return await this.web.request({
13
+ method: 'GET', auth,
14
+ endpoint: this.web.qp('/sessions'),
15
+ });
16
+ }
17
+ async postSession({ code, auth, addToServer }) {
18
+ return await this.web.request({
19
+ method: 'POST', auth,
20
+ endpoint: this.web.qp('/sessions', {
21
+ code,
22
+ add: addToServer || true,
23
+ }),
24
+ });
25
+ }
26
+ async deleteSession({ auth }) {
27
+ return await this.web.request({ method: 'DELETE', endpoint: this.web.qp('/sessions'), auth });
28
+ }
29
+ }
30
+ exports.APISessions = APISessions;
@@ -0,0 +1,88 @@
1
+ import { WebDataManager } from '../core/manager';
2
+ import { CancelOutWebResponses } from '../types';
3
+ import { Team } from '../other/prisma';
4
+ export declare class APITeams {
5
+ private web;
6
+ constructor(web: WebDataManager);
7
+ getAllUserTeams({ auth }: TeamsFunctionsInput['getAllUserTeams']): Promise<import("../types").WebResponse<TeamsGetType>>;
8
+ createTeam({ auth, teamName }: TeamsFunctionsInput['createTeam']): Promise<import("../types").WebResponse<string>>;
9
+ joinOrLeaveTeam({ auth, teamOrCode, action }: TeamsFunctionsInput['joinOrLeaveTeam']): Promise<import("../types").WebResponse<string>>;
10
+ createTeamInvite({ auth, teamId, maxUses, bitfieldToSet, expiresAt }: TeamsFunctionsInput['createTeamInvite']): Promise<import("../types").WebResponse<string>>;
11
+ kickTeamMember({ auth, teamId, userId }: TeamsFunctionsInput['kickTeamMember']): Promise<import("../types").WebResponse<string>>;
12
+ updateMemberPermissions({ auth, teamId, userId, bitfieldToSet }: TeamsFunctionsInput['updateMemberPermissions']): Promise<import("../types").WebResponse<string>>;
13
+ updateTeamName({ auth, teamId, teamName }: TeamsFunctionsInput['updateTeamName']): Promise<import("../types").WebResponse<string>>;
14
+ deleteTeam({ auth, teamId }: TeamsFunctionsInput['updateTeamName']): Promise<import("../types").WebResponse<string>>;
15
+ }
16
+ export type TeamsFunctionsInput = {
17
+ 'getAllUserTeams': {
18
+ auth: string;
19
+ };
20
+ 'createTeam': {
21
+ auth: string;
22
+ teamName: string;
23
+ };
24
+ 'joinOrLeaveTeam': {
25
+ auth: string;
26
+ teamOrCode: string;
27
+ action: 'join' | 'leave';
28
+ };
29
+ 'createTeamInvite': {
30
+ auth: string;
31
+ teamId: string;
32
+ maxUses: number;
33
+ bitfieldToSet: string;
34
+ expiresAt: number;
35
+ };
36
+ 'kickTeamMember': {
37
+ auth: string;
38
+ teamId: string;
39
+ userId: string;
40
+ };
41
+ 'updateMemberPermissions': {
42
+ auth: string;
43
+ teamId: string;
44
+ userId: string;
45
+ bitfieldToSet: string;
46
+ };
47
+ 'updateTeamName': {
48
+ auth: string;
49
+ teamId: string;
50
+ teamName: string;
51
+ };
52
+ 'deleteTeam': {
53
+ auth: string;
54
+ teamId: string;
55
+ };
56
+ };
57
+ export type TeamsGetReturnTypes = {
58
+ 'getAllUserTeamsRaw': Awaited<ReturnType<APITeams['getAllUserTeams']>>;
59
+ 'getAllUserTeamsSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['getAllUserTeams']>>>;
60
+ 'createTeamRaw': Awaited<ReturnType<APITeams['createTeam']>>;
61
+ 'createTeamSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['createTeam']>>>;
62
+ 'joinOrLeaveTeamRaw': Awaited<ReturnType<APITeams['joinOrLeaveTeam']>>;
63
+ 'joinOrLeaveTeamSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['joinOrLeaveTeam']>>>;
64
+ 'createTeamInviteRaw': Awaited<ReturnType<APITeams['createTeamInvite']>>;
65
+ 'createTeamInviteSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['createTeamInvite']>>>;
66
+ 'kickTeamMemberRaw': Awaited<ReturnType<APITeams['kickTeamMember']>>;
67
+ 'kickTeamMemberSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['kickTeamMember']>>>;
68
+ 'updateMemberPermissionsRaw': Awaited<ReturnType<APITeams['updateMemberPermissions']>>;
69
+ 'updateMemberPermissionsSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['updateMemberPermissions']>>>;
70
+ 'updateTeamNameRaw': Awaited<ReturnType<APITeams['updateTeamName']>>;
71
+ 'updateTeamNameSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['updateTeamName']>>>;
72
+ 'deleteTeamRaw': Awaited<ReturnType<APITeams['deleteTeam']>>;
73
+ 'deleteTeamSuccess': CancelOutWebResponses<Awaited<ReturnType<APITeams['deleteTeam']>>>;
74
+ };
75
+ export type TeamsGetType = {
76
+ managedTeam: Team & {
77
+ teamMembers: (Team['teamMembers'][number] & {
78
+ username: string | null;
79
+ kickUsername: string | null;
80
+ })[];
81
+ };
82
+ memberTeams: {
83
+ teamId: string;
84
+ teamName: string;
85
+ teamMembers: number;
86
+ teamLeaderName: string | null;
87
+ }[];
88
+ };