@tolt/api 0.6.1 → 0.7.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 (166) hide show
  1. package/dist/api/errors/ContentTooLargeError.d.ts +7 -0
  2. package/dist/api/errors/ContentTooLargeError.js +17 -0
  3. package/dist/api/errors/index.d.ts +1 -0
  4. package/dist/api/errors/index.js +1 -0
  5. package/dist/api/resources/clicks/client/Client.d.ts +6 -1
  6. package/dist/api/resources/clicks/client/Client.js +15 -4
  7. package/dist/api/resources/clicks/client/requests/GetClicksRequest.d.ts +1 -1
  8. package/dist/api/resources/clicks/client/requests/ListClicksRequest.d.ts +10 -5
  9. package/dist/api/resources/clicks/types/ListClicksRequestOrder.d.ts +1 -0
  10. package/dist/api/resources/clicks/types/ListClicksRequestOrder.js +1 -0
  11. package/dist/api/resources/clicks/types/ListClicksRequestSort.d.ts +1 -1
  12. package/dist/api/resources/clicks/types/ListClicksRequestSort.js +1 -1
  13. package/dist/api/resources/commissions/client/Client.d.ts +29 -7
  14. package/dist/api/resources/commissions/client/Client.js +56 -16
  15. package/dist/api/resources/commissions/client/requests/ApproveCommissionsRequest.d.ts +1 -1
  16. package/dist/api/resources/commissions/client/requests/BulkApproveCommissionsRequest.d.ts +2 -2
  17. package/dist/api/resources/commissions/client/requests/BulkDeclineCommissionsRequest.d.ts +2 -2
  18. package/dist/api/resources/commissions/client/requests/DeclineCommissionsRequest.d.ts +1 -1
  19. package/dist/api/resources/commissions/client/requests/DeleteCommissionsRequest.d.ts +1 -1
  20. package/dist/api/resources/commissions/client/requests/GetCommissionsRequest.d.ts +1 -1
  21. package/dist/api/resources/commissions/client/requests/ListCommissionsRequest.d.ts +14 -5
  22. package/dist/api/resources/commissions/client/requests/UpdateCommissionsRequest.d.ts +19 -4
  23. package/dist/api/resources/commissions/client/requests/UpdateCommissionsRequest.js +8 -1
  24. package/dist/api/resources/commissions/client/requests/index.d.ts +1 -1
  25. package/dist/api/resources/commissions/client/requests/index.js +1 -1
  26. package/dist/api/resources/commissions/types/ListCommissionsRequestOrder.d.ts +1 -0
  27. package/dist/api/resources/commissions/types/ListCommissionsRequestOrder.js +1 -0
  28. package/dist/api/resources/commissions/types/ListCommissionsRequestSort.d.ts +1 -1
  29. package/dist/api/resources/commissions/types/ListCommissionsRequestSort.js +1 -1
  30. package/dist/api/resources/customers/client/Client.d.ts +27 -4
  31. package/dist/api/resources/customers/client/Client.js +42 -9
  32. package/dist/api/resources/customers/client/requests/CreateCustomersRequest.d.ts +20 -2
  33. package/dist/api/resources/customers/client/requests/CreateCustomersRequest.js +1 -0
  34. package/dist/api/resources/customers/client/requests/DeleteCustomersRequest.d.ts +1 -1
  35. package/dist/api/resources/customers/client/requests/GetCustomersRequest.d.ts +1 -1
  36. package/dist/api/resources/customers/client/requests/ListCustomersRequest.d.ts +14 -5
  37. package/dist/api/resources/customers/client/requests/UpdateCustomersRequest.d.ts +15 -2
  38. package/dist/api/resources/customers/client/requests/UpdateCustomersRequest.js +1 -0
  39. package/dist/api/resources/customers/types/ListCustomersRequestOrder.d.ts +1 -0
  40. package/dist/api/resources/customers/types/ListCustomersRequestOrder.js +1 -0
  41. package/dist/api/resources/customers/types/ListCustomersRequestSort.d.ts +1 -1
  42. package/dist/api/resources/customers/types/ListCustomersRequestSort.js +1 -1
  43. package/dist/api/resources/customers/types/ListCustomersRequestStatus.d.ts +1 -0
  44. package/dist/api/resources/customers/types/ListCustomersRequestStatus.js +1 -0
  45. package/dist/api/resources/embed/client/Client.d.ts +5 -2
  46. package/dist/api/resources/embed/client/Client.js +9 -4
  47. package/dist/api/resources/embed/client/index.d.ts +1 -1
  48. package/dist/api/resources/embed/client/index.js +1 -1
  49. package/dist/api/resources/embed/types/CreateTokenEmbedRequest.d.ts +1 -0
  50. package/dist/api/resources/embed/types/index.d.ts +1 -0
  51. package/dist/api/resources/embed/types/index.js +1 -0
  52. package/dist/api/resources/flows/client/Client.d.ts +7 -1
  53. package/dist/api/resources/flows/client/Client.js +13 -3
  54. package/dist/api/resources/flows/client/requests/GetFlowsRequest.d.ts +1 -1
  55. package/dist/api/resources/flows/client/requests/ListFlowsRequest.d.ts +13 -5
  56. package/dist/api/resources/flows/types/ListFlowsRequestActive.d.ts +1 -0
  57. package/dist/api/resources/flows/types/ListFlowsRequestActive.js +1 -0
  58. package/dist/api/resources/flows/types/ListFlowsRequestOrder.d.ts +1 -0
  59. package/dist/api/resources/flows/types/ListFlowsRequestOrder.js +1 -0
  60. package/dist/api/resources/flows/types/ListFlowsRequestSort.d.ts +1 -1
  61. package/dist/api/resources/flows/types/ListFlowsRequestSort.js +1 -1
  62. package/dist/api/resources/groups/client/Client.d.ts +7 -1
  63. package/dist/api/resources/groups/client/Client.js +13 -3
  64. package/dist/api/resources/groups/client/requests/GetGroupsRequest.d.ts +1 -1
  65. package/dist/api/resources/groups/client/requests/ListGroupsRequest.d.ts +10 -5
  66. package/dist/api/resources/groups/types/ListGroupsRequestDefault.d.ts +1 -0
  67. package/dist/api/resources/groups/types/ListGroupsRequestDefault.js +1 -0
  68. package/dist/api/resources/groups/types/ListGroupsRequestOrder.d.ts +1 -0
  69. package/dist/api/resources/groups/types/ListGroupsRequestOrder.js +1 -0
  70. package/dist/api/resources/groups/types/ListGroupsRequestSort.d.ts +1 -1
  71. package/dist/api/resources/groups/types/ListGroupsRequestSort.js +1 -1
  72. package/dist/api/resources/index.d.ts +0 -1
  73. package/dist/api/resources/index.js +0 -1
  74. package/dist/api/resources/links/client/Client.d.ts +17 -5
  75. package/dist/api/resources/links/client/Client.js +37 -11
  76. package/dist/api/resources/links/client/requests/CreateLinksRequest.d.ts +6 -2
  77. package/dist/api/resources/links/client/requests/DeleteLinksRequest.d.ts +1 -1
  78. package/dist/api/resources/links/client/requests/GetLinksRequest.d.ts +1 -1
  79. package/dist/api/resources/links/client/requests/ListLinksRequest.d.ts +12 -5
  80. package/dist/api/resources/links/client/requests/UpdateLinksRequest.d.ts +6 -2
  81. package/dist/api/resources/links/types/ListLinksRequestOrder.d.ts +1 -0
  82. package/dist/api/resources/links/types/ListLinksRequestOrder.js +1 -0
  83. package/dist/api/resources/links/types/ListLinksRequestSort.d.ts +1 -1
  84. package/dist/api/resources/links/types/ListLinksRequestSort.js +1 -1
  85. package/dist/api/resources/partners/client/Client.d.ts +39 -10
  86. package/dist/api/resources/partners/client/Client.js +66 -21
  87. package/dist/api/resources/partners/client/requests/ApprovePartnersRequest.d.ts +1 -1
  88. package/dist/api/resources/partners/client/requests/BulkApprovePartnersRequest.d.ts +2 -2
  89. package/dist/api/resources/partners/client/requests/BulkRejectPartnersRequest.d.ts +4 -2
  90. package/dist/api/resources/partners/client/requests/CreatePartnersRequest.d.ts +21 -7
  91. package/dist/api/resources/partners/client/requests/CreatePartnersRequest.js +1 -0
  92. package/dist/api/resources/partners/client/requests/GetPartnersRequest.d.ts +1 -1
  93. package/dist/api/resources/partners/client/requests/ListPartnersRequest.d.ts +11 -5
  94. package/dist/api/resources/partners/client/requests/RejectPartnersRequest.d.ts +2 -1
  95. package/dist/api/resources/partners/client/requests/SuspendPartnersRequest.d.ts +2 -1
  96. package/dist/api/resources/partners/client/requests/UpdatePartnersRequest.d.ts +10 -2
  97. package/dist/api/resources/partners/types/ListPartnersRequestOrder.d.ts +1 -0
  98. package/dist/api/resources/partners/types/ListPartnersRequestOrder.js +1 -0
  99. package/dist/api/resources/partners/types/ListPartnersRequestSort.d.ts +1 -1
  100. package/dist/api/resources/partners/types/ListPartnersRequestSort.js +1 -1
  101. package/dist/api/resources/partners/types/ListPartnersRequestStatus.d.ts +1 -0
  102. package/dist/api/resources/partners/types/ListPartnersRequestStatus.js +1 -0
  103. package/dist/api/resources/programs/client/Client.d.ts +7 -1
  104. package/dist/api/resources/programs/client/Client.js +13 -3
  105. package/dist/api/resources/programs/client/requests/GetProgramsRequest.d.ts +1 -1
  106. package/dist/api/resources/programs/client/requests/ListProgramsRequest.d.ts +8 -5
  107. package/dist/api/resources/programs/types/ListProgramsRequestOrder.d.ts +1 -0
  108. package/dist/api/resources/programs/types/ListProgramsRequestOrder.js +1 -0
  109. package/dist/api/resources/programs/types/ListProgramsRequestSort.d.ts +1 -1
  110. package/dist/api/resources/programs/types/ListProgramsRequestSort.js +1 -1
  111. package/dist/api/resources/promotionCodes/client/Client.d.ts +27 -5
  112. package/dist/api/resources/promotionCodes/client/Client.js +46 -10
  113. package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodesRequest.d.ts +9 -2
  114. package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodesRequest.js +1 -0
  115. package/dist/api/resources/promotionCodes/client/requests/DeletePromotionCodesRequest.d.ts +1 -1
  116. package/dist/api/resources/promotionCodes/client/requests/GetPromotionCodesRequest.d.ts +1 -1
  117. package/dist/api/resources/promotionCodes/client/requests/ListPromotionCodesRequest.d.ts +11 -5
  118. package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodesRequest.d.ts +8 -1
  119. package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodesRequest.js +1 -0
  120. package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestOrder.d.ts +1 -0
  121. package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestOrder.js +1 -0
  122. package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.d.ts +1 -1
  123. package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.js +1 -1
  124. package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestType.d.ts +1 -0
  125. package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestType.js +1 -0
  126. package/dist/api/resources/reports/client/Client.d.ts +15 -0
  127. package/dist/api/resources/reports/client/Client.js +30 -5
  128. package/dist/api/resources/reports/client/requests/CustomerStatsReportsRequest.d.ts +3 -0
  129. package/dist/api/resources/reports/client/requests/LinksReportsRequest.d.ts +8 -0
  130. package/dist/api/resources/reports/client/requests/OverviewReportsRequest.d.ts +3 -0
  131. package/dist/api/resources/reports/client/requests/PartnersReportsRequest.d.ts +8 -0
  132. package/dist/api/resources/reports/client/requests/TimeseriesReportsRequest.d.ts +5 -0
  133. package/dist/api/resources/reports/types/LinksReportsRequestOrder.d.ts +1 -0
  134. package/dist/api/resources/reports/types/LinksReportsRequestOrder.js +1 -0
  135. package/dist/api/resources/reports/types/LinksReportsRequestSort.d.ts +1 -0
  136. package/dist/api/resources/reports/types/LinksReportsRequestSort.js +1 -0
  137. package/dist/api/resources/reports/types/PartnersReportsRequestOrder.d.ts +1 -0
  138. package/dist/api/resources/reports/types/PartnersReportsRequestOrder.js +1 -0
  139. package/dist/api/resources/reports/types/PartnersReportsRequestSort.d.ts +1 -0
  140. package/dist/api/resources/reports/types/PartnersReportsRequestSort.js +1 -0
  141. package/dist/api/resources/reports/types/TimeseriesReportsRequestGranularity.d.ts +1 -0
  142. package/dist/api/resources/reports/types/TimeseriesReportsRequestGranularity.js +1 -0
  143. package/dist/api/resources/transactions/client/Client.d.ts +30 -7
  144. package/dist/api/resources/transactions/client/Client.js +53 -14
  145. package/dist/api/resources/transactions/client/requests/CreateTransactionsRequest.d.ts +17 -3
  146. package/dist/api/resources/transactions/client/requests/DeleteTransactionsRequest.d.ts +1 -1
  147. package/dist/api/resources/transactions/client/requests/GetTransactionsRequest.d.ts +1 -1
  148. package/dist/api/resources/transactions/client/requests/ListTransactionsRequest.d.ts +12 -5
  149. package/dist/api/resources/transactions/client/requests/RefundTransactionsRequest.d.ts +1 -1
  150. package/dist/api/resources/transactions/client/requests/RerunFlowsTransactionsRequest.d.ts +1 -1
  151. package/dist/api/resources/transactions/client/requests/UpdateTransactionsRequest.d.ts +13 -2
  152. package/dist/api/resources/transactions/types/ListTransactionsRequestOrder.d.ts +1 -0
  153. package/dist/api/resources/transactions/types/ListTransactionsRequestOrder.js +1 -0
  154. package/dist/api/resources/transactions/types/ListTransactionsRequestSort.d.ts +1 -1
  155. package/dist/api/resources/transactions/types/ListTransactionsRequestSort.js +1 -1
  156. package/dist/api/types/Commission.d.ts +1 -1
  157. package/dist/api/types/Customer.d.ts +2 -2
  158. package/dist/api/types/Error_.d.ts +1 -0
  159. package/dist/api/types/Error_.js +1 -0
  160. package/dist/environments.d.ts +2 -2
  161. package/dist/environments.js +1 -1
  162. package/package.json +1 -1
  163. package/dist/api/resources/embed/client/requests/CreateTokenEmbedRequest.d.ts +0 -14
  164. package/dist/api/resources/embed/client/requests/index.d.ts +0 -1
  165. package/dist/api/resources/embed/client/requests/index.js +0 -1
  166. /package/dist/api/resources/embed/{client/requests → types}/CreateTokenEmbedRequest.js +0 -0
