@tolt/api 1.2.0 → 1.3.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 (63) 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/index.d.ts +3 -0
  5. package/dist/api/resources/index.js +3 -0
  6. package/dist/api/resources/partnerTags/client/Client.d.ts +118 -0
  7. package/dist/api/resources/partnerTags/client/Client.js +352 -0
  8. package/dist/api/resources/partnerTags/client/index.d.ts +1 -0
  9. package/dist/api/resources/partnerTags/client/index.js +1 -0
  10. package/dist/api/resources/partnerTags/client/requests/CreatePartnerTagRequest.d.ts +16 -0
  11. package/dist/api/resources/partnerTags/client/requests/CreatePartnerTagRequest.js +2 -0
  12. package/dist/api/resources/partnerTags/client/requests/DeletePartnerTagRequest.d.ts +9 -0
  13. package/dist/api/resources/partnerTags/client/requests/DeletePartnerTagRequest.js +2 -0
  14. package/dist/api/resources/partnerTags/client/requests/GetPartnerTagRequest.d.ts +9 -0
  15. package/dist/api/resources/partnerTags/client/requests/GetPartnerTagRequest.js +2 -0
  16. package/dist/api/resources/partnerTags/client/requests/ListPartnerTagsRequest.d.ts +29 -0
  17. package/dist/api/resources/partnerTags/client/requests/ListPartnerTagsRequest.js +2 -0
  18. package/dist/api/resources/partnerTags/client/requests/UpdatePartnerTagRequest.d.ts +15 -0
  19. package/dist/api/resources/partnerTags/client/requests/UpdatePartnerTagRequest.js +2 -0
  20. package/dist/api/resources/partnerTags/client/requests/index.d.ts +5 -0
  21. package/dist/api/resources/partnerTags/client/requests/index.js +1 -0
  22. package/dist/api/resources/partnerTags/exports.d.ts +2 -0
  23. package/dist/api/resources/partnerTags/exports.js +3 -0
  24. package/dist/api/resources/partnerTags/index.d.ts +2 -0
  25. package/dist/api/resources/partnerTags/index.js +2 -0
  26. package/dist/api/resources/partnerTags/types/CreatePartnerTagResponse.d.ts +6 -0
  27. package/dist/api/resources/partnerTags/types/CreatePartnerTagResponse.js +2 -0
  28. package/dist/api/resources/partnerTags/types/DeletePartnerTagResponse.d.ts +6 -0
  29. package/dist/api/resources/partnerTags/types/DeletePartnerTagResponse.js +2 -0
  30. package/dist/api/resources/partnerTags/types/GetPartnerTagResponse.d.ts +6 -0
  31. package/dist/api/resources/partnerTags/types/GetPartnerTagResponse.js +2 -0
  32. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestOrder.d.ts +6 -0
  33. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestOrder.js +6 -0
  34. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestSort.d.ts +6 -0
  35. package/dist/api/resources/partnerTags/types/ListPartnerTagsRequestSort.js +6 -0
  36. package/dist/api/resources/partnerTags/types/ListPartnerTagsResponse.d.ts +11 -0
  37. package/dist/api/resources/partnerTags/types/ListPartnerTagsResponse.js +2 -0
  38. package/dist/api/resources/partnerTags/types/UpdatePartnerTagResponse.d.ts +6 -0
  39. package/dist/api/resources/partnerTags/types/UpdatePartnerTagResponse.js +2 -0
  40. package/dist/api/resources/partnerTags/types/index.d.ts +7 -0
  41. package/dist/api/resources/partnerTags/types/index.js +7 -0
  42. package/dist/api/resources/partners/client/Client.d.ts +43 -0
  43. package/dist/api/resources/partners/client/Client.js +132 -1
  44. package/dist/api/resources/partners/client/requests/AddPartnerTagsRequest.d.ts +12 -0
  45. package/dist/api/resources/partners/client/requests/AddPartnerTagsRequest.js +2 -0
  46. package/dist/api/resources/partners/client/requests/ListPartnersRequest.d.ts +2 -0
  47. package/dist/api/resources/partners/client/requests/RemovePartnerTagRequest.d.ts +11 -0
  48. package/dist/api/resources/partners/client/requests/RemovePartnerTagRequest.js +2 -0
  49. package/dist/api/resources/partners/client/requests/index.d.ts +2 -0
  50. package/dist/api/resources/partners/types/AddPartnerTagsResponse.d.ts +6 -0
  51. package/dist/api/resources/partners/types/AddPartnerTagsResponse.js +2 -0
  52. package/dist/api/resources/partners/types/RemovePartnerTagResponse.d.ts +6 -0
  53. package/dist/api/resources/partners/types/RemovePartnerTagResponse.js +2 -0
  54. package/dist/api/resources/partners/types/index.d.ts +2 -0
  55. package/dist/api/resources/partners/types/index.js +2 -0
  56. package/dist/api/types/PartnerDetails.d.ts +2 -0
  57. package/dist/api/types/PartnerTag.d.ts +11 -0
  58. package/dist/api/types/PartnerTag.js +2 -0
  59. package/dist/api/types/PartnerTagSummary.d.ts +5 -0
  60. package/dist/api/types/PartnerTagSummary.js +2 -0
  61. package/dist/api/types/index.d.ts +2 -0
  62. package/dist/api/types/index.js +2 -0
  63. package/package.json +1 -1
