@whop/sdk 0.0.34 → 0.0.35

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 (85) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/client.d.mts +8 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +8 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +6 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +6 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/affiliates/affiliates.d.mts +345 -0
  12. package/resources/affiliates/affiliates.d.mts.map +1 -0
  13. package/resources/affiliates/affiliates.d.ts +345 -0
  14. package/resources/affiliates/affiliates.d.ts.map +1 -0
  15. package/resources/affiliates/affiliates.js +112 -0
  16. package/resources/affiliates/affiliates.js.map +1 -0
  17. package/resources/affiliates/affiliates.mjs +107 -0
  18. package/resources/affiliates/affiliates.mjs.map +1 -0
  19. package/resources/affiliates/index.d.mts +3 -0
  20. package/resources/affiliates/index.d.mts.map +1 -0
  21. package/resources/affiliates/index.d.ts +3 -0
  22. package/resources/affiliates/index.d.ts.map +1 -0
  23. package/resources/affiliates/index.js +9 -0
  24. package/resources/affiliates/index.js.map +1 -0
  25. package/resources/affiliates/index.mjs +4 -0
  26. package/resources/affiliates/index.mjs.map +1 -0
  27. package/resources/affiliates/overrides.d.mts +443 -0
  28. package/resources/affiliates/overrides.d.mts.map +1 -0
  29. package/resources/affiliates/overrides.d.ts +443 -0
  30. package/resources/affiliates/overrides.d.ts.map +1 -0
  31. package/resources/affiliates/overrides.js +117 -0
  32. package/resources/affiliates/overrides.js.map +1 -0
  33. package/resources/affiliates/overrides.mjs +113 -0
  34. package/resources/affiliates/overrides.mjs.map +1 -0
  35. package/resources/affiliates.d.mts +2 -0
  36. package/resources/affiliates.d.mts.map +1 -0
  37. package/resources/affiliates.d.ts +2 -0
  38. package/resources/affiliates.d.ts.map +1 -0
  39. package/resources/affiliates.js +6 -0
  40. package/resources/affiliates.js.map +1 -0
  41. package/resources/affiliates.mjs +3 -0
  42. package/resources/affiliates.mjs.map +1 -0
  43. package/resources/ai-chats.d.mts +21 -2
  44. package/resources/ai-chats.d.mts.map +1 -1
  45. package/resources/ai-chats.d.ts +21 -2
  46. package/resources/ai-chats.d.ts.map +1 -1
  47. package/resources/ai-chats.js +2 -1
  48. package/resources/ai-chats.js.map +1 -1
  49. package/resources/ai-chats.mjs +2 -1
  50. package/resources/ai-chats.mjs.map +1 -1
  51. package/resources/index.d.mts +2 -1
  52. package/resources/index.d.mts.map +1 -1
  53. package/resources/index.d.ts +2 -1
  54. package/resources/index.d.ts.map +1 -1
  55. package/resources/index.js +4 -2
  56. package/resources/index.js.map +1 -1
  57. package/resources/index.mjs +1 -0
  58. package/resources/index.mjs.map +1 -1
  59. package/resources/payments.d.mts +1 -1
  60. package/resources/payments.d.mts.map +1 -1
  61. package/resources/payments.d.ts +1 -1
  62. package/resources/payments.d.ts.map +1 -1
  63. package/resources/setup-intents.d.mts +74 -0
  64. package/resources/setup-intents.d.mts.map +1 -1
  65. package/resources/setup-intents.d.ts +74 -0
  66. package/resources/setup-intents.d.ts.map +1 -1
  67. package/resources/shared.d.mts +1 -1
  68. package/resources/shared.d.mts.map +1 -1
  69. package/resources/shared.d.ts +1 -1
  70. package/resources/shared.d.ts.map +1 -1
  71. package/src/client.ts +30 -0
  72. package/src/resources/affiliates/affiliates.ts +467 -0
  73. package/src/resources/affiliates/index.ts +32 -0
  74. package/src/resources/affiliates/overrides.ts +585 -0
  75. package/src/resources/affiliates.ts +3 -0
  76. package/src/resources/ai-chats.ts +25 -1
  77. package/src/resources/index.ts +12 -0
  78. package/src/resources/payments.ts +1 -0
  79. package/src/resources/setup-intents.ts +90 -0
  80. package/src/resources/shared.ts +1 -0
  81. package/src/version.ts +1 -1
  82. package/version.d.mts +1 -1
  83. package/version.d.ts +1 -1
  84. package/version.js +1 -1
  85. package/version.mjs +1 -1