@@ -12,11 +12,14 @@ export class CustomersClient {
12
12
  this._options = normalizeClientOptionsWithAuth(options);
13
13
  }
14
14
  /**
15
+ * Lists customers. Filter by program, partner, link, click, status or your own customer_id, and page with cursors.
16
+ *
15
17
  * @param {ToltApi.ListCustomersRequest} request
16
18
  * @param {CustomersClient.RequestOptions} requestOptions - Request-specific configuration.
17
19
  *
18
20
  * @throws {@link ToltApi.BadRequestError}
19
21
  * @throws {@link ToltApi.UnauthorizedError}
22
+ * @throws {@link ToltApi.ContentTooLargeError}
20
23
  * @throws {@link ToltApi.TooManyRequestsError}
21
24
  * @throws {@link errors.ToltApiError}
22
25
  * @throws {@link errors.ToltApiTimeoutError}
@@ -52,7 +55,7 @@ export class CustomersClient {
52
55
  const _response = await core.fetcher({
53
56
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
54
57
  (await core.Supplier.get(this._options.environment)) ??
55
- environments.ToltApiEnvironment.Production, "v2/customers"),
58
+ environments.ToltApiEnvironment.Default, "v2/customers"),
56
59
  method: "GET",
57
60
  headers: _headers,
58
61
  queryString: core.url
@@ -75,6 +78,8 @@ export class CustomersClient {
75
78
  throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
76
79
  case 401:
77
80
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
81
+ case 413:
82
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
78
83
  case 429:
79
84
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
80
85
  default:
@@ -88,18 +93,27 @@ export class CustomersClient {
88
93
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/customers");
89
94
  }
90
95
  /**
96
+ * Creates a customer attributed to a partner. Pass partner_id or link_id, and optionally the click_id that brought them in.
97
+ *
91
98
  * @param {ToltApi.CreateCustomersRequest} request
92
99
  * @param {CustomersClient.RequestOptions} requestOptions - Request-specific configuration.
93
100
  *
94
101
  * @throws {@link ToltApi.BadRequestError}
95
102
  * @throws {@link ToltApi.UnauthorizedError}
96
103
  * @throws {@link ToltApi.ConflictError}
104
+ * @throws {@link ToltApi.ContentTooLargeError}
97
105
  * @throws {@link ToltApi.TooManyRequestsError}
98
106
  * @throws {@link errors.ToltApiError}
99
107
  * @throws {@link errors.ToltApiTimeoutError}
100
108
  *
101
109
  * @example
102
- * await client.customers.create()
110
+ * await client.customers.create({
111
+ * email: "alex@example.com",
112
+ * name: "Alex Morgan",
113
+ * customer_id: "user_4821",
114
+ * link_id: "lnk_mtTeeckFa1vMdvDFXretQNs6",
115
+ * partner_id: "part_NLYzgNKuSuASvrvoxNtau6SY"
116
+ * })
103
117
  */