@@ -5,7 +5,7 @@ import * as core from "./core/index.js";
5
5
  export function normalizeClientOptions(options) {
6
6
  const headers = mergeHeaders({
7
7
  "X-Fern-Language": "JavaScript",
8
- "User-Agent": "tolt-typescript/1.2.0",
8
+ "User-Agent": "tolt-typescript/1.3.0",
9
9
  "X-Fern-Runtime": core.RUNTIME.type,
10
10
  "X-Fern-Runtime-Version": core.RUNTIME.version,
11
11
  }, options?.headers);
package/dist/Client.d.ts CHANGED
@@ -6,6 +6,7 @@ import { FlowsClient } from "./api/resources/flows/client/Client.js";
6
6
  import { GroupsClient } from "./api/resources/groups/client/Client.js";
7
7
  import { LinksClient } from "./api/resources/links/client/Client.js";
8
8
  import { PartnersClient } from "./api/resources/partners/client/Client.js";
9
+ import { PartnerTagsClient } from "./api/resources/partnerTags/client/Client.js";
9
10
  import { ProgramsClient } from "./api/resources/programs/client/Client.js";
10
11
  import { PromotionCodesClient } from "./api/resources/promotionCodes/client/Client.js";
11
12
  import { ReportsClient } from "./api/resources/reports/client/Client.js";
@@ -25,6 +26,7 @@ export declare class ToltApiClient {
25
26
  protected _flows: FlowsClient | undefined;
26
27
  protected _clicks: ClicksClient | undefined;
27
28
  protected _partners: PartnersClient | undefined;
29
+ protected _partnerTags: PartnerTagsClient | undefined;
28
30
  protected _programs: ProgramsClient | undefined;
29
31
  protected _customers: CustomersClient | undefined;
30
32
  protected _commissions: CommissionsClient | undefined;
@@ -38,6 +40,7 @@ export declare class ToltApiClient {
38
40
  get flows(): FlowsClient;
39
41
  get clicks(): ClicksClient;
40
42
  get partners(): PartnersClient;
43
+ get partnerTags(): PartnerTagsClient;
41
44
  get programs(): ProgramsClient;
42
45
  get customers(): CustomersClient;
43
46
  get commissions(): CommissionsClient;
package/dist/Client.js CHANGED
@@ -7,6 +7,7 @@ import { FlowsClient } from "./api/resources/flows/client/Client.js";
7
7
  import { GroupsClient } from "./api/resources/groups/client/Client.js";
8
8
  import { LinksClient } from "./api/resources/links/client/Client.js";
9
9
  import { PartnersClient } from "./api/resources/partners/client/Client.js";
10
+ import { PartnerTagsClient } from "./api/resources/partnerTags/client/Client.js";
10
11
  import { ProgramsClient } from "./api/resources/programs/client/Client.js";
11
12
  import { PromotionCodesClient } from "./api/resources/promotionCodes/client/Client.js";
12
13
  import { ReportsClient } from "./api/resources/reports/client/Client.js";
@@ -32,6 +33,9 @@ export class ToltApiClient {
32
33
  get partners() {
33
34
  return (this._partners ??= new PartnersClient(this._options));
34
35
  }
36
+ get partnerTags() {
37
+ return (this._partnerTags ??= new PartnerTagsClient(this._options));
38
+ }
35
39
  get programs() {
36
40
  return (this._programs ??= new ProgramsClient(this._options));
37
41
  }
@@ -22,6 +22,9 @@ export * from "./links/types/index.js";
22
22
  export * from "./partners/client/requests/index.js";
23
23
  export * as partners from "./partners/index.js";
24
24
  export * from "./partners/types/index.js";
25
+ export * from "./partnerTags/client/requests/index.js";
26
+ export * as partnerTags from "./partnerTags/index.js";
27
+ export * from "./partnerTags/types/index.js";
25
28
  export * from "./programs/client/requests/index.js";
26
29
  export * as programs from "./programs/index.js";
27
30
  export * from "./programs/types/index.js";
@@ -22,6 +22,9 @@ export * from "./links/types/index.js";
22
22
  export * from "./partners/client/requests/index.js";
23
23
  export * as partners from "./partners/index.js";
24
24
  export * from "./partners/types/index.js";
25
+ export * from "./partnerTags/client/requests/index.js";
26
+ export * as partnerTags from "./partnerTags/index.js";
27
+ export * from "./partnerTags/types/index.js";
25
28
  export * from "./programs/client/requests/index.js";
26
29
  export * as programs from "./programs/index.js";
27
30
  export * from "./programs/types/index.js";
@@ -0,0 +1,118 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import * as core from "../../../../core/index.js";
4
+ import * as ToltApi from "../../../index.js";
5
+ export declare namespace PartnerTagsClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class PartnerTagsClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<PartnerTagsClient.Options>;
12
+ constructor(options: PartnerTagsClient.Options);
13
+ /**
14
+ * Lists the tags you can put on partners. Filter by program, search by name, and page with cursors.
15
+ *
16
+ * @param {ToltApi.ListPartnerTagsRequest} request
17
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
18
+ *
19
+ * @throws {@link ToltApi.BadRequestError}
20
+ * @throws {@link ToltApi.UnauthorizedError}
21
+ * @throws {@link ToltApi.ContentTooLargeError}
22
+ * @throws {@link ToltApi.TooManyRequestsError}
23
+ * @throws {@link errors.ToltApiError}
24
+ * @throws {@link errors.ToltApiTimeoutError}
25
+ *
26
+ * @example
27
+ * await client.partnerTags.listPartnerTags()
28
+ */
29
+ listPartnerTags(request?: ToltApi.ListPartnerTagsRequest, requestOptions?: PartnerTagsClient.RequestOptions): core.HttpResponsePromise<ToltApi.ListPartnerTagsResponse>;
30
+ private __listPartnerTags;
31
+ /**
32
+ * Creates a tag in a program. Put it on partners with POST /v2/partners/{id}/tags.
33
+ *
34
+ * @param {ToltApi.CreatePartnerTagRequest} request
35
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
36
+ *
37
+ * @throws {@link ToltApi.BadRequestError}
38
+ * @throws {@link ToltApi.UnauthorizedError}
39
+ * @throws {@link ToltApi.ConflictError}
40
+ * @throws {@link ToltApi.ContentTooLargeError}
41
+ * @throws {@link ToltApi.TooManyRequestsError}
42
+ * @throws {@link errors.ToltApiError}
43
+ * @throws {@link errors.ToltApiTimeoutError}
44
+ *
45
+ * @example
46
+ * await client.partnerTags.createPartnerTag({
47
+ * program_id: "prg_T6z8aRW3XCmvFWP972RKxpAd",
48
+ * name: "VIP",
49
+ * color: "#2457D6"
50
+ * })
51
+ */
52
+ createPartnerTag(request: ToltApi.CreatePartnerTagRequest, requestOptions?: PartnerTagsClient.RequestOptions): core.HttpResponsePromise<ToltApi.CreatePartnerTagResponse>;
53
+ private __createPartnerTag;
54
+ /**
55
+ * Gets a partner tag by ID, with how many partners have it.
56
+ *
57
+ * @param {ToltApi.GetPartnerTagRequest} request
58
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
59
+ *
60
+ * @throws {@link ToltApi.UnauthorizedError}
61
+ * @throws {@link ToltApi.NotFoundError}
62
+ * @throws {@link ToltApi.ContentTooLargeError}
63
+ * @throws {@link ToltApi.TooManyRequestsError}
64
+ * @throws {@link errors.ToltApiError}
65
+ * @throws {@link errors.ToltApiTimeoutError}
66
+ *
67
+ * @example
68
+ * await client.partnerTags.getPartnerTag({
69
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
70
+ * })
71
+ */
72
+ getPartnerTag(request: ToltApi.GetPartnerTagRequest, requestOptions?: PartnerTagsClient.RequestOptions): core.HttpResponsePromise<ToltApi.GetPartnerTagResponse>;
73
+ private __getPartnerTag;
74
+ /**
75
+ * Renames a tag or changes its color. Partners who have the tag keep it.
76
+ *
77
+ * @param {ToltApi.UpdatePartnerTagRequest} request
78
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
79
+ *
80
+ * @throws {@link ToltApi.BadRequestError}
81
+ * @throws {@link ToltApi.UnauthorizedError}
82
+ * @throws {@link ToltApi.NotFoundError}
83
+ * @throws {@link ToltApi.ConflictError}
84
+ * @throws {@link ToltApi.ContentTooLargeError}
85
+ * @throws {@link ToltApi.TooManyRequestsError}
86
+ * @throws {@link errors.ToltApiError}
87
+ * @throws {@link errors.ToltApiTimeoutError}
88
+ *
89
+ * @example
90
+ * await client.partnerTags.updatePartnerTag({
91
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB",
92
+ * name: "VIP",
93
+ * color: "#2457D6"
94
+ * })
95
+ */
96
+ updatePartnerTag(request: ToltApi.UpdatePartnerTagRequest, requestOptions?: PartnerTagsClient.RequestOptions): core.HttpResponsePromise<ToltApi.UpdatePartnerTagResponse>;
97
+ private __updatePartnerTag;
98
+ /**
99
+ * Deletes a tag and removes it from every partner who has it.
100
+ *
101
+ * @param {ToltApi.DeletePartnerTagRequest} request
102
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
103
+ *
104
+ * @throws {@link ToltApi.UnauthorizedError}
105
+ * @throws {@link ToltApi.NotFoundError}
106
+ * @throws {@link ToltApi.ContentTooLargeError}
107
+ * @throws {@link ToltApi.TooManyRequestsError}
108
+ * @throws {@link errors.ToltApiError}
109
+ * @throws {@link errors.ToltApiTimeoutError}
110
+ *
111
+ * @example
112
+ * await client.partnerTags.deletePartnerTag({
113
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
114
+ * })
115
+ */
116
+ deletePartnerTag(request: ToltApi.DeletePartnerTagRequest, requestOptions?: PartnerTagsClient.RequestOptions): core.HttpResponsePromise<ToltApi.DeletePartnerTagResponse>;
117
+ private __deletePartnerTag;
118
+ }
@@ -0,0 +1,352 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ import { normalizeClientOptionsWithAuth } from "../../../../BaseClient.js";
3
+ import { mergeHeaders } from "../../../../core/headers.js";
4
+ import * as core from "../../../../core/index.js";
5
+ import { mergeAdditionalBodyParameters } from "../../../../core/requestBody.js";
6
+ import * as environments from "../../../../environments.js";
7
+ import { handleNonStatusCodeError } from "../../../../errors/handleNonStatusCodeError.js";
8
+ import * as errors from "../../../../errors/index.js";
9
+ import * as ToltApi from "../../../index.js";
10
+ export class PartnerTagsClient {
11
+ constructor(options) {
12
+ this._options = normalizeClientOptionsWithAuth(options);
13
+ }
14
+ /**
15
+ * Lists the tags you can put on partners. Filter by program, search by name, and page with cursors.
16
+ *
17
+ * @param {ToltApi.ListPartnerTagsRequest} request
18
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link ToltApi.BadRequestError}
21
+ * @throws {@link ToltApi.UnauthorizedError}
22
+ * @throws {@link ToltApi.ContentTooLargeError}
23
+ * @throws {@link ToltApi.TooManyRequestsError}
24
+ * @throws {@link errors.ToltApiError}
25
+ * @throws {@link errors.ToltApiTimeoutError}
26
+ *
27
+ * @example
28
+ * await client.partnerTags.listPartnerTags()
29
+ */
30
+ listPartnerTags(request = {}, requestOptions) {
31
+ return core.HttpResponsePromise.fromPromise(this.__listPartnerTags(request, requestOptions));
32
+ }
33
+ async __listPartnerTags(request = {}, requestOptions) {
34
+ const { limit, order, sort, starting_after: startingAfter, ending_before: endingBefore, created_after: createdAfter, created_before: createdBefore, updated_after: updatedAfter, updated_before: updatedBefore, program_id: programId, search, } = request;
35
+ const _queryParams = {
36
+ limit,
37
+ order: order != null ? order : undefined,
38
+ sort: sort != null ? sort : undefined,
39
+ starting_after: startingAfter,
40
+ ending_before: endingBefore,
41
+ created_after: createdAfter != null ? createdAfter : undefined,
42
+ created_before: createdBefore != null ? createdBefore : undefined,
43
+ updated_after: updatedAfter != null ? updatedAfter : undefined,
44
+ updated_before: updatedBefore != null ? updatedBefore : undefined,
45
+ program_id: programId,
46
+ search,
47
+ };
48
+ const _authRequest = await this._options.authProvider.getAuthRequest();
49
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
50
+ const _response = await core.fetcher({
51
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
52
+ (await core.Supplier.get(this._options.environment)) ??
53
+ environments.ToltApiEnvironment.Default, "v2/partner-tags"),
54
+ method: "GET",
55
+ headers: _headers,
56
+ queryString: core.url
57
+ .queryBuilder()
58
+ .addMany(_queryParams)
59
+ .mergeAdditional(requestOptions?.queryParams)
60
+ .build(),
61
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
62
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
63
+ abortSignal: requestOptions?.abortSignal,
64
+ fetchFn: this._options?.fetch,
65
+ logging: this._options.logging,
66
+ });
67
+ if (_response.ok) {
68
+ return { data: _response.body, rawResponse: _response.rawResponse };
69
+ }
70
+ if (_response.error.reason === "status-code") {
71
+ switch (_response.error.statusCode) {
72
+ case 400:
73
+ throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
74
+ case 401:
75
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
76
+ case 413:
77
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
78
+ case 429:
79
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
80
+ default:
81
+ throw new errors.ToltApiError({
82
+ statusCode: _response.error.statusCode,
83
+ body: _response.error.body,
84
+ rawResponse: _response.rawResponse,
85
+ });
86
+ }
87
+ }
88
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/partner-tags");
89
+ }
90
+ /**
91
+ * Creates a tag in a program. Put it on partners with POST /v2/partners/{id}/tags.
92
+ *
93
+ * @param {ToltApi.CreatePartnerTagRequest} request
94
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
95
+ *
96
+ * @throws {@link ToltApi.BadRequestError}
97
+ * @throws {@link ToltApi.UnauthorizedError}
98
+ * @throws {@link ToltApi.ConflictError}
99
+ * @throws {@link ToltApi.ContentTooLargeError}
100
+ * @throws {@link ToltApi.TooManyRequestsError}
101
+ * @throws {@link errors.ToltApiError}
102
+ * @throws {@link errors.ToltApiTimeoutError}
103
+ *
104
+ * @example
105
+ * await client.partnerTags.createPartnerTag({
106
+ * program_id: "prg_T6z8aRW3XCmvFWP972RKxpAd",
107
+ * name: "VIP",
108
+ * color: "#2457D6"
109
+ * })
110
+ */
111
+ createPartnerTag(request, requestOptions) {
112
+ return core.HttpResponsePromise.fromPromise(this.__createPartnerTag(request, requestOptions));
113
+ }
114
+ async __createPartnerTag(request, requestOptions) {
115
+ const _authRequest = await this._options.authProvider.getAuthRequest();
116
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
117
+ const _response = await core.fetcher({
118
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
119
+ (await core.Supplier.get(this._options.environment)) ??
120
+ environments.ToltApiEnvironment.Default, "v2/partner-tags"),
121
+ method: "POST",
122
+ headers: _headers,
123
+ contentType: "application/json",
124
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
125
+ requestType: "json",
126
+ body: mergeAdditionalBodyParameters(request, requestOptions?.additionalBodyParameters),
127
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
128
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
129
+ abortSignal: requestOptions?.abortSignal,
130
+ fetchFn: this._options?.fetch,
131
+ logging: this._options.logging,
132
+ });
133
+ if (_response.ok) {
134
+ return { data: _response.body, rawResponse: _response.rawResponse };
135
+ }
136
+ if (_response.error.reason === "status-code") {
137
+ switch (_response.error.statusCode) {
138
+ case 400:
139
+ throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
140
+ case 401:
141
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
142
+ case 409:
143
+ throw new ToltApi.ConflictError(_response.error.body, _response.rawResponse);
144
+ case 413:
145
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
146
+ case 429:
147
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
148
+ default:
149
+ throw new errors.ToltApiError({
150
+ statusCode: _response.error.statusCode,
151
+ body: _response.error.body,
152
+ rawResponse: _response.rawResponse,
153
+ });
154
+ }
155
+ }
156
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/partner-tags");
157
+ }
158
+ /**
159
+ * Gets a partner tag by ID, with how many partners have it.
160
+ *
161
+ * @param {ToltApi.GetPartnerTagRequest} request
162
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
163
+ *
164
+ * @throws {@link ToltApi.UnauthorizedError}
165
+ * @throws {@link ToltApi.NotFoundError}
166
+ * @throws {@link ToltApi.ContentTooLargeError}
167
+ * @throws {@link ToltApi.TooManyRequestsError}
168
+ * @throws {@link errors.ToltApiError}
169
+ * @throws {@link errors.ToltApiTimeoutError}
170
+ *
171
+ * @example
172
+ * await client.partnerTags.getPartnerTag({
173
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
174
+ * })
175
+ */
176
+ getPartnerTag(request, requestOptions) {
177
+ return core.HttpResponsePromise.fromPromise(this.__getPartnerTag(request, requestOptions));
178
+ }
179
+ async __getPartnerTag(request, requestOptions) {
180
+ const { id } = request;
181
+ const _authRequest = await this._options.authProvider.getAuthRequest();
182
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
183
+ const _response = await core.fetcher({
184
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
185
+ (await core.Supplier.get(this._options.environment)) ??
186
+ environments.ToltApiEnvironment.Default, `v2/partner-tags/${core.url.encodePathParam(id, errors.ToltApiError)}`),
187
+ method: "GET",
188
+ headers: _headers,
189
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
190
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
191
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
192
+ abortSignal: requestOptions?.abortSignal,
193
+ fetchFn: this._options?.fetch,
194
+ logging: this._options.logging,
195
+ });
196
+ if (_response.ok) {
197
+ return { data: _response.body, rawResponse: _response.rawResponse };
198
+ }
199
+ if (_response.error.reason === "status-code") {
200
+ switch (_response.error.statusCode) {
201
+ case 401:
202
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
203
+ case 404:
204
+ throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
205
+ case 413:
206
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
207
+ case 429:
208
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
209
+ default:
210
+ throw new errors.ToltApiError({
211
+ statusCode: _response.error.statusCode,
212
+ body: _response.error.body,
213
+ rawResponse: _response.rawResponse,
214
+ });
215
+ }
216
+ }
217
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/partner-tags/{id}");
218
+ }
219
+ /**
220
+ * Renames a tag or changes its color. Partners who have the tag keep it.
221
+ *
222
+ * @param {ToltApi.UpdatePartnerTagRequest} request
223
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
224
+ *
225
+ * @throws {@link ToltApi.BadRequestError}
226
+ * @throws {@link ToltApi.UnauthorizedError}
227
+ * @throws {@link ToltApi.NotFoundError}
228
+ * @throws {@link ToltApi.ConflictError}
229
+ * @throws {@link ToltApi.ContentTooLargeError}
230
+ * @throws {@link ToltApi.TooManyRequestsError}
231
+ * @throws {@link errors.ToltApiError}
232
+ * @throws {@link errors.ToltApiTimeoutError}
233
+ *
234
+ * @example
235
+ * await client.partnerTags.updatePartnerTag({
236
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB",
237
+ * name: "VIP",
238
+ * color: "#2457D6"
239
+ * })
240
+ */
241
+ updatePartnerTag(request, requestOptions) {
242
+ return core.HttpResponsePromise.fromPromise(this.__updatePartnerTag(request, requestOptions));
243
+ }
244
+ async __updatePartnerTag(request, requestOptions) {
245
+ const { id, ..._body } = request;
246
+ const _authRequest = await this._options.authProvider.getAuthRequest();
247
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
248
+ const _response = await core.fetcher({
249
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
250
+ (await core.Supplier.get(this._options.environment)) ??
251
+ environments.ToltApiEnvironment.Default, `v2/partner-tags/${core.url.encodePathParam(id, errors.ToltApiError)}`),
252
+ method: "PUT",
253
+ headers: _headers,
254
+ contentType: "application/json",
255
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
256
+ requestType: "json",
257
+ body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters),
258
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
259
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
260
+ abortSignal: requestOptions?.abortSignal,
261
+ fetchFn: this._options?.fetch,
262
+ logging: this._options.logging,
263
+ });
264
+ if (_response.ok) {
265
+ return { data: _response.body, rawResponse: _response.rawResponse };
266
+ }
267
+ if (_response.error.reason === "status-code") {
268
+ switch (_response.error.statusCode) {
269
+ case 400:
270
+ throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
271
+ case 401:
272
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
273
+ case 404:
274
+ throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
275
+ case 409:
276
+ throw new ToltApi.ConflictError(_response.error.body, _response.rawResponse);
277
+ case 413:
278
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
279
+ case 429:
280
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
281
+ default:
282
+ throw new errors.ToltApiError({
283
+ statusCode: _response.error.statusCode,
284
+ body: _response.error.body,
285
+ rawResponse: _response.rawResponse,
286
+ });
287
+ }
288
+ }
289
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v2/partner-tags/{id}");
290
+ }
291
+ /**
292
+ * Deletes a tag and removes it from every partner who has it.
293
+ *
294
+ * @param {ToltApi.DeletePartnerTagRequest} request
295
+ * @param {PartnerTagsClient.RequestOptions} requestOptions - Request-specific configuration.
296
+ *
297
+ * @throws {@link ToltApi.UnauthorizedError}
298
+ * @throws {@link ToltApi.NotFoundError}
299
+ * @throws {@link ToltApi.ContentTooLargeError}
300
+ * @throws {@link ToltApi.TooManyRequestsError}
301
+ * @throws {@link errors.ToltApiError}
302
+ * @throws {@link errors.ToltApiTimeoutError}
303
+ *
304
+ * @example
305
+ * await client.partnerTags.deletePartnerTag({
306
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
307
+ * })
308
+ */
309
+ deletePartnerTag(request, requestOptions) {
310
+ return core.HttpResponsePromise.fromPromise(this.__deletePartnerTag(request, requestOptions));
311
+ }
312
+ async __deletePartnerTag(request, requestOptions) {
313
+ const { id } = request;
314
+ const _authRequest = await this._options.authProvider.getAuthRequest();
315
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
316
+ const _response = await core.fetcher({
317
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
318
+ (await core.Supplier.get(this._options.environment)) ??
319
+ environments.ToltApiEnvironment.Default, `v2/partner-tags/${core.url.encodePathParam(id, errors.ToltApiError)}`),
320
+ method: "DELETE",
321
+ headers: _headers,
322
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
323
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
324
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
325
+ abortSignal: requestOptions?.abortSignal,
326
+ fetchFn: this._options?.fetch,
327
+ logging: this._options.logging,
328
+ });
329
+ if (_response.ok) {
330
+ return { data: _response.body, rawResponse: _response.rawResponse };
331
+ }
332
+ if (_response.error.reason === "status-code") {
333
+ switch (_response.error.statusCode) {
334
+ case 401:
335
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
336
+ case 404:
337
+ throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
338
+ case 413:
339
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
340
+ case 429:
341
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
342
+ default:
343
+ throw new errors.ToltApiError({
344
+ statusCode: _response.error.statusCode,
345
+ body: _response.error.body,
346
+ rawResponse: _response.rawResponse,
347
+ });
348
+ }
349
+ }
350
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v2/partner-tags/{id}");
351
+ }
352
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * program_id: "prg_T6z8aRW3XCmvFWP972RKxpAd",
5
+ * name: "VIP",
6
+ * color: "#2457D6"
7
+ * }
8
+ */
9
+ export interface CreatePartnerTagRequest {
10
+ /** Id of the program the tag belongs to (prg_...), as returned when listing programs. Only partners in that program can have the tag. */
11
+ program_id: string;
12
+ /** Label shown on the partner in the dashboard, up to 50 characters. A program cannot have two tags with the same name, ignoring case. */
13
+ name: string;
14
+ /** Color of the tag in the dashboard, as a hex code like #2457D6. Defaults to one of the dashboard's tag colors. */
15
+ color?: string;
16
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @example
3
+ * {
4
+ * id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
5
+ * }
6
+ */
7
+ export interface DeletePartnerTagRequest {
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,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";
@@ -203,4 +203,47 @@ export declare class PartnersClient {
203
203
  */
204
204
  suspend(request: ToltApi.SuspendPartnerRequest, requestOptions?: PartnersClient.RequestOptions): core.HttpResponsePromise<ToltApi.SuspendPartnerResponse>;
205
205
  private __suspend;
206
+ /**
207
+ * 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.
208
+ *
209
+ * @param {ToltApi.AddPartnerTagsRequest} request
210
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
211
+ *
212
+ * @throws {@link ToltApi.BadRequestError}
213
+ * @throws {@link ToltApi.UnauthorizedError}
214
+ * @throws {@link ToltApi.NotFoundError}
215
+ * @throws {@link ToltApi.ContentTooLargeError}
216
+ * @throws {@link ToltApi.TooManyRequestsError}
217
+ * @throws {@link errors.ToltApiError}
218
+ * @throws {@link errors.ToltApiTimeoutError}
219
+ *
220
+ * @example
221
+ * await client.partners.addPartnerTags({
222
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
223
+ * tag_ids: ["ptag_zDEcdqNuNBPcokarWxBnk9gB"]
224
+ * })
225
+ */
226
+ addPartnerTags(request: ToltApi.AddPartnerTagsRequest, requestOptions?: PartnersClient.RequestOptions): core.HttpResponsePromise<ToltApi.AddPartnerTagsResponse>;
227
+ private __addPartnerTags;
228
+ /**
229
+ * 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.
230
+ *
231
+ * @param {ToltApi.RemovePartnerTagRequest} request
232
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
233
+ *
234
+ * @throws {@link ToltApi.UnauthorizedError}
235
+ * @throws {@link ToltApi.NotFoundError}
236
+ * @throws {@link ToltApi.ContentTooLargeError}
237
+ * @throws {@link ToltApi.TooManyRequestsError}
238
+ * @throws {@link errors.ToltApiError}
239
+ * @throws {@link errors.ToltApiTimeoutError}
240
+ *
241
+ * @example
242
+ * await client.partners.removePartnerTag({
243
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
244
+ * tag_id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
245
+ * })
246
+ */
247
+ removePartnerTag(request: ToltApi.RemovePartnerTagRequest, requestOptions?: PartnersClient.RequestOptions): core.HttpResponsePromise<ToltApi.RemovePartnerTagResponse>;
248
+ private __removePartnerTag;
206
249
  }
@@ -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, search, } = request;
160
160
  const _queryParams = {
161
161
  limit,
162
162
  order: order != null ? order : undefined,
@@ -170,6 +170,7 @@ export class PartnersClient {
170
170
  status: status != null ? status : undefined,
171
171
  program_id: programId,
172
172
  group_id: groupId,
173
+ tag_id: tagId,
173
174
  search,
174
175
  };
175
176
  const _authRequest = await this._options.authProvider.getAuthRequest();
@@ -626,4 +627,134 @@ export class PartnersClient {
626
627
  }
627
628
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/partners/{id}/suspend");
628
629
  }
630
+ /**
631
+ * 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.
632
+ *
633
+ * @param {ToltApi.AddPartnerTagsRequest} request
634
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
635
+ *
636
+ * @throws {@link ToltApi.BadRequestError}
637
+ * @throws {@link ToltApi.UnauthorizedError}
638
+ * @throws {@link ToltApi.NotFoundError}
639
+ * @throws {@link ToltApi.ContentTooLargeError}
640
+ * @throws {@link ToltApi.TooManyRequestsError}
641
+ * @throws {@link errors.ToltApiError}
642
+ * @throws {@link errors.ToltApiTimeoutError}
643
+ *
644
+ * @example
645
+ * await client.partners.addPartnerTags({
646
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
647
+ * tag_ids: ["ptag_zDEcdqNuNBPcokarWxBnk9gB"]
648
+ * })
649
+ */
650
+ addPartnerTags(request, requestOptions) {
651
+ return core.HttpResponsePromise.fromPromise(this.__addPartnerTags(request, requestOptions));
652
+ }
653
+ async __addPartnerTags(request, requestOptions) {
654
+ const { id, ..._body } = request;
655
+ const _authRequest = await this._options.authProvider.getAuthRequest();
656
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
657
+ const _response = await core.fetcher({
658
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
659
+ (await core.Supplier.get(this._options.environment)) ??
660
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}/tags`),
661
+ method: "POST",
662
+ headers: _headers,
663
+ contentType: "application/json",
664
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
665
+ requestType: "json",
666
+ body: mergeAdditionalBodyParameters(_body, requestOptions?.additionalBodyParameters),
667
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
668
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
669
+ abortSignal: requestOptions?.abortSignal,
670
+ fetchFn: this._options?.fetch,
671
+ logging: this._options.logging,
672
+ });
673
+ if (_response.ok) {
674
+ return { data: _response.body, rawResponse: _response.rawResponse };
675
+ }
676
+ if (_response.error.reason === "status-code") {
677
+ switch (_response.error.statusCode) {
678
+ case 400:
679
+ throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
680
+ case 401:
681
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
682
+ case 404:
683
+ throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
684
+ case 413:
685
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
686
+ case 429:
687
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
688
+ default:
689
+ throw new errors.ToltApiError({
690
+ statusCode: _response.error.statusCode,
691
+ body: _response.error.body,
692
+ rawResponse: _response.rawResponse,
693
+ });
694
+ }
695
+ }
696
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/partners/{id}/tags");
697
+ }
698
+ /**
699
+ * 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.
700
+ *
701
+ * @param {ToltApi.RemovePartnerTagRequest} request
702
+ * @param {PartnersClient.RequestOptions} requestOptions - Request-specific configuration.
703
+ *
704
+ * @throws {@link ToltApi.UnauthorizedError}
705
+ * @throws {@link ToltApi.NotFoundError}
706
+ * @throws {@link ToltApi.ContentTooLargeError}
707
+ * @throws {@link ToltApi.TooManyRequestsError}
708
+ * @throws {@link errors.ToltApiError}
709
+ * @throws {@link errors.ToltApiTimeoutError}
710
+ *
711
+ * @example
712
+ * await client.partners.removePartnerTag({
713
+ * id: "part_NLYzgNKuSuASvrvoxNtau6SY",
714
+ * tag_id: "ptag_zDEcdqNuNBPcokarWxBnk9gB"
715
+ * })
716
+ */
717
+ removePartnerTag(request, requestOptions) {
718
+ return core.HttpResponsePromise.fromPromise(this.__removePartnerTag(request, requestOptions));
719
+ }
720
+ async __removePartnerTag(request, requestOptions) {
721
+ const { id, tag_id: tagId } = request;
722
+ const _authRequest = await this._options.authProvider.getAuthRequest();
723
+ const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
724
+ const _response = await core.fetcher({
725
+ url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
726
+ (await core.Supplier.get(this._options.environment)) ??
727
+ environments.ToltApiEnvironment.Default, `v2/partners/${core.url.encodePathParam(id, errors.ToltApiError)}/tags/${core.url.encodePathParam(tagId, errors.ToltApiError)}`),
728
+ method: "DELETE",
729
+ headers: _headers,
730
+ queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
731
+ timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
732
+ maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
733
+ abortSignal: requestOptions?.abortSignal,
734
+ fetchFn: this._options?.fetch,
735
+ logging: this._options.logging,
736
+ });
737
+ if (_response.ok) {
738
+ return { data: _response.body, rawResponse: _response.rawResponse };
739
+ }
740
+ if (_response.error.reason === "status-code") {
741
+ switch (_response.error.statusCode) {
742
+ case 401:
743
+ throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
744
+ case 404:
745
+ throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
746
+ case 413:
747
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
748
+ case 429:
749
+ throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
750
+ default:
751
+ throw new errors.ToltApiError({
752
+ statusCode: _response.error.statusCode,
753
+ body: _response.error.body,
754
+ rawResponse: _response.rawResponse,
755
+ });
756
+ }
757
+ }
758
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v2/partners/{id}/tags/{tag_id}");
759
+ }
629
760
  }
@@ -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 {};
@@ -28,6 +28,8 @@ 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;
31
33
  /** Text matched anywhere in the partner's id, email, first name, last name or company name, ignoring case. */
32
34
  search?: string;
33
35
  }
@@ -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 {};
@@ -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 PartnerDetails extends ToltApi.Partner {
3
3
  /** Custom-field answers with their questions. Empty when no answers exist. */
4
4
  custom_fields: PartnerDetails.CustomFields.Item[];
5
+ /** Tags on the partner, sorted by name. Empty when the partner has none. */
6
+ tags: ToltApi.PartnerTagSummary[];
5
7
  }
6
8
  export declare namespace PartnerDetails {
7
9
  type CustomFields = CustomFields.Item[];
@@ -0,0 +1,11 @@
1
+ export interface PartnerTag {
2
+ id: string;
3
+ name: string;
4
+ /** Hex color of the tag in the dashboard. */
5
+ color: string;
6
+ program_id: string;
7
+ /** How many partners have the tag. */
8
+ partners_count: number;
9
+ created_at: string;
10
+ updated_at: string;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,5 @@
1
+ export interface PartnerTagSummary {
2
+ id: string;
3
+ name: string;
4
+ color: string;
5
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -10,6 +10,8 @@ export * from "./Group.js";
10
10
  export * from "./Link.js";
11
11
  export * from "./Partner.js";
12
12
  export * from "./PartnerDetails.js";
13
+ export * from "./PartnerTag.js";
14
+ export * from "./PartnerTagSummary.js";
13
15
  export * from "./Program.js";
14
16
  export * from "./PromotionCode.js";
15
17
  export * from "./ReportsCustomerStats.js";
@@ -10,6 +10,8 @@ export * from "./Group.js";
10
10
  export * from "./Link.js";
11
11
  export * from "./Partner.js";
12
12
  export * from "./PartnerDetails.js";
13
+ export * from "./PartnerTag.js";
14
+ export * from "./PartnerTagSummary.js";
13
15
  export * from "./Program.js";
14
16
  export * from "./PromotionCode.js";
15
17
  export * from "./ReportsCustomerStats.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tolt/api",
3
- "version": "1.2.0",
3
+ "version": "1.3.0",
4
4
  "description": "TypeScript SDK for the Tolt Public API",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {