@tolt/api 1.2.0 → 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 (70) hide show
  1. package/dist/BaseClient.js +1 -1
  2. package/dist/Client.d.ts +3 -0
  3. package/dist/Client.js +4 -0
  4. package/dist/api/resources/embedTokens/client/Client.d.ts +2 -1
  5. package/dist/api/resources/embedTokens/client/Client.js +4 -1
  6. package/dist/api/resources/embedTokens/client/requests/CreateEmbedTokenRequest.d.ts +4 -2
  7. package/dist/api/resources/index.d.ts +3 -0
  8. package/dist/api/resources/index.js +3 -0
  9. package/dist/api/resources/partnerTags/client/Client.d.ts +118 -0
  10. package/dist/api/resources/partnerTags/client/Client.js +352 -0
  11. package/dist/api/resources/partnerTags/client/index.d.ts +1 -0
  12. package/dist/api/resources/partnerTags/client/index.js +1 -0
  13. package/dist/api/resources/partnerTags/client/requests/CreatePartnerTagRequest.d.ts +16 -0
  14. package/dist/api/resources/partnerTags/client/requests/CreatePartnerTagRequest.js +2 -0
  15. package/dist/api/resources/partnerTags/client/requests/DeletePartnerTagRequest.d.ts +9 -0
  16. package/dist/api/resources/partnerTags/client/requests/DeletePartnerTagRequest.js +2 -0
  17. package/dist/api/resources/partnerTags/client/requests/GetPartnerTagRequest.d.ts +9 -0
  18. package/dist/api/resources/partnerTags/client/requests/GetPartnerTagRequest.js +2 -0
  19. package/dist/api/resources/partnerTags/client/requests/ListPartnerTagsRequest.d.ts +29 -0
  20. package/dist/api/resources/partnerTags/client/requests/ListPartnerTagsRequest.js +2 -0
  21. package/dist/api/resources/partnerTags/client/requests/UpdatePartnerTagRequest.d.ts +15 -0
  22. package/dist/api/resources/partnerTags/client/requests/UpdatePartnerTagRequest.js +2 -0
  23. package/dist/api/resources/partnerTags/client/requests/index.d.ts +5 -0
  24. package/dist/api/resources/partnerTags/client/requests/index.js +1 -0
  25. package/dist/api/resources/partnerTags/exports.d.ts +2 -0
  26. package/dist/api/resources/partnerTags/exports.js +3 -0
  27. package/dist/api/resources/partnerTags/index.d.ts +2 -0
  28. package/dist/api/resources/partnerTags/index.js +2 -0
  29. package/dist/api/resources/partnerTags/types/CreatePartnerTagResponse.d.ts +6 -0
  30. package/dist/api/resources/partnerTags/types/CreatePartnerTagResponse.js +2 -0
  31. package/dist/api/resources/partnerTags/types/DeletePartnerTagResponse.d.ts +6 -0
  32. package/dist/api/resources/partnerTags/types/DeletePartnerTagResponse.js +2 -0
  33. package/dist/api/resources/partnerTags/types/GetPartnerTagResponse.d.ts +6 -0
  34. package/dist/api/resources/partnerTags/types/GetPartnerTagResponse.js +2 -0
  35. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestOrder.d.ts +6 -0
  36. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestOrder.js +6 -0
  37. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestSort.d.ts +6 -0
  38. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestSort.js +6 -0
  39. package/dist/api/resources/partnerTags/types/ListPartnerTagsResponse.d.ts +11 -0
  40. package/dist/api/resources/partnerTags/types/ListPartnerTagsResponse.js +2 -0
  41. package/dist/api/resources/partnerTags/types/UpdatePartnerTagResponse.d.ts +6 -0
  42. package/dist/api/resources/partnerTags/types/UpdatePartnerTagResponse.js +2 -0
  43. package/dist/api/resources/partnerTags/types/index.d.ts +7 -0
  44. package/dist/api/resources/partnerTags/types/index.js +7 -0
  45. package/dist/api/resources/partners/client/Client.d.ts +46 -1
  46. package/dist/api/resources/partners/client/Client.js +138 -2
  47. package/dist/api/resources/partners/client/requests/AddPartnerTagsRequest.d.ts +12 -0
  48. package/dist/api/resources/partners/client/requests/AddPartnerTagsRequest.js +2 -0
  49. package/dist/api/resources/partners/client/requests/CreatePartnerRequest.d.ts +3 -0
  50. package/dist/api/resources/partners/client/requests/ListPartnersRequest.d.ts +4 -0
  51. package/dist/api/resources/partners/client/requests/RemovePartnerTagRequest.d.ts +11 -0
  52. package/dist/api/resources/partners/client/requests/RemovePartnerTagRequest.js +2 -0
  53. package/dist/api/resources/partners/client/requests/UpdatePartnerRequest.d.ts +2 -0
  54. package/dist/api/resources/partners/client/requests/index.d.ts +2 -0
  55. package/dist/api/resources/partners/types/AddPartnerTagsResponse.d.ts +6 -0
  56. package/dist/api/resources/partners/types/AddPartnerTagsResponse.js +2 -0
  57. package/dist/api/resources/partners/types/RemovePartnerTagResponse.d.ts +6 -0
  58. package/dist/api/resources/partners/types/RemovePartnerTagResponse.js +2 -0
  59. package/dist/api/resources/partners/types/index.d.ts +2 -0
  60. package/dist/api/resources/partners/types/index.js +2 -0
  61. package/dist/api/types/CreatedPartner.d.ts +2 -0
  62. package/dist/api/types/Partner.d.ts +2 -0
  63. package/dist/api/types/PartnerDetails.d.ts +2 -0
  64. package/dist/api/types/PartnerTag.d.ts +11 -0
  65. package/dist/api/types/PartnerTag.js +2 -0
  66. package/dist/api/types/PartnerTagSummary.d.ts +5 -0
  67. package/dist/api/types/PartnerTagSummary.js +2 -0
  68. package/dist/api/types/index.d.ts +2 -0
  69. package/dist/api/types/index.js +2 -0
  70. package/package.json +1 -1
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
5
+ * }
6
+ */
7
+ export interface GetPartnerTagRequest {
8
+ id: string;
9
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,29 @@
1
+ import type * as ToltApi from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {}
5
+ */
6
+ export interface ListPartnerTagsRequest {
7
+ /** How many rows to return in one page. */
8
+ limit?: number;
9
+ /** Ranking direction: desc puts the most recently created or updated rows first. */
10
+ order?: ToltApi.ListPartnerTagsRequestOrder;
11
+ /** Timestamp to order and page by: created_at follows creation order, updated_at follows each item's most recent change. */
12
+ sort?: ToltApi.ListPartnerTagsRequestSort;
13
+ /** Continue after a position: the next_cursor of a previous page, or an item id when sorting by created_at. Cannot be combined with ending_before. */
14
+ starting_after?: string;
15
+ /** Page backward from a position: the prev_cursor of a previous page, or an item id when sorting by created_at. Cannot be combined with starting_after. */
16
+ ending_before?: string;
17
+ /** Start of a window on when items were created: items created at this time or later are included, for example 2026-01-01T00:00:00Z. Leave it out for no lower bound. */
18
+ created_after?: string;
19
+ /** End of a window on when items were created: only items created before this time are included. Leave it out for no upper bound. */
20
+ created_before?: string;
21
+ /** Only items last changed at or after this moment; with sort=updated_at, use it to fetch what changed since a previous sync. */
22
+ updated_after?: string;
23
+ /** Only items last changed before this moment; pair it with updated_after to fetch what changed in a period. */
24
+ updated_before?: string;
25
+ /** Limit to one program, by its id (prg_...) as returned when listing programs. */
26
+ program_id?: string;
27
+ /** Text matched anywhere in the tag name, ignoring case. */
28
+ search?: string;
29
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,15 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB",
5
+ * name: "VIP",
6
+ * color: "#2457D6"
7
+ * }
8
+ */
9
+ export interface UpdatePartnerTagRequest {
10
+ id: string;
11
+ /** Label shown on the partner in the dashboard, up to 50 characters. A program cannot have two tags with the same name, ignoring case. */
12
+ name?: string;
13
+ /** Color of the tag in the dashboard, as a hex code like #2457D6. */
14
+ color?: string;
15
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,5 @@
1
+ export type { CreatePartnerTagRequest } from "./CreatePartnerTagRequest.js";
2
+ export type { DeletePartnerTagRequest } from "./DeletePartnerTagRequest.js";
3
+ export type { GetPartnerTagRequest } from "./GetPartnerTagRequest.js";
4
+ export type { ListPartnerTagsRequest } from "./ListPartnerTagsRequest.js";
5
+ export type { UpdatePartnerTagRequest } from "./UpdatePartnerTagRequest.js";
@@ -0,0 +1,2 @@
1
+ export { PartnerTagsClient } from "./client/Client.js";
2
+ export * from "./client/index.js";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { PartnerTagsClient } from "./client/Client.js";
3
+ export * from "./client/index.js";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./types/index.js";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.js";
2
+ export * from "./types/index.js";
@@ -0,0 +1,6 @@
1
+ import type * as ToltApi from "../../../index.js";
2
+ export interface CreatePartnerTagResponse {
3
+ success: boolean;
4
+ message: string;
5
+ data: ToltApi.PartnerTag;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as ToltApi from "../../../index.js";
2
+ export interface DeletePartnerTagResponse {
3
+ success: boolean;
4
+ message: string;
5
+ data: ToltApi.PartnerTag;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as ToltApi from "../../../index.js";
2
+ export interface GetPartnerTagResponse {
3
+ success: boolean;
4
+ message: string;
5
+ data: ToltApi.PartnerTag;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ /** Ranking direction: desc puts the most recently created or updated rows first. */
2
+ export declare const ListPartnerTagsRequestOrder: {
3
+ readonly Asc: "asc";
4
+ readonly Desc: "desc";
5
+ };
6
+ export type ListPartnerTagsRequestOrder = (typeof ListPartnerTagsRequestOrder)[keyof typeof ListPartnerTagsRequestOrder];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Ranking direction: desc puts the most recently created or updated rows first. */
3
+ export const ListPartnerTagsRequestOrder = {
4
+ Asc: "asc",
5
+ Desc: "desc",
6
+ };
@@ -0,0 +1,6 @@
1
+ /** Timestamp to order and page by: created_at follows creation order, updated_at follows each item's most recent change. */
2
+ export declare const ListPartnerTagsRequestSort: {
3
+ readonly CreatedAt: "created_at";
4
+ readonly UpdatedAt: "updated_at";
5
+ };
6
+ export type ListPartnerTagsRequestSort = (typeof ListPartnerTagsRequestSort)[keyof typeof ListPartnerTagsRequestSort];
@@ -0,0 +1,6 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Timestamp to order and page by: created_at follows creation order, updated_at follows each item's most recent change. */
3
+ export const ListPartnerTagsRequestSort = {
4
+ CreatedAt: "created_at",
5
+ UpdatedAt: "updated_at",
6
+ };
@@ -0,0 +1,11 @@
1
+ import type * as ToltApi from "../../../index.js";
2
+ export interface ListPartnerTagsResponse {
3
+ success: boolean;
4
+ message: string;
5
+ data: ToltApi.PartnerTag[];
6
+ has_more: boolean;
7
+ /** Opaque cursor marking the last item on this page. Pass it as starting_after to continue. Null when the page is empty. */
8
+ next_cursor: string | null;
9
+ /** Opaque cursor marking the first item on this page. Pass it as ending_before to page backward. Null when the page is empty. */
10
+ prev_cursor: string | null;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as ToltApi from "../../../index.js";
2
+ export interface UpdatePartnerTagResponse {
3
+ success: boolean;
4
+ message: string;
5
+ data: ToltApi.PartnerTag;
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,7 @@
1
+ export * from "./CreatePartnerTagResponse.js";
2
+ export * from "./DeletePartnerTagResponse.js";
3
+ export * from "./GetPartnerTagResponse.js";
4
+ export * from "./ListPartnerTagsRequestOrder.js";
5
+ export * from "./ListPartnerTagsRequestSort.js";
6
+ export * from "./ListPartnerTagsResponse.js";
7
+ export * from "./UpdatePartnerTagResponse.js";
@@ -0,0 +1,7 @@
1
+ export * from "./CreatePartnerTagResponse.js";
2
+ export * from "./DeletePartnerTagResponse.js";
3
+ export * from "./GetPartnerTagResponse.js";
4
+ export * from "./ListPartnerTagsRequestOrder.js";
5
+ export * from "./ListPartnerTagsRequestSort.js";
6
+ export * from "./ListPartnerTagsResponse.js";
7
+ export * from "./UpdatePartnerTagResponse.js";
@@ -52,7 +52,7 @@ export declare class PartnersClient {
52
52
  bulkReject(request: ToltApi.BulkRejectPartnersRequest, requestOptions?: PartnersClient.RequestOptions): core.HttpResponsePromise<ToltApi.BulkRejectPartnersResponse>;
53
53
  private __bulkReject;
54
54
  /**
55
- * Lists onboarded partners. Filter by status, program or group, search by name, email or company, and page with cursors.
55
+ * Lists onboarded partners. Filter by status, program, group or external_id, search by name, email or company, and page with cursors.
56
56
  *
57
57
  * @param {ToltApi.ListPartnersRequest} request
58
58
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -86,6 +86,7 @@ export declare class PartnersClient {
86
86
  * await client.partners.create({
87
87
  * email: "sam@example.com",
88
88
  * program_id: "prg_T6z8aRW3XCmvFWP972RKxpAd",
89
+ * external_id: "user_123",
89
90
  * first_name: "Sam",
90
91
  * last_name: "Taylor",
91
92
  * group_id: "grp_zUQ8Pt281MsbNDApmDPN3Y2a",
@@ -126,6 +127,7 @@ export declare class PartnersClient {
126
127
  * @throws {@link ToltApi.BadRequestError}
127
128
  * @throws {@link ToltApi.UnauthorizedError}
128
129
  * @throws {@link ToltApi.NotFoundError}
130
+ * @throws {@link ToltApi.ConflictError}
129
131
  * @throws {@link ToltApi.ContentTooLargeError}
130
132
  * @throws {@link ToltApi.TooManyRequestsError}
131
133
  * @throws {@link errors.ToltApiError}
@@ -203,4 +205,47 @@ export declare class PartnersClient {
203
205
  */
204
206
  suspend(request: ToltApi.SuspendPartnerRequest, requestOptions?: PartnersClient.RequestOptions): core.HttpResponsePromise<ToltApi.SuspendPartnerResponse>;
205
207
  private __suspend;
208
+ /**
209
+ * Puts one or more tags on the partner. Each tag must belong to the partner's program; tags the partner already has stay as they are. Returns every tag the partner now has, and sends partner.updated if any tag was added.
210
+ *
211
+ * @param {ToltApi.AddPartnerTagsRequest} request
212
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
213
+ *
214
+ * @throws {@link ToltApi.BadRequestError}
215
+ * @throws {@link ToltApi.UnauthorizedError}
216
+ * @throws {@link ToltApi.NotFoundError}
217
+ * @throws {@link ToltApi.ContentTooLargeError}
218
+ * @throws {@link ToltApi.TooManyRequestsError}
219
+ * @throws {@link errors.ToltApiError}
220
+ * @throws {@link errors.ToltApiTimeoutError}
221
+ *
222
+ * @example
223
+ * await client.partners.addPartnerTags({
224
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
225
+ * tag_ids: ["ptag_zDEcdqNuNBPcokarWxBnk9gB"]
226
+ * })
227
+ */
228
+ addPartnerTags(request: ToltApi.AddPartnerTagsRequest, requestOptions?: PartnersClient.RequestOptions): core.HttpResponsePromise<ToltApi.AddPartnerTagsResponse>;
229
+ private __addPartnerTags;
230
+ /**
231
+ * Takes the tag off the partner. Removing a tag the partner does not have succeeds and changes nothing. Returns every tag the partner still has, and sends partner.updated if the tag was removed.
232
+ *
233
+ * @param {ToltApi.RemovePartnerTagRequest} request
234
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
235
+ *
236
+ * @throws {@link ToltApi.UnauthorizedError}
237
+ * @throws {@link ToltApi.NotFoundError}
238
+ * @throws {@link ToltApi.ContentTooLargeError}
239
+ * @throws {@link ToltApi.TooManyRequestsError}
240
+ * @throws {@link errors.ToltApiError}
241
+ * @throws {@link errors.ToltApiTimeoutError}
242
+ *
243
+ * @example
244
+ * await client.partners.removePartnerTag({
245
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
246
+ * tag_id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
247
+ * })
248
+ */
249
+ removePartnerTag(request: ToltApi.RemovePartnerTagRequest, requestOptions?: PartnersClient.RequestOptions): core.HttpResponsePromise<ToltApi.RemovePartnerTagResponse>;
250
+ private __removePartnerTag;
206
251
  }
@@ -139,7 +139,7 @@ export class PartnersClient {
139
139
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/partners/bulk/reject");
140
140
  }
141
141
  /**
142
- * Lists onboarded partners. Filter by status, program or group, search by name, email or company, and page with cursors.
142
+ * Lists onboarded partners. Filter by status, program, group or external_id, search by name, email or company, and page with cursors.
143
143
  *
144
144
  * @param {ToltApi.ListPartnersRequest} request
145
145
  * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -156,7 +156,7 @@ export class PartnersClient {
156
156
  */
157
157
  async list(request = {}, requestOptions) {
158
158
  const list = core.HttpResponsePromise.interceptFunction(async (request) => {
159
- const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, status, program_id: programId, group_id: groupId, search, } = request;
159
+ const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, status, program_id: programId, group_id: groupId, tag_id: tagId, external_id: externalId, search, } = request;
160
160
  const _queryParams = {
161
161
  limit,
162
162
  order: order != null ? order : undefined,
@@ -170,6 +170,8 @@ export class PartnersClient {
170
170
  status: status != null ? status : undefined,
171
171
  program_id: programId,
172
172
  group_id: groupId,
173
+ tag_id: tagId,
174
+ external_id: externalId,
173
175
  search,
174
176
  };
175
177
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -244,6 +246,7 @@ export class PartnersClient {
244
246
  * await client.partners.create({
245
247
  * email: "sam@example.com",
246
248
  * program_id: "prg_T6z8aRW3XCmvFWP972RKxpAd",
249
+ * external_id: "user_123",
247
250
  * first_name: "Sam",
248
251
  * last_name: "Taylor",
249
252
  * group_id: "grp_zUQ8Pt281MsbNDApmDPN3Y2a",
@@ -370,6 +373,7 @@ export class PartnersClient {
370
373
  * @throws {@link ToltApi.BadRequestError}
371
374
  * @throws {@link ToltApi.UnauthorizedError}
372
375
  * @throws {@link ToltApi.NotFoundError}
376
+ * @throws {@link ToltApi.ConflictError}
373
377
  * @throws {@link ToltApi.ContentTooLargeError}
374
378
  * @throws {@link ToltApi.TooManyRequestsError}
375
379
  * @throws {@link errors.ToltApiError}
@@ -417,6 +421,8 @@ export class PartnersClient {
417
421
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
418
422
  case 404:
419
423
  throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
424
+ case 409:
425
+ throw new ToltApi.ConflictError(_response.error.body, _response.rawResponse);
420
426
  case 413:
421
427
  throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
422
428
  case 429:
@@ -626,4 +632,134 @@ export class PartnersClient {
626
632
  }
627
633
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/partners/{id}/suspend");
628
634
  }
635
+ /**
636
+ * Puts one or more tags on the partner. Each tag must belong to the partner's program; tags the partner already has stay as they are. Returns every tag the partner now has, and sends partner.updated if any tag was added.
637
+ *
638
+ * @param {ToltApi.AddPartnerTagsRequest} request
639
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
640
+ *
641
+ * @throws {@link ToltApi.BadRequestError}
642
+ * @throws {@link ToltApi.UnauthorizedError}
643
+ * @throws {@link ToltApi.NotFoundError}
644
+ * @throws {@link ToltApi.ContentTooLargeError}
645
+ * @throws {@link ToltApi.TooManyRequestsError}
646
+ * @throws {@link errors.ToltApiError}
647
+ * @throws {@link errors.ToltApiTimeoutError}
648
+ *
649
+ * @example
650
+ * await client.partners.addPartnerTags({
651
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
652
+ * tag_ids: ["ptag_zDEcdqNuNBPcokarWxBnk9gB"]
653
+ * })
654
+ */
655
+ addPartnerTags(request, requestOptions) {
656
+ return core.HttpResponsePromise.fromPromise(this.__addPartnerTags(request, requestOptions));
657
+ }
658
+ async __addPartnerTags(request, requestOptions) {
659
+ const { id, ..._body } = request;
660
+ const _authRequest = await this._options.authProvider.getAuthRequest();
661
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
662
+ const _response = await core.fetcher({
663
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
664
+ (await core.Supplier.get(this._options.environment)) ??
665
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}/tags`),
666
+ method: "POST",
667
+ headers: _headers,
668
+ contentType: "application/json",
669
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
670
+ requestType: "json",
671
+ body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters),
672
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
673
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
674
+ abortSignal: requestOptions?.abortSignal,
675
+ fetchFn: this._options?.fetch,
676
+ logging: this._options.logging,
677
+ });
678
+ if (_response.ok) {
679
+ return { data: _response.body, rawResponse: _response.rawResponse };
680
+ }
681
+ if (_response.error.reason === "status-code") {
682
+ switch (_response.error.statusCode) {
683
+ case 400:
684
+ throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
685
+ case 401:
686
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
687
+ case 404:
688
+ throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
689
+ case 413:
690
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
691
+ case 429:
692
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
693
+ default:
694
+ throw new errors.ToltApiError({
695
+ statusCode: _response.error.statusCode,
696
+ body: _response.error.body,
697
+ rawResponse: _response.rawResponse,
698
+ });
699
+ }
700
+ }
701
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/partners/{id}/tags");
702
+ }
703
+ /**
704
+ * Takes the tag off the partner. Removing a tag the partner does not have succeeds and changes nothing. Returns every tag the partner still has, and sends partner.updated if the tag was removed.
705
+ *
706
+ * @param {ToltApi.RemovePartnerTagRequest} request
707
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
708
+ *
709
+ * @throws {@link ToltApi.UnauthorizedError}
710
+ * @throws {@link ToltApi.NotFoundError}
711
+ * @throws {@link ToltApi.ContentTooLargeError}
712
+ * @throws {@link ToltApi.TooManyRequestsError}
713
+ * @throws {@link errors.ToltApiError}
714
+ * @throws {@link errors.ToltApiTimeoutError}
715
+ *
716
+ * @example
717
+ * await client.partners.removePartnerTag({
718
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
719
+ * tag_id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
720
+ * })
721
+ */
722
+ removePartnerTag(request, requestOptions) {
723
+ return core.HttpResponsePromise.fromPromise(this.__removePartnerTag(request, requestOptions));
724
+ }
725
+ async __removePartnerTag(request, requestOptions) {
726
+ const { id, tag_id: tagId } = request;
727
+ const _authRequest = await this._options.authProvider.getAuthRequest();
728
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
729
+ const _response = await core.fetcher({
730
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
731
+ (await core.Supplier.get(this._options.environment)) ??
732
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}/tags/${core.url.encodePathParam(tagId, errors.ToltApiError)}`),
733
+ method: "DELETE",
734
+ headers: _headers,
735
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
736
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
737
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
738
+ abortSignal: requestOptions?.abortSignal,
739
+ fetchFn: this._options?.fetch,
740
+ logging: this._options.logging,
741
+ });
742
+ if (_response.ok) {
743
+ return { data: _response.body, rawResponse: _response.rawResponse };
744
+ }
745
+ if (_response.error.reason === "status-code") {
746
+ switch (_response.error.statusCode) {
747
+ case 401:
748
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
749
+ case 404:
750
+ throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
751
+ case 413:
752
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
753
+ case 429:
754
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
755
+ default:
756
+ throw new errors.ToltApiError({
757
+ statusCode: _response.error.statusCode,
758
+ body: _response.error.body,
759
+ rawResponse: _response.rawResponse,
760
+ });
761
+ }
762
+ }
763
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v2/partners/{id}/tags/{tag_id}");
764
+ }
629
765
  }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
5
+ * tag_ids: ["ptag_zDEcdqNuNBPcokarWxBnk9gB"]
6
+ * }
7
+ */
8
+ export interface AddPartnerTagsRequest {
9
+ id: string;
10
+ /** Ids of the tags to add (ptag_...), as returned when listing partner tags. Each must belong to the partner's program. Tags the partner already has stay as they are. */
11
+ tag_ids: string[];
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -3,6 +3,7 @@
3
3
  * {
4
4
  * email: "sam@example.com",
5
5
  * program_id: "prg_T6z8aRW3XCmvFWP972RKxpAd",
6
+ * external_id: "user_123",
6
7
  * first_name: "Sam",
7
8
  * last_name: "Taylor",
8
9
  * group_id: "grp_zUQ8Pt281MsbNDApmDPN3Y2a",
@@ -17,6 +18,8 @@ export interface CreatePartnerRequest {
17
18
  email: string;
18
19
  /** Id of the program to add the partner to (prg_...), as returned when listing programs. */
19
20
  program_id: string;
21
+ /** Your own id for this partner, such as the user id in your app, so you can find them by it later. No other partner in the program can have it. */
22
+ external_id?: string;
20
23
  /** Partner's first name. With last_name it is used for the default link value when link is omitted. */
21
24
  first_name?: string;
22
25
  /** Partner's last name. With first_name it makes up the name shown for the partner unless display_name is set. */
@@ -28,6 +28,10 @@ export interface ListPartnersRequest {
28
28
  program_id?: string;
29
29
  /** Limit to partners in one group, by the group id (grp_...) as returned when listing groups. */
30
30
  group_id?: string;
31
+ /** Limit to partners with this tag, by the tag id (ptag_...) as returned when listing partner tags. */
32
+ tag_id?: string;
33
+ /** Keep only partners with this external_id, matched exactly. Add program_id to get at most one partner. */
34
+ external_id?: string;
31
35
  /** Text matched anywhere in the partner's id, email, first name, last name or company name, ignoring case. */
32
36
  search?: string;
33
37
  }
@@ -0,0 +1,11 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
5
+ * tag_id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
6
+ * }
7
+ */
8
+ export interface RemovePartnerTagRequest {
9
+ id: string;
10
+ tag_id: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -19,6 +19,8 @@ export interface UpdatePartnerRequest {
19
19
  country_code?: string | null;
20
20
  /** URL of the partner's website, starting with http:// or https://; null clears it. */
21
21
  website_url?: string | null;
22
+ /** Your own id for this partner, such as the user id in your app. No other partner in the program can have it; null clears it. */
23
+ external_id?: string | null;
22
24
  /** Id of a group in the partner's program to move them to (grp_...), as returned when listing groups. Commission flows scoped to that group then apply to them; null removes them from their group. */
23
25
  group_id?: string | null;
24
26
  }
@@ -1,3 +1,4 @@
1
+ export type { AddPartnerTagsRequest } from "./AddPartnerTagsRequest.js";
1
2
  export type { ApprovePartnerRequest } from "./ApprovePartnerRequest.js";
2
3
  export type { BulkApprovePartnersRequest } from "./BulkApprovePartnersRequest.js";
3
4
  export type { BulkRejectPartnersRequest } from "./BulkRejectPartnersRequest.js";
@@ -5,5 +6,6 @@ export { CreatePartnerRequest } from "./CreatePartnerRequest.js";
5
6
  export type { GetPartnerRequest } from "./GetPartnerRequest.js";
6
7
  export type { ListPartnersRequest } from "./ListPartnersRequest.js";
7
8
  export type { RejectPartnerRequest } from "./RejectPartnerRequest.js";
9
+ export type { RemovePartnerTagRequest } from "./RemovePartnerTagRequest.js";
8
10
  export type { SuspendPartnerRequest } from "./SuspendPartnerRequest.js";
9
11
  export type { UpdatePartnerRequest } from "./UpdatePartnerRequest.js";
@@ -0,0 +1,6 @@
1
+ import type * as ToltApi from "../../../index.js";
2
+ export interface AddPartnerTagsResponse {
3
+ success: boolean;
4
+ message: string;
5
+ data: ToltApi.PartnerTagSummary[];
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,6 @@
1
+ import type * as ToltApi from "../../../index.js";
2
+ export interface RemovePartnerTagResponse {
3
+ success: boolean;
4
+ message: string;
5
+ data: ToltApi.PartnerTagSummary[];
6
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -1,3 +1,4 @@
1
+ export * from "./AddPartnerTagsResponse.js";
1
2
  export * from "./ApprovePartnerResponse.js";
2
3
  export * from "./BulkApprovePartnersResponse.js";
3
4
  export * from "./BulkRejectPartnersResponse.js";
@@ -8,5 +9,6 @@ export * from "./ListPartnersRequestSort.js";
8
9
  export * from "./ListPartnersRequestStatus.js";
9
10
  export * from "./ListPartnersResponse.js";
10
11
  export * from "./RejectPartnerResponse.js";
12
+ export * from "./RemovePartnerTagResponse.js";
11
13
  export * from "./SuspendPartnerResponse.js";
12
14
  export * from "./UpdatePartnerResponse.js";
@@ -1,3 +1,4 @@
1
+ export * from "./AddPartnerTagsResponse.js";
1
2
  export * from "./ApprovePartnerResponse.js";
2
3
  export * from "./BulkApprovePartnersResponse.js";
3
4
  export * from "./BulkRejectPartnersResponse.js";
@@ -8,5 +9,6 @@ export * from "./ListPartnersRequestSort.js";
8
9
  export * from "./ListPartnersRequestStatus.js";
9
10
  export * from "./ListPartnersResponse.js";
10
11
  export * from "./RejectPartnerResponse.js";
12
+ export * from "./RemovePartnerTagResponse.js";
11
13
  export * from "./SuspendPartnerResponse.js";
12
14
  export * from "./UpdatePartnerResponse.js";
@@ -2,6 +2,8 @@ import type * as ToltApi from "../index.js";
2
2
  export interface CreatedPartner {
3
3
  id: string;
4
4
  email: string;
5
+ /** Your own id for the partner, such as the user id in your app, or null. */
6
+ external_id: string | null;
5
7
  first_name: string | null;
6
8
  last_name: string | null;
7
9
  company_name: string | null;
@@ -1,6 +1,8 @@
1
1
  export interface Partner {
2
2
  id: string;
3
3
  email: string;
4
+ /** Your own id for the partner, such as the user id in your app, or null. */
5
+ external_id: string | null;
4
6
  first_name: string | null;
5
7
  last_name: string | null;
6
8
  company_name: string | null;