104
118
  create(request = {}, requestOptions) {
105
119
  return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
@@ -110,7 +124,7 @@ export class CustomersClient {
110
124
  const _response = await core.fetcher({
111
125
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
112
126
  (await core.Supplier.get(this._options.environment)) ??
113
- environments.ToltApiEnvironment.Production, "v2/customers"),
127
+ environments.ToltApiEnvironment.Default, "v2/customers"),
114
128
  method: "POST",
115
129
  headers: _headers,
116
130
  contentType: "application/json",
@@ -134,6 +148,8 @@ export class CustomersClient {
134
148
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
135
149
  case 409:
136
150
  throw new ToltApi.ConflictError(_response.error.body, _response.rawResponse);
151
+ case 413:
152
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
137
153
  case 429:
138
154
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
139
155
  default:
@@ -147,18 +163,21 @@ export class CustomersClient {
147
163
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/customers");
148
164
  }
149
165
  /**
166
+ * Gets a customer by ID, with its status, the partner it is attributed to and your own customer and subscription IDs.
167
+ *
150
168
  * @param {ToltApi.GetCustomersRequest} request
151
169
  * @param {CustomersClient.RequestOptions} requestOptions - Request-specific configuration.
152
170
  *
153
171
  * @throws {@link ToltApi.UnauthorizedError}
154
172
  * @throws {@link ToltApi.NotFoundError}
173
+ * @throws {@link ToltApi.ContentTooLargeError}
155
174
  * @throws {@link ToltApi.TooManyRequestsError}
156
175
  * @throws {@link errors.ToltApiError}
157
176
  * @throws {@link errors.ToltApiTimeoutError}
158
177
  *
159
178
  * @example
160
179
  * await client.customers.get({
161
- * id: "id"
180
+ * id: "cus_LBfjvtfct9pVUeLojMHiGnXv"
162
181
  * })
163
182
  */
164
183
  get(request, requestOptions) {
@@ -171,7 +190,7 @@ export class CustomersClient {
171
190
  const _response = await core.fetcher({
172
191
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
173
192
  (await core.Supplier.get(this._options.environment)) ??
174
- environments.ToltApiEnvironment.Production, `v2/customers/${core.url.encodePathParam(id)}`),
193
+ environments.ToltApiEnvironment.Default, `v2/customers/${core.url.encodePathParam(id)}`),
175
194
  method: "GET",
176
195
  headers: _headers,
177
196
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
@@ -190,6 +209,8 @@ export class CustomersClient {
190
209
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
191
210
  case 404:
192
211
  throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
212
+ case 413:
213
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
193
214
  case 429:
194
215
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
195
216
  default:
@@ -203,6 +224,8 @@ export class CustomersClient {
203
224
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/customers/{id}");
204
225
  }
205
226
  /**
227
+ * Updates a customer's name, email, status, your own IDs, or the click and link the customer came from.
228
+ *
206
229
  * @param {ToltApi.UpdateCustomersRequest} request
207
230
  * @param {CustomersClient.RequestOptions} requestOptions - Request-specific configuration.
208
231
  *
@@ -210,13 +233,16 @@ export class CustomersClient {
210
233
  * @throws {@link ToltApi.UnauthorizedError}
211
234
  * @throws {@link ToltApi.NotFoundError}
212
235
  * @throws {@link ToltApi.ConflictError}
236
+ * @throws {@link ToltApi.ContentTooLargeError}
213
237
  * @throws {@link ToltApi.TooManyRequestsError}
214
238
  * @throws {@link errors.ToltApiError}
215
239
  * @throws {@link errors.ToltApiTimeoutError}
216
240
  *
217
241
  * @example
218
242
  * await client.customers.update({
219
- * id: "id"
243
+ * id: "cus_LBfjvtfct9pVUeLojMHiGnXv",
244
+ * name: "Alex Morgan",
245
+ * status: "active"
220
246
  * })
221
247
  */
222
248
  update(request, requestOptions) {
@@ -229,7 +255,7 @@ export class CustomersClient {
229
255
  const _response = await core.fetcher({
230
256
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
231
257
  (await core.Supplier.get(this._options.environment)) ??
232
- environments.ToltApiEnvironment.Production, `v2/customers/${core.url.encodePathParam(id)}`),
258
+ environments.ToltApiEnvironment.Default, `v2/customers/${core.url.encodePathParam(id)}`),
233
259
  method: "PUT",
234
260
  headers: _headers,
235
261
  contentType: "application/json",
@@ -255,6 +281,8 @@ export class CustomersClient {
255
281
  throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
256
282
  case 409:
257
283
  throw new ToltApi.ConflictError(_response.error.body, _response.rawResponse);
284
+ case 413:
285
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
258
286
  case 429:
259
287
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
260
288
  default:
@@ -268,19 +296,22 @@ export class CustomersClient {
268
296
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v2/customers/{id}");
269
297
  }
270
298
  /**
299
+ * Deletes a customer. Fails when any of the customer's commissions is paid or already included in a payout.
300
+ *
271
301
  * @param {ToltApi.DeleteCustomersRequest} request
272
302
  * @param {CustomersClient.RequestOptions} requestOptions - Request-specific configuration.
273
303
  *
274
304
  * @throws {@link ToltApi.BadRequestError}
275
305
  * @throws {@link ToltApi.UnauthorizedError}
276
306
  * @throws {@link ToltApi.NotFoundError}
307
+ * @throws {@link ToltApi.ContentTooLargeError}
277
308
  * @throws {@link ToltApi.TooManyRequestsError}
278
309
  * @throws {@link errors.ToltApiError}
279
310
  * @throws {@link errors.ToltApiTimeoutError}
280
311
  *
281
312
  * @example
282
313
  * await client.customers.delete({
283
- * id: "id"
314
+ * id: "cus_LBfjvtfct9pVUeLojMHiGnXv"
284
315
  * })
285
316
  */
286
317
  delete(request, requestOptions) {
@@ -293,7 +324,7 @@ export class CustomersClient {
293
324
  const _response = await core.fetcher({
294
325
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
295
326
  (await core.Supplier.get(this._options.environment)) ??
296
- environments.ToltApiEnvironment.Production, `v2/customers/${core.url.encodePathParam(id)}`),
327
+ environments.ToltApiEnvironment.Default, `v2/customers/${core.url.encodePathParam(id)}`),
297
328
  method: "DELETE",
298
329
  headers: _headers,
299
330
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
@@ -314,6 +345,8 @@ export class CustomersClient {
314
345
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
315
346
  case 404:
316
347
  throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
348
+ case 413:
349
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
317
350
  case 429:
318
351
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
319
352
  default:
@@ -1,23 +1,41 @@
1
1
  /**
2
2
  * @example
3
- * {}
3
+ * {
4
+ * email: "alex@example.com",
5
+ * name: "Alex Morgan",
6
+ * customer_id: "user_4821",
7
+ * link_id: "lnk_mtTeeckFa1vMdvDFXretQNs6",
8
+ * partner_id: "part_NLYzgNKuSuASvrvoxNtau6SY"
9
+ * }
4
10
  */
5
11
  export interface CreateCustomersRequest {
12
+ /** Customer's email, stored lowercased and used as their identifier. It must not belong to another customer. Provide this or customer_id. */
6
13
  email?: string;
7
- /** Resolve a code in the partner’s program, preferring partner, group, then program scope. An unmatched code leaves attribution unchanged. */
14
+ /** Resolve a code in the partner’s program, ignoring case, preferring partner, group, then program scope. An unmatched code leaves attribution unchanged. */
8
15
  promotion_code?: string;
16
+ /** When the customer was created, for backdating. Defaults to now; lead_at, and active_at for active customers, default to it. */
9
17
  created_at?: string;
18
+ /** Customer's full name as you want it shown in the dashboard; it does not affect attribution or matching. */
10
19
  name?: string;
20
+ /** Customer's id in your billing system, such as a Stripe customer id. The billing integration matches payments to this customer by it. Provide this or email. */
11
21
  customer_id?: string;
22
+ /** Lifecycle stage of the customer. Defaults to lead (signed up, not paying yet); recording a transaction for the customer makes them active. */
12
23
  status?: CreateCustomersRequest.Status;
24
+ /** Customer's subscription id in your billing system, such as a Stripe subscription id. */
13
25
  subscription_id?: string;
26
+ /** Id of the tracked click the customer came from, as returned when listing clicks. It must belong to the partner, and its link is used when link_id is omitted. */
14
27
  click_id?: string;
28
+ /** Id of the referral link the customer came through (lnk_...). Without partner_id the link's partner is used; with it, the link must belong to that partner. */
15
29
  link_id?: string;
30
+ /** Id of the partner who referred the customer (part_...), as returned when listing partners. The customer joins that partner's program. Provide this or link_id. */
16
31
  partner_id?: string;
32
+ /** When the customer signed up as a lead, as a timestamp with a time zone, for example 2026-03-01T12:00:00Z. Defaults to created_at. */
17
33
  lead_at?: string | null;
34
+ /** When the customer became a paying customer, as a timestamp with a time zone. Defaults to created_at when status is active, otherwise it is set when a transaction is recorded for the customer. */
18
35
  active_at?: string | null;
19
36
  }
20
37
  export declare namespace CreateCustomersRequest {
38
+ /** Lifecycle stage of the customer. Defaults to lead (signed up, not paying yet); recording a transaction for the customer makes them active. */
21
39
  const Status: {
22
40
  readonly Lead: "lead";
23
41
  readonly Active: "active";
@@ -1,6 +1,7 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  export var CreateCustomersRequest;
3
3
  (function (CreateCustomersRequest) {
4
+ /** Lifecycle stage of the customer. Defaults to lead (signed up, not paying yet); recording a transaction for the customer makes them active. */
4
5
  CreateCustomersRequest.Status = {
5
6
  Lead: "lead",
6
7
  Active: "active",
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * id: "id"
4
+ * id: "cus_LBfjvtfct9pVUeLojMHiGnXv"
5
5
  * }
6
6
  */
7
7
  export interface DeleteCustomersRequest {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * id: "id"
4
+ * id: "cus_LBfjvtfct9pVUeLojMHiGnXv"
5
5
  * }
6
6
  */
7
7
  export interface GetCustomersRequest {
@@ -4,27 +4,36 @@ import type * as ToltApi from "../../../../index.js";
4
4
  * {}
5
5
  */
6
6
  export interface ListCustomersRequest {
7
+ /** How many rows to return in one page. */
7
8
  limit?: number;
9
+ /** Ranking direction: desc puts the most recently created or updated rows first. */
8
10
  order?: ToltApi.ListCustomersRequestOrder;
9
- /** Column the list is ordered and paged by. */
11
+ /** Timestamp to order and page by: created_at follows creation order, updated_at follows each item's most recent change. */
10
12
  sort?: ToltApi.ListCustomersRequestSort;
11
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. */
12
14
  starting_after?: string;
13
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. */
14
16
  ending_before?: string;
15
- /** Only items created at or after this ISO 8601 time. */
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. */
16
18
  created_after?: string;
17
- /** Only items created before this ISO 8601 time. */
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. */
18
20
  created_before?: string;
19
- /** Only items updated at or after this ISO 8601 time. Combine with sort=updated_at to sync changes. */
21
+ /** Only items last changed at or after this moment; with sort=updated_at, use it to fetch what changed since a previous sync. */
20
22
  updated_after?: string;
21
- /** Only items updated before this ISO 8601 time. */
23
+ /** Only items last changed before this moment; pair it with updated_after to fetch what changed in a period. */
22
24
  updated_before?: string;
25
+ /** Limit to one program, by its id (prg_...) as returned when listing programs. */
23
26
  program_id?: string;
27
+ /** Limit to one partner, by its id (part_...) as returned when listing partners. */
24
28
  partner_id?: string;
29
+ /** Exact match on the customer's customer_id field, the id the customer has in your own system or billing provider; not the Tolt customer id. */
25
30
  customer_id?: string;
31
+ /** Keep only customers at this lifecycle stage, from signed-up leads through trials to paying, canceled or suspended customers. Leave it out to include every stage. */
26
32
  status?: ToltApi.ListCustomersRequestStatus;
33
+ /** Text matched anywhere in the customer's email, name, identifier or customer_id, ignoring case. */
27
34
  search?: string;
35
+ /** Only the customers attributed to this click, by its id (clk_...). */
28
36
  click_id?: string;
37
+ /** Only customers attributed to this referral link (lnk_...), directly or through one of its clicks. */
29
38
  link_id?: string;
30
39
  }
@@ -1,25 +1,38 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * id: "id"
4
+ * id: "cus_LBfjvtfct9pVUeLojMHiGnXv",
5
+ * name: "Alex Morgan",
6
+ * status: "active"
5
7
  * }
6
8
  */
7
9
  export interface UpdateCustomersRequest {
8
10
  id: string;
11
+ /** New email, stored lowercased and used as the customer's identifier. It must not belong to another customer. */
9
12
  email?: string;
10
- /** Resolve a code in the partner’s program, preferring partner, group, then program scope. An unmatched code leaves attribution unchanged. Null clears the promotion code and its derived attribution. */
13
+ /** Resolve a code in the partner’s program, ignoring case, preferring partner, group, then program scope. An unmatched code leaves attribution unchanged. Null clears the promotion code and its derived attribution. */
11
14
  promotion_code?: string | null;
15
+ /** When the customer was created, as a timestamp with a time zone, for example 2026-03-01T12:00:00Z. Reports and filters that date customers by creation use it; those that date them by conversion read active_at, which this does not change. */
12
16
  created_at?: string;
17
+ /** Customer's full name as you want it shown in the dashboard; it does not affect attribution or matching. */
13
18
  name?: string | null;
19
+ /** Lifecycle stage of the customer. Changing it does not set active_at or run commission flows. */
14
20
  status?: UpdateCustomersRequest.Status | null;
21
+ /** Customer's id in your billing system, such as a Stripe customer id. The billing integration matches payments to this customer by it. */
15
22
  customer_id?: string;
23
+ /** Customer's subscription id in your billing system, such as a Stripe subscription id. */
16
24
  subscription_id?: string | null;
25
+ /** Id of the tracked click the customer came from, as returned when listing clicks. It must belong to the customer's partner; link_id is not changed. */
17
26
  click_id?: string | null;
27
+ /** Id of the referral link the customer came through (lnk_...). It must belong to the customer's partner; a customer without a partner takes the link's partner and program. */
18
28
  link_id?: string | null;
29
+ /** When the customer signed up as a lead, as a timestamp with a time zone, for example 2026-03-01T12:00:00Z. */
19
30
  lead_at?: string | null;
31
+ /** When the customer became a paying customer, as a timestamp with a time zone. */
20
32
  active_at?: string | null;
21
33
  }
22
34
  export declare namespace UpdateCustomersRequest {
35
+ /** Lifecycle stage of the customer. Changing it does not set active_at or run commission flows. */
23
36
  const Status: {
24
37
  readonly Lead: "lead";
25
38
  readonly Active: "active";
@@ -1,6 +1,7 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
2
  export var UpdateCustomersRequest;
3
3
  (function (UpdateCustomersRequest) {
4
+ /** Lifecycle stage of the customer. Changing it does not set active_at or run commission flows. */
4
5
  UpdateCustomersRequest.Status = {
5
6
  Lead: "lead",
6
7
  Active: "active",
@@ -1,3 +1,4 @@
1
+ /** Ranking direction: desc puts the most recently created or updated rows first. */
1
2
  export declare const ListCustomersRequestOrder: {
2
3
  readonly Asc: "asc";
3
4
  readonly Desc: "desc";
@@ -1,4 +1,5 @@
1
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. */
2
3
  export const ListCustomersRequestOrder = {
3
4
  Asc: "asc",
4
5
  Desc: "desc",
@@ -1,4 +1,4 @@
1
- /** Column the list is ordered and paged by. */
1
+ /** Timestamp to order and page by: created_at follows creation order, updated_at follows each item's most recent change. */
2
2
  export declare const ListCustomersRequestSort: {
3
3
  readonly CreatedAt: "created_at";
4
4
  readonly UpdatedAt: "updated_at";
@@ -1,5 +1,5 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
- /** Column the list is ordered and paged by. */
2
+ /** Timestamp to order and page by: created_at follows creation order, updated_at follows each item's most recent change. */
3
3
  export const ListCustomersRequestSort = {
4
4
  CreatedAt: "created_at",
5
5
  UpdatedAt: "updated_at",
@@ -1,3 +1,4 @@
1
+ /** Keep only customers at this lifecycle stage, from signed-up leads through trials to paying, canceled or suspended customers. Leave it out to include every stage. */
1
2
  export declare const ListCustomersRequestStatus: {
2
3
  readonly Lead: "lead";
3
4
  readonly Active: "active";
@@ -1,4 +1,5 @@
1
1
  // This file was auto-generated by Fern from our API Definition.
2
+ /** Keep only customers at this lifecycle stage, from signed-up leads through trials to paying, canceled or suspended customers. Leave it out to include every stage. */
2
3
  export const ListCustomersRequestStatus = {
3
4
  Lead: "lead",
4
5
  Active: "active",
@@ -19,13 +19,16 @@ export declare class EmbedClient {
19
19
  * @throws {@link ToltApi.BadRequestError}
20
20
  * @throws {@link ToltApi.UnauthorizedError}
21
21
  * @throws {@link ToltApi.NotFoundError}
22
+ * @throws {@link ToltApi.ContentTooLargeError}
22
23
  * @throws {@link ToltApi.TooManyRequestsError}
23
24
  * @throws {@link errors.ToltApiError}
24
25
  * @throws {@link errors.ToltApiTimeoutError}
25
26
  *
26
27
  * @example
27
- * await client.embed.createToken()
28
+ * await client.embed.createToken({
29
+ * "key": "value"
30
+ * })
28
31
  */
29
- createToken(request?: ToltApi.CreateTokenEmbedRequest, requestOptions?: EmbedClient.RequestOptions): core.HttpResponsePromise<ToltApi.CreateTokenEmbedResponse>;
32
+ createToken(request: ToltApi.CreateTokenEmbedRequest, requestOptions?: EmbedClient.RequestOptions): core.HttpResponsePromise<ToltApi.CreateTokenEmbedResponse>;
30
33
  private __createToken;
31
34
  }
@@ -20,23 +20,26 @@ export class EmbedClient {
20
20
  * @throws {@link ToltApi.BadRequestError}
21
21
  * @throws {@link ToltApi.UnauthorizedError}
22
22
  * @throws {@link ToltApi.NotFoundError}
23
+ * @throws {@link ToltApi.ContentTooLargeError}
23
24
  * @throws {@link ToltApi.TooManyRequestsError}
24
25
  * @throws {@link errors.ToltApiError}
25
26
  * @throws {@link errors.ToltApiTimeoutError}
26
27
  *
27
28
  * @example
28
- * await client.embed.createToken()
29
+ * await client.embed.createToken({
30
+ * "key": "value"
31
+ * })
29
32
  */
30
- createToken(request = {}, requestOptions) {
33
+ createToken(request, requestOptions) {
31
34
  return core.HttpResponsePromise.fromPromise(this.__createToken(request, requestOptions));
32
35
  }
33
- async __createToken(request = {}, requestOptions) {
36
+ async __createToken(request, requestOptions) {
34
37
  const _authRequest = await this._options.authProvider.getAuthRequest();
35
38
  const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
36
39
  const _response = await core.fetcher({
37
40
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
38
41
  (await core.Supplier.get(this._options.environment)) ??
39
- environments.ToltApiEnvironment.Production, "v2/embed-tokens"),
42
+ environments.ToltApiEnvironment.Default, "v2/embed-tokens"),
40
43
  method: "POST",
41
44
  headers: _headers,
42
45
  contentType: "application/json",
@@ -60,6 +63,8 @@ export class EmbedClient {
60
63
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
61
64
  case 404:
62
65
  throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
66
+ case 413:
67
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
63
68
  case 429:
64
69
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
65
70
  default:
@@ -1 +1 @@
1
- export * from "./requests/index.js";
1
+ export {};
@@ -1 +1 @@
1
- export * from "./requests/index.js";
1
+ export {};
@@ -0,0 +1 @@
1
+ export type CreateTokenEmbedRequest = unknown;
@@ -1 +1,2 @@
1
+ export * from "./CreateTokenEmbedRequest.js";
1
2
  export * from "./CreateTokenEmbedResponse.js";
@@ -1 +1,2 @@
1
+ export * from "./CreateTokenEmbedRequest.js";
1
2
  export * from "./CreateTokenEmbedResponse.js";
@@ -11,11 +11,14 @@ export declare class FlowsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<FlowsClient.Options>;
12
12
  constructor(options: FlowsClient.Options);
13
13
  /**
14
+ * Lists flows. Filter by program, group, campaign, event or active state, and page with cursors.
15
+ *
14
16
  * @param {ToltApi.ListFlowsRequest} request
15
17
  * @param {FlowsClient.RequestOptions} requestOptions - Request-specific configuration.
16
18
  *
17
19
  * @throws {@link ToltApi.BadRequestError}
18
20
  * @throws {@link ToltApi.UnauthorizedError}
21
+ * @throws {@link ToltApi.ContentTooLargeError}
19
22
  * @throws {@link ToltApi.TooManyRequestsError}
20
23
  * @throws {@link errors.ToltApiError}
21
24
  * @throws {@link errors.ToltApiTimeoutError}
@@ -26,18 +29,21 @@ export declare class FlowsClient {
26
29
  list(request?: ToltApi.ListFlowsRequest, requestOptions?: FlowsClient.RequestOptions): core.HttpResponsePromise<ToltApi.ListFlowsResponse>;
27
30
  private __list;
28
31
  /**
32
+ * Gets a flow by ID, with the event it runs on, its conditions and its action: a commission to generate or a group to move the partner to.
33
+ *
29
34
  * @param {ToltApi.GetFlowsRequest} request
30
35
  * @param {FlowsClient.RequestOptions} requestOptions - Request-specific configuration.
31
36
  *
32
37
  * @throws {@link ToltApi.UnauthorizedError}
33
38
  * @throws {@link ToltApi.NotFoundError}
39
+ * @throws {@link ToltApi.ContentTooLargeError}
34
40
  * @throws {@link ToltApi.TooManyRequestsError}
35
41
  * @throws {@link errors.ToltApiError}
36
42
  * @throws {@link errors.ToltApiTimeoutError}
37
43
  *
38
44
  * @example
39
45
  * await client.flows.get({
40
- * id: "id"
46
+ * id: "flw_fAyK6FQ6EZngabgw8JifzQgN"
41
47
  * })
42
48
  */
43
49
  get(request: ToltApi.GetFlowsRequest, requestOptions?: FlowsClient.RequestOptions): core.HttpResponsePromise<ToltApi.GetFlowsResponse>;
@@ -11,11 +11,14 @@ export class FlowsClient {
11
11
  this._options = normalizeClientOptionsWithAuth(options);
12
12
  }
13
13
  /**
14
+ * Lists flows. Filter by program, group, campaign, event or active state, and page with cursors.
15
+ *
14
16
  * @param {ToltApi.ListFlowsRequest} request
15
17
  * @param {FlowsClient.RequestOptions} requestOptions - Request-specific configuration.
16
18
  *
17
19
  * @throws {@link ToltApi.BadRequestError}
18
20
  * @throws {@link ToltApi.UnauthorizedError}
21
+ * @throws {@link ToltApi.ContentTooLargeError}
19
22
  * @throws {@link ToltApi.TooManyRequestsError}
20
23
  * @throws {@link errors.ToltApiError}
21
24
  * @throws {@link errors.ToltApiTimeoutError}
@@ -50,7 +53,7 @@ export class FlowsClient {
50
53
  const _response = await core.fetcher({
51
54
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
52
55
  (await core.Supplier.get(this._options.environment)) ??
53
- environments.ToltApiEnvironment.Production, "v2/flows"),
56
+ environments.ToltApiEnvironment.Default, "v2/flows"),
54
57
  method: "GET",
55
58
  headers: _headers,
56
59
  queryString: core.url
@@ -73,6 +76,8 @@ export class FlowsClient {
73
76
  throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
74
77
  case 401:
75
78
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
79
+ case 413:
80
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
76
81
  case 429:
77
82
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
78
83
  default:
@@ -86,18 +91,21 @@ export class FlowsClient {
86
91
  return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/flows");
87
92
  }
88
93
  /**
94
+ * Gets a flow by ID, with the event it runs on, its conditions and its action: a commission to generate or a group to move the partner to.
95
+ *
89
96
  * @param {ToltApi.GetFlowsRequest} request
90
97
  * @param {FlowsClient.RequestOptions} requestOptions - Request-specific configuration.
91
98
  *
92
99
  * @throws {@link ToltApi.UnauthorizedError}
93
100
  * @throws {@link ToltApi.NotFoundError}
101
+ * @throws {@link ToltApi.ContentTooLargeError}
94
102
  * @throws {@link ToltApi.TooManyRequestsError}
95
103
  * @throws {@link errors.ToltApiError}
96
104
  * @throws {@link errors.ToltApiTimeoutError}
97
105
  *
98
106
  * @example
99
107
  * await client.flows.get({
100
- * id: "id"
108
+ * id: "flw_fAyK6FQ6EZngabgw8JifzQgN"
101
109
  * })
102
110
  */
103
111
  get(request, requestOptions) {
@@ -110,7 +118,7 @@ export class FlowsClient {
110
118
  const _response = await core.fetcher({
111
119
  url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
112
120
  (await core.Supplier.get(this._options.environment)) ??
113
- environments.ToltApiEnvironment.Production, `v2/flows/${core.url.encodePathParam(id)}`),
121
+ environments.ToltApiEnvironment.Default, `v2/flows/${core.url.encodePathParam(id)}`),
114
122
  method: "GET",
115
123
  headers: _headers,
116
124
  queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
@@ -129,6 +137,8 @@ export class FlowsClient {
129
137
  throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
130
138
  case 404:
131
139
  throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
140
+ case 413:
141
+ throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
132
142
  case 429:
133
143
  throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
134
144
  default:
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * @example
3
3
  * {
4
- * id: "id"
4
+ * id: "flw_fAyK6FQ6EZngabgw8JifzQgN"
5
5
  * }
6
6
  */
7
7
  export interface GetFlowsRequest {