@@ -0,0 +1,345 @@
1
+ import { APIResource } from "../../core/resource.js";
2
+ import * as Shared from "../shared.js";
3
+ import * as OverridesAPI from "./overrides.js";
4
+ import { AffiliateAppliesToPayments, AffiliateAppliesToProducts, AffiliateOverrideRoles, AffiliatePayoutTypes, AffiliateRevenueBases, OverrideCreateParams, OverrideCreateResponse, OverrideDeleteParams, OverrideDeleteResponse, OverrideListParams, OverrideListResponse, OverrideListResponsesCursorPage, OverrideRetrieveParams, OverrideRetrieveResponse, OverrideUpdateParams, OverrideUpdateResponse, Overrides } from "./overrides.js";
5
+ import { APIPromise } from "../../core/api-promise.js";
6
+ import { CursorPage, type CursorPageParams, PagePromise } from "../../core/pagination.js";
7
+ import { RequestOptions } from "../../internal/request-options.js";
8
+ /**
9
+ * Affiliates
10
+ */
11
+ export declare class Affiliates extends APIResource {
12
+ overrides: OverridesAPI.Overrides;
13
+ /**
14
+ * Creates or finds an affiliate for a company and user.
15
+ *
16
+ * Required permissions:
17
+ *
18
+ * - `affiliate:create`
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const affiliate = await client.affiliates.create({
23
+ * company_id: 'biz_xxxxxxxxxxxxxx',
24
+ * user_identifier: 'user_identifier',
25
+ * });
26
+ * ```
27
+ */
28
+ create(body: AffiliateCreateParams, options?: RequestOptions): APIPromise<Affiliate>;
29
+ /**
30
+ * Retrieves the details of an existing affiliate.
31
+ *
32
+ * Required permissions:
33
+ *
34
+ * - `affiliate:basic:read`
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const affiliate = await client.affiliates.retrieve(
39
+ * 'aff_xxxxxxxxxxxxxx',
40
+ * );
41
+ * ```
42
+ */
43
+ retrieve(id: string, options?: RequestOptions): APIPromise<Affiliate>;
44
+ /**
45
+ * Returns a paginated list of affiliates for the actor in context, with optional
46
+ * filtering by status, search, and sorting.
47
+ *
48
+ * Required permissions:
49
+ *
50
+ * - `affiliate:basic:read`
51
+ *
52
+ * @example
53
+ * ```ts
54
+ * // Automatically fetches more pages as needed.
55
+ * for await (const affiliateListResponse of client.affiliates.list(
56
+ * { company_id: 'biz_xxxxxxxxxxxxxx' },
57
+ * )) {
58
+ * // ...
59
+ * }
60
+ * ```
61
+ */
62
+ list(query: AffiliateListParams, options?: RequestOptions): PagePromise<AffiliateListResponsesCursorPage, AffiliateListResponse>;
63
+ /**
64
+ * Archives an existing Affiliate
65
+ *
66
+ * Required permissions:
67
+ *
68
+ * - `affiliate:update`
69
+ *
70
+ * @example
71
+ * ```ts
72
+ * const response = await client.affiliates.archive(
73
+ * 'aff_xxxxxxxxxxxxxx',
74
+ * );
75
+ * ```
76
+ */
77
+ archive(id: string, options?: RequestOptions): APIPromise<AffiliateArchiveResponse>;
78
+ /**
79
+ * Unarchives an existing Affiliate
80
+ *
81
+ * Required permissions:
82
+ *
83
+ * - `affiliate:update`
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const response = await client.affiliates.unarchive(
88
+ * 'aff_xxxxxxxxxxxxxx',
89
+ * );
90
+ * ```
91
+ */
92
+ unarchive(id: string, options?: RequestOptions): APIPromise<AffiliateUnarchiveResponse>;
93
+ }
94
+ export type AffiliateListResponsesCursorPage = CursorPage<AffiliateListResponse>;
95
+ /**
96
+ * An affiliate of a company or a global affiliate
97
+ */
98
+ export interface Affiliate {
99
+ /**
100
+ * The unique identifier for the affiliate.
101
+ */
102
+ id: string;
103
+ /**
104
+ * The total active members of the affiliate
105
+ */
106
+ active_members_count: number;
107
+ /**
108
+ * The company attached to this affiliate
109
+ */
110
+ company: Affiliate.Company;
111
+ /**
112
+ * The datetime the affiliate was created.
113
+ */
114
+ created_at: string;
115
+ /**
116
+ * How many referrals have remained since they joined as members
117
+ */
118
+ customer_retention_rate: string;
119
+ /**
120
+ * A rolling 90-day retention rate for this affiliate
121
+ */
122
+ customer_retention_rate_ninety_days: string;
123
+ /**
124
+ * The total MRR of the affiliate
125
+ */
126
+ monthly_recurring_revenue_usd: string;
127
+ /**
128
+ * Statuses for resources
129
+ */
130
+ status: Status | null;
131
+ /**
132
+ * The total count of all overrides for this affiliate
133
+ */
134
+ total_overrides_count: number;
135
+ /**
136
+ * The total earnings of the affiliate from the users they referred
137
+ */
138
+ total_referral_earnings_usd: string;
139
+ /**
140
+ * The total referrals of the affiliate
141
+ */
142
+ total_referrals_count: number;
143
+ /**
144
+ * The total revenue of the affiliate from their referrals
145
+ */
146
+ total_revenue_usd: string;
147
+ /**
148
+ * The datetime the affiliate was last updated.
149
+ */
150
+ updated_at: string;
151
+ /**
152
+ * The user attached to this affiliate
153
+ */
154
+ user: Affiliate.User;
155
+ }
156
+ export declare namespace Affiliate {
157
+ /**
158
+ * The company attached to this affiliate
159
+ */
160
+ interface Company {
161
+ /**
162
+ * The unique identifier for the company.
163
+ */
164
+ id: string;
165
+ /**
166
+ * The written name of the company.
167
+ */
168
+ title: string;
169
+ }
170
+ /**
171
+ * The user attached to this affiliate
172
+ */
173
+ interface User {
174
+ /**
175
+ * The unique identifier for the user.
176
+ */
177
+ id: string;
178
+ /**
179
+ * The display name set on the user's Whop profile. Null if the user has not set a
180
+ * name.
181
+ */
182
+ name: string | null;
183
+ /**
184
+ * The unique username chosen by the user for their Whop profile. Null if the user
185
+ * has not set a username.
186
+ */
187
+ username: string | null;
188
+ }
189
+ }
190
+ /**
191
+ * Statuses for resources
192
+ */
193
+ export type Status = 'active' | 'archived' | 'deleted';
194
+ /**
195
+ * An affiliate of a company or a global affiliate
196
+ */
197
+ export interface AffiliateListResponse {
198
+ /**
199
+ * The unique identifier for the affiliate.
200
+ */
201
+ id: string;
202
+ /**
203
+ * The total active members of the affiliate
204
+ */
205
+ active_members_count: number;
206
+ /**
207
+ * The company attached to this affiliate
208
+ */
209
+ company: AffiliateListResponse.Company;
210
+ /**
211
+ * The datetime the affiliate was created.
212
+ */
213
+ created_at: string;
214
+ /**
215
+ * How many referrals have remained since they joined as members
216
+ */
217
+ customer_retention_rate: string;
218
+ /**
219
+ * A rolling 90-day retention rate for this affiliate
220
+ */
221
+ customer_retention_rate_ninety_days: string;
222
+ /**
223
+ * The total MRR of the affiliate
224
+ */
225
+ monthly_recurring_revenue_usd: string;
226
+ /**
227
+ * Statuses for resources
228
+ */
229
+ status: Status | null;
230
+ /**
231
+ * The total count of all overrides for this affiliate
232
+ */
233
+ total_overrides_count: number;
234
+ /**
235
+ * The total earnings of the affiliate from the users they referred
236
+ */
237
+ total_referral_earnings_usd: string;
238
+ /**
239
+ * The total referrals of the affiliate
240
+ */
241
+ total_referrals_count: number;
242
+ /**
243
+ * The total revenue of the affiliate from their referrals
244
+ */
245
+ total_revenue_usd: string;
246
+ /**
247
+ * The datetime the affiliate was last updated.
248
+ */
249
+ updated_at: string;
250
+ /**
251
+ * The user attached to this affiliate
252
+ */
253
+ user: AffiliateListResponse.User;
254
+ }
255
+ export declare namespace AffiliateListResponse {
256
+ /**
257
+ * The company attached to this affiliate
258
+ */
259
+ interface Company {
260
+ /**
261
+ * The unique identifier for the company.
262
+ */
263
+ id: string;
264
+ /**
265
+ * The written name of the company.
266
+ */
267
+ title: string;
268
+ }
269
+ /**
270
+ * The user attached to this affiliate
271
+ */
272
+ interface User {
273
+ /**
274
+ * The unique identifier for the user.
275
+ */
276
+ id: string;
277
+ /**
278
+ * The display name set on the user's Whop profile. Null if the user has not set a
279
+ * name.
280
+ */
281
+ name: string | null;
282
+ /**
283
+ * The unique username chosen by the user for their Whop profile. Null if the user
284
+ * has not set a username.
285
+ */
286
+ username: string | null;
287
+ }
288
+ }
289
+ /**
290
+ * Represents `true` or `false` values.
291
+ */
292
+ export type AffiliateArchiveResponse = boolean;
293
+ /**
294
+ * Represents `true` or `false` values.
295
+ */
296
+ export type AffiliateUnarchiveResponse = boolean;
297
+ export interface AffiliateCreateParams {
298
+ /**
299
+ * The ID of the company to create the affiliate for.
300
+ */
301
+ company_id: string;
302
+ /**
303
+ * The user identifier (username, email, user ID, or Discord ID).
304
+ */
305
+ user_identifier: string;
306
+ }
307
+ export interface AffiliateListParams extends CursorPageParams {
308
+ /**
309
+ * The unique identifier of the company to list affiliates for.
310
+ */
311
+ company_id: string;
312
+ /**
313
+ * Returns the elements in the list that come before the specified cursor.
314
+ */
315
+ before?: string | null;
316
+ /**
317
+ * The direction of the sort.
318
+ */
319
+ direction?: Shared.Direction | null;
320
+ /**
321
+ * Returns the first _n_ elements from the list.
322
+ */
323
+ first?: number | null;
324
+ /**
325
+ * Returns the last _n_ elements from the list.
326
+ */
327
+ last?: number | null;
328
+ /**
329
+ * Which columns can be used to sort.
330
+ */
331
+ order?: 'id' | 'created_at' | 'cached_total_referrals' | 'cached_total_rewards' | null;
332
+ /**
333
+ * Search affiliates by username.
334
+ */
335
+ query?: string | null;
336
+ /**
337
+ * Statuses for resources
338
+ */
339
+ status?: Status | null;
340
+ }
341
+ export declare namespace Affiliates {
342
+ export { type Affiliate as Affiliate, type Status as Status, type AffiliateListResponse as AffiliateListResponse, type AffiliateArchiveResponse as AffiliateArchiveResponse, type AffiliateUnarchiveResponse as AffiliateUnarchiveResponse, type AffiliateListResponsesCursorPage as AffiliateListResponsesCursorPage, type AffiliateCreateParams as AffiliateCreateParams, type AffiliateListParams as AffiliateListParams, };
343
+ export { Overrides as Overrides, type AffiliateAppliesToPayments as AffiliateAppliesToPayments, type AffiliateAppliesToProducts as AffiliateAppliesToProducts, type AffiliateOverrideRoles as AffiliateOverrideRoles, type AffiliatePayoutTypes as AffiliatePayoutTypes, type AffiliateRevenueBases as AffiliateRevenueBases, type OverrideCreateResponse as OverrideCreateResponse, type OverrideRetrieveResponse as OverrideRetrieveResponse, type OverrideUpdateResponse as OverrideUpdateResponse, type OverrideListResponse as OverrideListResponse, type OverrideDeleteResponse as OverrideDeleteResponse, type OverrideListResponsesCursorPage as OverrideListResponsesCursorPage, type OverrideCreateParams as OverrideCreateParams, type OverrideRetrieveParams as OverrideRetrieveParams, type OverrideUpdateParams as OverrideUpdateParams, type OverrideListParams as OverrideListParams, type OverrideDeleteParams as OverrideDeleteParams, };
344
+ }
345
+ //# sourceMappingURL=affiliates.d.ts.map
@@ -0,0 +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B,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,+BAA+B,IAAI,+BAA+B,EACvE,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,sBAAsB,IAAI,sBAAsB,EACrD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,oBAAoB,IAAI,oBAAoB,GAClD,CAAC;CACH"}
@@ -0,0 +1,112 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Affiliates = void 0;
5
+ const tslib_1 = require("../../internal/tslib.js");
6
+ const resource_1 = require("../../core/resource.js");
7
+ const OverridesAPI = tslib_1.__importStar(require("./overrides.js"));
8
+ const overrides_1 = require("./overrides.js");
9
+ const pagination_1 = require("../../core/pagination.js");
10
+ const path_1 = require("../../internal/utils/path.js");
11
+ /**
12
+ * Affiliates
13
+ */
14
+ class Affiliates extends resource_1.APIResource {
15
+ constructor() {
16
+ super(...arguments);
17
+ this.overrides = new OverridesAPI.Overrides(this._client);
18
+ }
19
+ /**
20
+ * Creates or finds an affiliate for a company and user.
21
+ *
22
+ * Required permissions:
23
+ *
24
+ * - `affiliate:create`
25
+ *
26
+ * @example
27
+ * ```ts
28
+ * const affiliate = await client.affiliates.create({
29
+ * company_id: 'biz_xxxxxxxxxxxxxx',
30
+ * user_identifier: 'user_identifier',
31
+ * });
32
+ * ```
33
+ */
34
+ create(body, options) {
35
+ return this._client.post('/affiliates', { body, ...options });
36
+ }
37
+ /**
38
+ * Retrieves the details of an existing affiliate.
39
+ *
40
+ * Required permissions:
41
+ *
42
+ * - `affiliate:basic:read`
43
+ *
44
+ * @example
45
+ * ```ts
46
+ * const affiliate = await client.affiliates.retrieve(
47
+ * 'aff_xxxxxxxxxxxxxx',
48
+ * );
49
+ * ```
50
+ */
51
+ retrieve(id, options) {
52
+ return this._client.get((0, path_1.path) `/affiliates/${id}`, options);
53
+ }
54
+ /**
55
+ * Returns a paginated list of affiliates for the actor in context, with optional
56
+ * filtering by status, search, and sorting.
57
+ *
58
+ * Required permissions:
59
+ *
60
+ * - `affiliate:basic:read`
61
+ *
62
+ * @example
63
+ * ```ts
64
+ * // Automatically fetches more pages as needed.
65
+ * for await (const affiliateListResponse of client.affiliates.list(
66
+ * { company_id: 'biz_xxxxxxxxxxxxxx' },
67
+ * )) {
68
+ * // ...
69
+ * }
70
+ * ```
71
+ */
72
+ list(query, options) {
73
+ return this._client.getAPIList('/affiliates', (pagination_1.CursorPage), { query, ...options });
74
+ }
75
+ /**
76
+ * Archives an existing Affiliate
77
+ *
78
+ * Required permissions:
79
+ *
80
+ * - `affiliate:update`
81
+ *
82
+ * @example
83
+ * ```ts
84
+ * const response = await client.affiliates.archive(
85
+ * 'aff_xxxxxxxxxxxxxx',
86
+ * );
87
+ * ```
88
+ */
89
+ archive(id, options) {
90
+ return this._client.post((0, path_1.path) `/affiliates/${id}/archive`, options);
91
+ }
92
+ /**
93
+ * Unarchives an existing Affiliate
94
+ *
95
+ * Required permissions:
96
+ *
97
+ * - `affiliate:update`
98
+ *
99
+ * @example
100
+ * ```ts
101
+ * const response = await client.affiliates.unarchive(
102
+ * 'aff_xxxxxxxxxxxxxx',
103
+ * );
104
+ * ```
105
+ */
106
+ unarchive(id, options) {
107
+ return this._client.post((0, path_1.path) `/affiliates/${id}/unarchive`, options);
108
+ }
109
+ }
110
+ exports.Affiliates = Affiliates;
111
+ Affiliates.Overrides = overrides_1.Overrides;
112
+ //# sourceMappingURL=affiliates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affiliates.js","sourceRoot":"","sources":["../../src/resources/affiliates/affiliates.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAElD,qEAA4C;AAC5C,8CAkBqB;AAErB,yDAAuF;AAEvF,uDAA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.md for details.
2
+ import { APIResource } from "../../core/resource.mjs";
3
+ import * as OverridesAPI from "./overrides.mjs";
4
+ import { Overrides, } from "./overrides.mjs";
5
+ import { CursorPage } from "../../core/pagination.mjs";
6
+ import { path } from "../../internal/utils/path.mjs";
7
+ /**
8
+ * Affiliates
9
+ */
10
+ export class Affiliates extends APIResource {
11
+ constructor() {
12
+ super(...arguments);
13
+ this.overrides = new OverridesAPI.Overrides(this._client);
14
+ }
15
+ /**
16
+ * Creates or finds an affiliate for a company and user.
17
+ *
18
+ * Required permissions:
19
+ *
20
+ * - `affiliate:create`
21
+ *
22
+ * @example
23
+ * ```ts
24
+ * const affiliate = await client.affiliates.create({
25
+ * company_id: 'biz_xxxxxxxxxxxxxx',
26
+ * user_identifier: 'user_identifier',
27
+ * });
28
+ * ```
29
+ */
30
+ create(body, options) {
31
+ return this._client.post('/affiliates', { body, ...options });
32
+ }
33
+ /**
34
+ * Retrieves the details of an existing affiliate.
35
+ *
36
+ * Required permissions:
37
+ *
38
+ * - `affiliate:basic:read`
39
+ *
40
+ * @example
41
+ * ```ts
42
+ * const affiliate = await client.affiliates.retrieve(
43
+ * 'aff_xxxxxxxxxxxxxx',
44
+ * );
45
+ * ```
46
+ */
47
+ retrieve(id, options) {
48
+ return this._client.get(path `/affiliates/${id}`, options);
49
+ }
50
+ /**
51
+ * Returns a paginated list of affiliates for the actor in context, with optional
52
+ * filtering by status, search, and sorting.
53
+ *
54
+ * Required permissions:
55
+ *
56
+ * - `affiliate:basic:read`
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * // Automatically fetches more pages as needed.
61
+ * for await (const affiliateListResponse of client.affiliates.list(
62
+ * { company_id: 'biz_xxxxxxxxxxxxxx' },
63
+ * )) {
64
+ * // ...
65
+ * }
66
+ * ```
67
+ */
68
+ list(query, options) {
69
+ return this._client.getAPIList('/affiliates', (CursorPage), { query, ...options });
70
+ }
71
+ /**
72
+ * Archives an existing Affiliate
73
+ *
74
+ * Required permissions:
75
+ *
76
+ * - `affiliate:update`
77
+ *
78
+ * @example
79
+ * ```ts
80
+ * const response = await client.affiliates.archive(
81
+ * 'aff_xxxxxxxxxxxxxx',
82
+ * );
83
+ * ```
84
+ */
85
+ archive(id, options) {
86
+ return this._client.post(path `/affiliates/${id}/archive`, options);
87
+ }
88
+ /**
89
+ * Unarchives an existing Affiliate
90
+ *
91
+ * Required permissions:
92
+ *
93
+ * - `affiliate:update`
94
+ *
95
+ * @example
96
+ * ```ts
97
+ * const response = await client.affiliates.unarchive(
98
+ * 'aff_xxxxxxxxxxxxxx',
99
+ * );
100
+ * ```
101
+ */
102
+ unarchive(id, options) {
103
+ return this._client.post(path `/affiliates/${id}/unarchive`, options);
104
+ }
105
+ }
106
+ Affiliates.Overrides = Overrides;
107
+ //# sourceMappingURL=affiliates.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"affiliates.mjs","sourceRoot":"","sources":["../../src/resources/affiliates/affiliates.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,KAAK,YAAY;OACjB,EAiBL,SAAS,GACV;OAEM,EAAE,UAAU,EAAsC;OAElD,EAAE,IAAI,EAAE;AAEf;;GAEG;AACH,MAAM,OAAO,UAAW,SAAQ,WAAW;IAA3C;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAmG/E,CAAC;IAjGC;;;;;;;;;;;;;;OAcG;IACH,MAAM,CAAC,IAA2B,EAAE,OAAwB;QAC1D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,eAAe,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IAC5D,CAAC;IAED;;;;;;;;;;;;;;;;;OAiBG;IACH,IAAI,CACF,KAA0B,EAC1B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,aAAa,EAAE,CAAA,UAAiC,CAAA,EAAE,EAAE,KAAK,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1G,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,OAAO,CAAC,EAAU,EAAE,OAAwB;QAC1C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,eAAe,EAAE,UAAU,EAAE,OAAO,CAAC,CAAC;IACrE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,EAAU,EAAE,OAAwB;QAC5C,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,eAAe,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;IACvE,CAAC;CACF;AA6SD,UAAU,CAAC,SAAS,GAAG,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Affiliates, type Affiliate, type Status, type AffiliateListResponse, type AffiliateArchiveResponse, type AffiliateUnarchiveResponse, type AffiliateCreateParams, type AffiliateListParams, type AffiliateListResponsesCursorPage, } from "./affiliates.mjs";
2
+ export { Overrides, type AffiliateAppliesToPayments, type AffiliateAppliesToProducts, type AffiliateOverrideRoles, type AffiliatePayoutTypes, type AffiliateRevenueBases, type OverrideCreateResponse, type OverrideRetrieveResponse, type OverrideUpdateResponse, type OverrideListResponse, type OverrideDeleteResponse, type OverrideCreateParams, type OverrideRetrieveParams, type OverrideUpdateParams, type OverrideListParams, type OverrideDeleteParams, type OverrideListResponsesCursorPage, } from "./overrides.mjs";
3
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/affiliates/index.ts"],"names":[],"mappings":"OAEO,EACL,UAAU,EACV,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,GACtC;OACM,EACL,SAAS,EACT,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,+BAA+B,GACrC"}
@@ -0,0 +1,3 @@
1
+ export { Affiliates, type Affiliate, type Status, type AffiliateListResponse, type AffiliateArchiveResponse, type AffiliateUnarchiveResponse, type AffiliateCreateParams, type AffiliateListParams, type AffiliateListResponsesCursorPage, } from "./affiliates.js";
2
+ export { Overrides, type AffiliateAppliesToPayments, type AffiliateAppliesToProducts, type AffiliateOverrideRoles, type AffiliatePayoutTypes, type AffiliateRevenueBases, type OverrideCreateResponse, type OverrideRetrieveResponse, type OverrideUpdateResponse, type OverrideListResponse, type OverrideDeleteResponse, type OverrideCreateParams, type OverrideRetrieveParams, type OverrideUpdateParams, type OverrideListParams, type OverrideDeleteParams, type OverrideListResponsesCursorPage, } from "./overrides.js";
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/affiliates/index.ts"],"names":[],"mappings":"OAEO,EACL,UAAU,EACV,KAAK,SAAS,EACd,KAAK,MAAM,EACX,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,0BAA0B,EAC/B,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,EACxB,KAAK,gCAAgC,GACtC;OACM,EACL,SAAS,EACT,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,oBAAoB,EACzB,KAAK,+BAA+B,GACrC"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Overrides = exports.Affiliates = void 0;
5
+ var affiliates_1 = require("./affiliates.js");
6
+ Object.defineProperty(exports, "Affiliates", { enumerable: true, get: function () { return affiliates_1.Affiliates; } });
7
+ var overrides_1 = require("./overrides.js");
8
+ Object.defineProperty(exports, "Overrides", { enumerable: true, get: function () { return overrides_1.Overrides; } });
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/affiliates/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,8CAUsB;AATpB,wGAAA,UAAU,OAAA;AAUZ,4CAkBqB;AAjBnB,sGAAA,SAAS,OAAA"}
@@ -0,0 +1,4 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+ export { Affiliates, } from "./affiliates.mjs";
3
+ export { Overrides, } from "./overrides.mjs";
4
+ //# sourceMappingURL=index.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/affiliates/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EACL,UAAU,GASX;OACM,EACL,SAAS,GAiBV"}