@tolt/api 0.6.0 → 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.
- package/README.md +2 -2
- package/dist/api/errors/ContentTooLargeError.d.ts +7 -0
- package/dist/api/errors/ContentTooLargeError.js +17 -0
- package/dist/api/errors/index.d.ts +1 -0
- package/dist/api/errors/index.js +1 -0
- package/dist/api/resources/clicks/client/Client.d.ts +6 -1
- package/dist/api/resources/clicks/client/Client.js +15 -4
- package/dist/api/resources/clicks/client/requests/GetClicksRequest.d.ts +1 -1
- package/dist/api/resources/clicks/client/requests/ListClicksRequest.d.ts +10 -5
- package/dist/api/resources/clicks/types/ListClicksRequestOrder.d.ts +1 -0
- package/dist/api/resources/clicks/types/ListClicksRequestOrder.js +1 -0
- package/dist/api/resources/clicks/types/ListClicksRequestSort.d.ts +1 -1
- package/dist/api/resources/clicks/types/ListClicksRequestSort.js +1 -1
- package/dist/api/resources/commissions/client/Client.d.ts +29 -7
- package/dist/api/resources/commissions/client/Client.js +56 -16
- package/dist/api/resources/commissions/client/requests/ApproveCommissionsRequest.d.ts +1 -1
- package/dist/api/resources/commissions/client/requests/BulkApproveCommissionsRequest.d.ts +2 -2
- package/dist/api/resources/commissions/client/requests/BulkDeclineCommissionsRequest.d.ts +2 -2
- package/dist/api/resources/commissions/client/requests/DeclineCommissionsRequest.d.ts +1 -1
- package/dist/api/resources/commissions/client/requests/DeleteCommissionsRequest.d.ts +1 -1
- package/dist/api/resources/commissions/client/requests/GetCommissionsRequest.d.ts +1 -1
- package/dist/api/resources/commissions/client/requests/ListCommissionsRequest.d.ts +14 -5
- package/dist/api/resources/commissions/client/requests/UpdateCommissionsRequest.d.ts +19 -4
- package/dist/api/resources/commissions/client/requests/UpdateCommissionsRequest.js +8 -1
- package/dist/api/resources/commissions/client/requests/index.d.ts +1 -1
- package/dist/api/resources/commissions/client/requests/index.js +1 -1
- package/dist/api/resources/commissions/types/ListCommissionsRequestOrder.d.ts +1 -0
- package/dist/api/resources/commissions/types/ListCommissionsRequestOrder.js +1 -0
- package/dist/api/resources/commissions/types/ListCommissionsRequestSort.d.ts +1 -1
- package/dist/api/resources/commissions/types/ListCommissionsRequestSort.js +1 -1
- package/dist/api/resources/customers/client/Client.d.ts +27 -4
- package/dist/api/resources/customers/client/Client.js +42 -9
- package/dist/api/resources/customers/client/requests/CreateCustomersRequest.d.ts +20 -2
- package/dist/api/resources/customers/client/requests/CreateCustomersRequest.js +1 -0
- package/dist/api/resources/customers/client/requests/DeleteCustomersRequest.d.ts +1 -1
- package/dist/api/resources/customers/client/requests/GetCustomersRequest.d.ts +1 -1
- package/dist/api/resources/customers/client/requests/ListCustomersRequest.d.ts +14 -5
- package/dist/api/resources/customers/client/requests/UpdateCustomersRequest.d.ts +15 -2
- package/dist/api/resources/customers/client/requests/UpdateCustomersRequest.js +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestOrder.d.ts +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestOrder.js +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestSort.d.ts +1 -1
- package/dist/api/resources/customers/types/ListCustomersRequestSort.js +1 -1
- package/dist/api/resources/customers/types/ListCustomersRequestStatus.d.ts +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestStatus.js +1 -0
- package/dist/api/resources/embed/client/Client.d.ts +5 -2
- package/dist/api/resources/embed/client/Client.js +9 -4
- package/dist/api/resources/embed/client/index.d.ts +1 -1
- package/dist/api/resources/embed/client/index.js +1 -1
- package/dist/api/resources/embed/types/CreateTokenEmbedRequest.d.ts +1 -0
- package/dist/api/resources/embed/types/index.d.ts +1 -0
- package/dist/api/resources/embed/types/index.js +1 -0
- package/dist/api/resources/flows/client/Client.d.ts +7 -1
- package/dist/api/resources/flows/client/Client.js +13 -3
- package/dist/api/resources/flows/client/requests/GetFlowsRequest.d.ts +1 -1
- package/dist/api/resources/flows/client/requests/ListFlowsRequest.d.ts +13 -5
- package/dist/api/resources/flows/types/ListFlowsRequestActive.d.ts +1 -0
- package/dist/api/resources/flows/types/ListFlowsRequestActive.js +1 -0
- package/dist/api/resources/flows/types/ListFlowsRequestOrder.d.ts +1 -0
- package/dist/api/resources/flows/types/ListFlowsRequestOrder.js +1 -0
- package/dist/api/resources/flows/types/ListFlowsRequestSort.d.ts +1 -1
- package/dist/api/resources/flows/types/ListFlowsRequestSort.js +1 -1
- package/dist/api/resources/groups/client/Client.d.ts +7 -1
- package/dist/api/resources/groups/client/Client.js +13 -3
- package/dist/api/resources/groups/client/requests/GetGroupsRequest.d.ts +1 -1
- package/dist/api/resources/groups/client/requests/ListGroupsRequest.d.ts +10 -5
- package/dist/api/resources/groups/types/ListGroupsRequestDefault.d.ts +1 -0
- package/dist/api/resources/groups/types/ListGroupsRequestDefault.js +1 -0
- package/dist/api/resources/groups/types/ListGroupsRequestOrder.d.ts +1 -0
- package/dist/api/resources/groups/types/ListGroupsRequestOrder.js +1 -0
- package/dist/api/resources/groups/types/ListGroupsRequestSort.d.ts +1 -1
- package/dist/api/resources/groups/types/ListGroupsRequestSort.js +1 -1
- package/dist/api/resources/index.d.ts +0 -1
- package/dist/api/resources/index.js +0 -1
- package/dist/api/resources/links/client/Client.d.ts +17 -5
- package/dist/api/resources/links/client/Client.js +37 -11
- package/dist/api/resources/links/client/requests/CreateLinksRequest.d.ts +6 -2
- package/dist/api/resources/links/client/requests/DeleteLinksRequest.d.ts +1 -1
- package/dist/api/resources/links/client/requests/GetLinksRequest.d.ts +1 -1
- package/dist/api/resources/links/client/requests/ListLinksRequest.d.ts +12 -5
- package/dist/api/resources/links/client/requests/UpdateLinksRequest.d.ts +6 -2
- package/dist/api/resources/links/types/ListLinksRequestOrder.d.ts +1 -0
- package/dist/api/resources/links/types/ListLinksRequestOrder.js +1 -0
- package/dist/api/resources/links/types/ListLinksRequestSort.d.ts +1 -1
- package/dist/api/resources/links/types/ListLinksRequestSort.js +1 -1
- package/dist/api/resources/partners/client/Client.d.ts +39 -10
- package/dist/api/resources/partners/client/Client.js +66 -21
- package/dist/api/resources/partners/client/requests/ApprovePartnersRequest.d.ts +1 -1
- package/dist/api/resources/partners/client/requests/BulkApprovePartnersRequest.d.ts +2 -2
- package/dist/api/resources/partners/client/requests/BulkRejectPartnersRequest.d.ts +4 -2
- package/dist/api/resources/partners/client/requests/CreatePartnersRequest.d.ts +21 -7
- package/dist/api/resources/partners/client/requests/CreatePartnersRequest.js +1 -0
- package/dist/api/resources/partners/client/requests/GetPartnersRequest.d.ts +1 -1
- package/dist/api/resources/partners/client/requests/ListPartnersRequest.d.ts +11 -5
- package/dist/api/resources/partners/client/requests/RejectPartnersRequest.d.ts +2 -1
- package/dist/api/resources/partners/client/requests/SuspendPartnersRequest.d.ts +2 -1
- package/dist/api/resources/partners/client/requests/UpdatePartnersRequest.d.ts +10 -2
- package/dist/api/resources/partners/types/ListPartnersRequestOrder.d.ts +1 -0
- package/dist/api/resources/partners/types/ListPartnersRequestOrder.js +1 -0
- package/dist/api/resources/partners/types/ListPartnersRequestSort.d.ts +1 -1
- package/dist/api/resources/partners/types/ListPartnersRequestSort.js +1 -1
- package/dist/api/resources/partners/types/ListPartnersRequestStatus.d.ts +1 -0
- package/dist/api/resources/partners/types/ListPartnersRequestStatus.js +1 -0
- package/dist/api/resources/programs/client/Client.d.ts +7 -1
- package/dist/api/resources/programs/client/Client.js +13 -3
- package/dist/api/resources/programs/client/requests/GetProgramsRequest.d.ts +1 -1
- package/dist/api/resources/programs/client/requests/ListProgramsRequest.d.ts +8 -5
- package/dist/api/resources/programs/types/ListProgramsRequestOrder.d.ts +1 -0
- package/dist/api/resources/programs/types/ListProgramsRequestOrder.js +1 -0
- package/dist/api/resources/programs/types/ListProgramsRequestSort.d.ts +1 -1
- package/dist/api/resources/programs/types/ListProgramsRequestSort.js +1 -1
- package/dist/api/resources/promotionCodes/client/Client.d.ts +27 -5
- package/dist/api/resources/promotionCodes/client/Client.js +46 -10
- package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodesRequest.d.ts +9 -2
- package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodesRequest.js +1 -0
- package/dist/api/resources/promotionCodes/client/requests/DeletePromotionCodesRequest.d.ts +1 -1
- package/dist/api/resources/promotionCodes/client/requests/GetPromotionCodesRequest.d.ts +1 -1
- package/dist/api/resources/promotionCodes/client/requests/ListPromotionCodesRequest.d.ts +11 -5
- package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodesRequest.d.ts +8 -1
- package/dist/api/resources/promotionCodes/client/requests/UpdatePromotionCodesRequest.js +1 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestOrder.d.ts +1 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestOrder.js +1 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.d.ts +1 -1
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.js +1 -1
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestType.d.ts +1 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestType.js +1 -0
- package/dist/api/resources/reports/client/Client.d.ts +15 -0
- package/dist/api/resources/reports/client/Client.js +30 -5
- package/dist/api/resources/reports/client/requests/CustomerStatsReportsRequest.d.ts +3 -0
- package/dist/api/resources/reports/client/requests/LinksReportsRequest.d.ts +8 -0
- package/dist/api/resources/reports/client/requests/OverviewReportsRequest.d.ts +3 -0
- package/dist/api/resources/reports/client/requests/PartnersReportsRequest.d.ts +8 -0
- package/dist/api/resources/reports/client/requests/TimeseriesReportsRequest.d.ts +5 -0
- package/dist/api/resources/reports/types/LinksReportsRequestOrder.d.ts +1 -0
- package/dist/api/resources/reports/types/LinksReportsRequestOrder.js +1 -0
- package/dist/api/resources/reports/types/LinksReportsRequestSort.d.ts +1 -0
- package/dist/api/resources/reports/types/LinksReportsRequestSort.js +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestOrder.d.ts +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestOrder.js +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestSort.d.ts +1 -0
- package/dist/api/resources/reports/types/PartnersReportsRequestSort.js +1 -0
- package/dist/api/resources/reports/types/TimeseriesReportsRequestGranularity.d.ts +1 -0
- package/dist/api/resources/reports/types/TimeseriesReportsRequestGranularity.js +1 -0
- package/dist/api/resources/transactions/client/Client.d.ts +30 -7
- package/dist/api/resources/transactions/client/Client.js +53 -14
- package/dist/api/resources/transactions/client/requests/CreateTransactionsRequest.d.ts +17 -3
- package/dist/api/resources/transactions/client/requests/DeleteTransactionsRequest.d.ts +1 -1
- package/dist/api/resources/transactions/client/requests/GetTransactionsRequest.d.ts +1 -1
- package/dist/api/resources/transactions/client/requests/ListTransactionsRequest.d.ts +12 -5
- package/dist/api/resources/transactions/client/requests/RefundTransactionsRequest.d.ts +1 -1
- package/dist/api/resources/transactions/client/requests/RerunFlowsTransactionsRequest.d.ts +1 -1
- package/dist/api/resources/transactions/client/requests/UpdateTransactionsRequest.d.ts +13 -2
- package/dist/api/resources/transactions/types/ListTransactionsRequestOrder.d.ts +1 -0
- package/dist/api/resources/transactions/types/ListTransactionsRequestOrder.js +1 -0
- package/dist/api/resources/transactions/types/ListTransactionsRequestSort.d.ts +1 -1
- package/dist/api/resources/transactions/types/ListTransactionsRequestSort.js +1 -1
- package/dist/api/types/Commission.d.ts +1 -1
- package/dist/api/types/Customer.d.ts +2 -2
- package/dist/api/types/Error_.d.ts +1 -0
- package/dist/api/types/Error_.js +1 -0
- package/dist/environments.d.ts +2 -2
- package/dist/environments.js +1 -1
- package/package.json +1 -1
- package/dist/api/resources/embed/client/requests/CreateTokenEmbedRequest.d.ts +0 -14
- package/dist/api/resources/embed/client/requests/index.d.ts +0 -1
- package/dist/api/resources/embed/client/requests/index.js +0 -1
- /package/dist/api/resources/embed/{client/requests → types}/CreateTokenEmbedRequest.js +0 -0
|
@@ -12,11 +12,14 @@ export class PromotionCodesClient {
|
|
|
12
12
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
|
+
* Lists promotion codes. Filter by program, partner or type, and page with cursors.
|
|
16
|
+
*
|
|
15
17
|
* @param {ToltApi.ListPromotionCodesRequest} request
|
|
16
18
|
* @param {PromotionCodesClient.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}
|
|
@@ -49,7 +52,7 @@ export class PromotionCodesClient {
|
|
|
49
52
|
const _response = await core.fetcher({
|
|
50
53
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
51
54
|
(await core.Supplier.get(this._options.environment)) ??
|
|
52
|
-
environments.ToltApiEnvironment.
|
|
55
|
+
environments.ToltApiEnvironment.Default, "v2/promotion-codes"),
|
|
53
56
|
method: "GET",
|
|
54
57
|
headers: _headers,
|
|
55
58
|
queryString: core.url
|
|
@@ -72,6 +75,8 @@ export class PromotionCodesClient {
|
|
|
72
75
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
73
76
|
case 401:
|
|
74
77
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
78
|
+
case 413:
|
|
79
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
75
80
|
case 429:
|
|
76
81
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
77
82
|
default:
|
|
@@ -85,19 +90,25 @@ export class PromotionCodesClient {
|
|
|
85
90
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/promotion-codes");
|
|
86
91
|
}
|
|
87
92
|
/**
|
|
93
|
+
* Creates a promotion code for a partner, so customers who use it are credited to them. A partner cannot have the same code twice.
|
|
94
|
+
*
|
|
88
95
|
* @param {ToltApi.CreatePromotionCodesRequest} request
|
|
89
96
|
* @param {PromotionCodesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
90
97
|
*
|
|
91
98
|
* @throws {@link ToltApi.BadRequestError}
|
|
92
99
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
100
|
+
* @throws {@link ToltApi.ConflictError}
|
|
101
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
93
102
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
94
103
|
* @throws {@link errors.ToltApiError}
|
|
95
104
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
96
105
|
*
|
|
97
106
|
* @example
|
|
98
107
|
* await client.promotionCodes.create({
|
|
99
|
-
* code: "
|
|
100
|
-
*
|
|
108
|
+
* code: "SAM20",
|
|
109
|
+
* type: "percentage",
|
|
110
|
+
* value: "20",
|
|
111
|
+
* partner_id: "part_NLYzgNKuSuASvrvoxNtau6SY"
|
|
101
112
|
* })
|
|
102
113
|
*/
|
|
103
114
|
create(request, requestOptions) {
|
|
@@ -109,7 +120,7 @@ export class PromotionCodesClient {
|
|
|
109
120
|
const _response = await core.fetcher({
|
|
110
121
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
111
122
|
(await core.Supplier.get(this._options.environment)) ??
|
|
112
|
-
environments.ToltApiEnvironment.
|
|
123
|
+
environments.ToltApiEnvironment.Default, "v2/promotion-codes"),
|
|
113
124
|
method: "POST",
|
|
114
125
|
headers: _headers,
|
|
115
126
|
contentType: "application/json",
|
|
@@ -131,6 +142,10 @@ export class PromotionCodesClient {
|
|
|
131
142
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
132
143
|
case 401:
|
|
133
144
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
145
|
+
case 409:
|
|
146
|
+
throw new ToltApi.ConflictError(_response.error.body, _response.rawResponse);
|
|
147
|
+
case 413:
|
|
148
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
134
149
|
case 429:
|
|
135
150
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
136
151
|
default:
|
|
@@ -144,18 +159,21 @@ export class PromotionCodesClient {
|
|
|
144
159
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/promotion-codes");
|
|
145
160
|
}
|
|
146
161
|
/**
|
|
162
|
+
* Gets a promotion code by ID, with its discount type and value and the partner, group or program it belongs to.
|
|
163
|
+
*
|
|
147
164
|
* @param {ToltApi.GetPromotionCodesRequest} request
|
|
148
165
|
* @param {PromotionCodesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
149
166
|
*
|
|
150
167
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
151
168
|
* @throws {@link ToltApi.NotFoundError}
|
|
169
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
152
170
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
153
171
|
* @throws {@link errors.ToltApiError}
|
|
154
172
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
155
173
|
*
|
|
156
174
|
* @example
|
|
157
175
|
* await client.promotionCodes.get({
|
|
158
|
-
* id: "
|
|
176
|
+
* id: "promo_gTCAUsWfdmN2GuCVRaHWNRan"
|
|
159
177
|
* })
|
|
160
178
|
*/
|
|
161
179
|
get(request, requestOptions) {
|
|
@@ -168,7 +186,7 @@ export class PromotionCodesClient {
|
|
|
168
186
|
const _response = await core.fetcher({
|
|
169
187
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
170
188
|
(await core.Supplier.get(this._options.environment)) ??
|
|
171
|
-
environments.ToltApiEnvironment.
|
|
189
|
+
environments.ToltApiEnvironment.Default, `v2/promotion-codes/${core.url.encodePathParam(id)}`),
|
|
172
190
|
method: "GET",
|
|
173
191
|
headers: _headers,
|
|
174
192
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
@@ -187,6 +205,8 @@ export class PromotionCodesClient {
|
|
|
187
205
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
188
206
|
case 404:
|
|
189
207
|
throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
|
|
208
|
+
case 413:
|
|
209
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
190
210
|
case 429:
|
|
191
211
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
192
212
|
default:
|
|
@@ -200,19 +220,26 @@ export class PromotionCodesClient {
|
|
|
200
220
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/promotion-codes/{id}");
|
|
201
221
|
}
|
|
202
222
|
/**
|
|
223
|
+
* Updates a promotion code's code, discount type or value.
|
|
224
|
+
*
|
|
203
225
|
* @param {ToltApi.UpdatePromotionCodesRequest} request
|
|
204
226
|
* @param {PromotionCodesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
205
227
|
*
|
|
206
228
|
* @throws {@link ToltApi.BadRequestError}
|
|
207
229
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
208
230
|
* @throws {@link ToltApi.NotFoundError}
|
|
231
|
+
* @throws {@link ToltApi.ConflictError}
|
|
232
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
209
233
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
210
234
|
* @throws {@link errors.ToltApiError}
|
|
211
235
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
212
236
|
*
|
|
213
237
|
* @example
|
|
214
238
|
* await client.promotionCodes.update({
|
|
215
|
-
* id: "
|
|
239
|
+
* id: "promo_gTCAUsWfdmN2GuCVRaHWNRan",
|
|
240
|
+
* code: "SAM20",
|
|
241
|
+
* type: "percentage",
|
|
242
|
+
* value: "20"
|
|
216
243
|
* })
|
|
217
244
|
*/
|
|
218
245
|
update(request, requestOptions) {
|
|
@@ -225,7 +252,7 @@ export class PromotionCodesClient {
|
|
|
225
252
|
const _response = await core.fetcher({
|
|
226
253
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
227
254
|
(await core.Supplier.get(this._options.environment)) ??
|
|
228
|
-
environments.ToltApiEnvironment.
|
|
255
|
+
environments.ToltApiEnvironment.Default, `v2/promotion-codes/${core.url.encodePathParam(id)}`),
|
|
229
256
|
method: "PUT",
|
|
230
257
|
headers: _headers,
|
|
231
258
|
contentType: "application/json",
|
|
@@ -249,6 +276,10 @@ export class PromotionCodesClient {
|
|
|
249
276
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
250
277
|
case 404:
|
|
251
278
|
throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
|
|
279
|
+
case 409:
|
|
280
|
+
throw new ToltApi.ConflictError(_response.error.body, _response.rawResponse);
|
|
281
|
+
case 413:
|
|
282
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
252
283
|
case 429:
|
|
253
284
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
254
285
|
default:
|
|
@@ -262,18 +293,21 @@ export class PromotionCodesClient {
|
|
|
262
293
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v2/promotion-codes/{id}");
|
|
263
294
|
}
|
|
264
295
|
/**
|
|
296
|
+
* Deletes a promotion code, so customers who use it afterwards are no longer attributed through it.
|
|
297
|
+
*
|
|
265
298
|
* @param {ToltApi.DeletePromotionCodesRequest} request
|
|
266
299
|
* @param {PromotionCodesClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
267
300
|
*
|
|
268
301
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
269
302
|
* @throws {@link ToltApi.NotFoundError}
|
|
303
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
270
304
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
271
305
|
* @throws {@link errors.ToltApiError}
|
|
272
306
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
273
307
|
*
|
|
274
308
|
* @example
|
|
275
309
|
* await client.promotionCodes.delete({
|
|
276
|
-
* id: "
|
|
310
|
+
* id: "promo_gTCAUsWfdmN2GuCVRaHWNRan"
|
|
277
311
|
* })
|
|
278
312
|
*/
|
|
279
313
|
delete(request, requestOptions) {
|
|
@@ -286,7 +320,7 @@ export class PromotionCodesClient {
|
|
|
286
320
|
const _response = await core.fetcher({
|
|
287
321
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
288
322
|
(await core.Supplier.get(this._options.environment)) ??
|
|
289
|
-
environments.ToltApiEnvironment.
|
|
323
|
+
environments.ToltApiEnvironment.Default, `v2/promotion-codes/${core.url.encodePathParam(id)}`),
|
|
290
324
|
method: "DELETE",
|
|
291
325
|
headers: _headers,
|
|
292
326
|
queryString: core.url.queryBuilder().mergeAdditional(requestOptions?.queryParams).build(),
|
|
@@ -305,6 +339,8 @@ export class PromotionCodesClient {
|
|
|
305
339
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
306
340
|
case 404:
|
|
307
341
|
throw new ToltApi.NotFoundError(_response.error.body, _response.rawResponse);
|
|
342
|
+
case 413:
|
|
343
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
308
344
|
case 429:
|
|
309
345
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
310
346
|
default:
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
-
* code: "
|
|
5
|
-
*
|
|
4
|
+
* code: "SAM20",
|
|
5
|
+
* type: "percentage",
|
|
6
|
+
* value: "20",
|
|
7
|
+
* partner_id: "part_NLYzgNKuSuASvrvoxNtau6SY"
|
|
6
8
|
* }
|
|
7
9
|
*/
|
|
8
10
|
export interface CreatePromotionCodesRequest {
|
|
11
|
+
/** The discount code as customers enter it at checkout. Customers and payments that use it are attributed to the code's partner. A partner cannot have the same code twice, ignoring case. Recording it here does not create it in your billing system. */
|
|
9
12
|
code: string;
|
|
13
|
+
/** Whether value is a percent off or a fixed amount off. */
|
|
10
14
|
type?: CreatePromotionCodesRequest.Type;
|
|
15
|
+
/** Size of the discount as a plain decimal: a percent from 0 to 100 for percentage codes ("20" is 20%), or an amount from 0 to 1,000,000 in major units of the program currency for fixed codes ("20" is 20.00). */
|
|
11
16
|
value?: string;
|
|
17
|
+
/** Id of the partner the code belongs to (part_...), as returned when listing partners. The code is created in that partner's program. */
|
|
12
18
|
partner_id: string;
|
|
13
19
|
}
|
|
14
20
|
export declare namespace CreatePromotionCodesRequest {
|
|
21
|
+
/** Whether value is a percent off or a fixed amount off. */
|
|
15
22
|
const Type: {
|
|
16
23
|
readonly Fixed: "fixed";
|
|
17
24
|
readonly Percentage: "percentage";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
export var CreatePromotionCodesRequest;
|
|
3
3
|
(function (CreatePromotionCodesRequest) {
|
|
4
|
+
/** Whether value is a percent off or a fixed amount off. */
|
|
4
5
|
CreatePromotionCodesRequest.Type = {
|
|
5
6
|
Fixed: "fixed",
|
|
6
7
|
Percentage: "percentage",
|
|
@@ -4,24 +4,30 @@ import type * as ToltApi from "../../../../index.js";
|
|
|
4
4
|
* {}
|
|
5
5
|
*/
|
|
6
6
|
export interface ListPromotionCodesRequest {
|
|
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.ListPromotionCodesRequestOrder;
|
|
9
|
-
/**
|
|
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.ListPromotionCodesRequestSort;
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
|
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
|
|
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
|
+
/** Only codes giving this kind of discount: a fixed amount off or a percentage off. */
|
|
25
30
|
type?: ToltApi.ListPromotionCodesRequestType;
|
|
31
|
+
/** Text matched anywhere in the code, ignoring case. */
|
|
26
32
|
search?: string;
|
|
27
33
|
}
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @example
|
|
3
3
|
* {
|
|
4
|
-
* id: "
|
|
4
|
+
* id: "promo_gTCAUsWfdmN2GuCVRaHWNRan",
|
|
5
|
+
* code: "SAM20",
|
|
6
|
+
* type: "percentage",
|
|
7
|
+
* value: "20"
|
|
5
8
|
* }
|
|
6
9
|
*/
|
|
7
10
|
export interface UpdatePromotionCodesRequest {
|
|
8
11
|
id: string;
|
|
12
|
+
/** The discount code as customers enter it at checkout. Customers and payments that use it are attributed to the code's partner. A partner cannot have the same code twice, ignoring case. */
|
|
9
13
|
code?: string;
|
|
14
|
+
/** Whether value is a percent off or a fixed amount off. */
|
|
10
15
|
type?: UpdatePromotionCodesRequest.Type | null;
|
|
16
|
+
/** Size of the discount as a plain decimal: a percent from 0 to 100 for percentage codes ("20" is 20%), or an amount from 0 to 1,000,000 in major units of the program currency for fixed codes ("20" is 20.00). null clears it. */
|
|
11
17
|
value?: string | null;
|
|
12
18
|
}
|
|
13
19
|
export declare namespace UpdatePromotionCodesRequest {
|
|
20
|
+
/** Whether value is a percent off or a fixed amount off. */
|
|
14
21
|
const Type: {
|
|
15
22
|
readonly Fixed: "fixed";
|
|
16
23
|
readonly Percentage: "percentage";
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// This file was auto-generated by Fern from our API Definition.
|
|
2
2
|
export var UpdatePromotionCodesRequest;
|
|
3
3
|
(function (UpdatePromotionCodesRequest) {
|
|
4
|
+
/** Whether value is a percent off or a fixed amount off. */
|
|
4
5
|
UpdatePromotionCodesRequest.Type = {
|
|
5
6
|
Fixed: "fixed",
|
|
6
7
|
Percentage: "percentage",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/**
|
|
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 ListPromotionCodesRequestSort: {
|
|
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
|
-
/**
|
|
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 ListPromotionCodesRequestSort = {
|
|
4
4
|
CreatedAt: "created_at",
|
|
5
5
|
UpdatedAt: "updated_at",
|
|
@@ -11,11 +11,14 @@ export declare class ReportsClient {
|
|
|
11
11
|
protected readonly _options: NormalizedClientOptionsWithAuth<ReportsClient.Options>;
|
|
12
12
|
constructor(options: ReportsClient.Options);
|
|
13
13
|
/**
|
|
14
|
+
* Returns revenue, commission, customer and partner totals for the organization or one program over a date range.
|
|
15
|
+
*
|
|
14
16
|
* @param {ToltApi.OverviewReportsRequest} request
|
|
15
17
|
* @param {ReportsClient.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,11 +29,14 @@ export declare class ReportsClient {
|
|
|
26
29
|
overview(request?: ToltApi.OverviewReportsRequest, requestOptions?: ReportsClient.RequestOptions): core.HttpResponsePromise<ToltApi.OverviewReportsResponse>;
|
|
27
30
|
private __overview;
|
|
28
31
|
/**
|
|
32
|
+
* Returns one row of revenue, commissions, customers and clicks per partner over a date range, sorted and paged by offset.
|
|
33
|
+
*
|
|
29
34
|
* @param {ToltApi.PartnersReportsRequest} request
|
|
30
35
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
31
36
|
*
|
|
32
37
|
* @throws {@link ToltApi.BadRequestError}
|
|
33
38
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
39
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
34
40
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
35
41
|
* @throws {@link errors.ToltApiError}
|
|
36
42
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -41,11 +47,14 @@ export declare class ReportsClient {
|
|
|
41
47
|
partners(request?: ToltApi.PartnersReportsRequest, requestOptions?: ReportsClient.RequestOptions): core.HttpResponsePromise<ToltApi.PartnersReportsResponse>;
|
|
42
48
|
private __partners;
|
|
43
49
|
/**
|
|
50
|
+
* Returns one row of revenue, commissions, customers and clicks per link over a date range, sorted and paged by offset.
|
|
51
|
+
*
|
|
44
52
|
* @param {ToltApi.LinksReportsRequest} request
|
|
45
53
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
46
54
|
*
|
|
47
55
|
* @throws {@link ToltApi.BadRequestError}
|
|
48
56
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
57
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
49
58
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
50
59
|
* @throws {@link errors.ToltApiError}
|
|
51
60
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -56,11 +65,14 @@ export declare class ReportsClient {
|
|
|
56
65
|
links(request?: ToltApi.LinksReportsRequest, requestOptions?: ReportsClient.RequestOptions): core.HttpResponsePromise<ToltApi.LinksReportsResponse>;
|
|
57
66
|
private __links;
|
|
58
67
|
/**
|
|
68
|
+
* Returns revenue, commissions, customers and clicks per day, week or month over a date range, ready to chart.
|
|
69
|
+
*
|
|
59
70
|
* @param {ToltApi.TimeseriesReportsRequest} request
|
|
60
71
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
61
72
|
*
|
|
62
73
|
* @throws {@link ToltApi.BadRequestError}
|
|
63
74
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
75
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
64
76
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
65
77
|
* @throws {@link errors.ToltApiError}
|
|
66
78
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -71,11 +83,14 @@ export declare class ReportsClient {
|
|
|
71
83
|
timeseries(request?: ToltApi.TimeseriesReportsRequest, requestOptions?: ReportsClient.RequestOptions): core.HttpResponsePromise<ToltApi.TimeseriesReportsResponse>;
|
|
72
84
|
private __timeseries;
|
|
73
85
|
/**
|
|
86
|
+
* Returns how many customers are in each subscription status for the organization or one program.
|
|
87
|
+
*
|
|
74
88
|
* @param {ToltApi.CustomerStatsReportsRequest} request
|
|
75
89
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
76
90
|
*
|
|
77
91
|
* @throws {@link ToltApi.BadRequestError}
|
|
78
92
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
93
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
79
94
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
80
95
|
* @throws {@link errors.ToltApiError}
|
|
81
96
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -11,11 +11,14 @@ export class ReportsClient {
|
|
|
11
11
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
+
* Returns revenue, commission, customer and partner totals for the organization or one program over a date range.
|
|
15
|
+
*
|
|
14
16
|
* @param {ToltApi.OverviewReportsRequest} request
|
|
15
17
|
* @param {ReportsClient.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}
|
|
@@ -38,7 +41,7 @@ export class ReportsClient {
|
|
|
38
41
|
const _response = await core.fetcher({
|
|
39
42
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
40
43
|
(await core.Supplier.get(this._options.environment)) ??
|
|
41
|
-
environments.ToltApiEnvironment.
|
|
44
|
+
environments.ToltApiEnvironment.Default, "v2/reports/overview"),
|
|
42
45
|
method: "GET",
|
|
43
46
|
headers: _headers,
|
|
44
47
|
queryString: core.url
|
|
@@ -61,6 +64,8 @@ export class ReportsClient {
|
|
|
61
64
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
62
65
|
case 401:
|
|
63
66
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
67
|
+
case 413:
|
|
68
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
64
69
|
case 429:
|
|
65
70
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
66
71
|
default:
|
|
@@ -74,11 +79,14 @@ export class ReportsClient {
|
|
|
74
79
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/overview");
|
|
75
80
|
}
|
|
76
81
|
/**
|
|
82
|
+
* Returns one row of revenue, commissions, customers and clicks per partner over a date range, sorted and paged by offset.
|
|
83
|
+
*
|
|
77
84
|
* @param {ToltApi.PartnersReportsRequest} request
|
|
78
85
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
86
|
*
|
|
80
87
|
* @throws {@link ToltApi.BadRequestError}
|
|
81
88
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
89
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
82
90
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
83
91
|
* @throws {@link errors.ToltApiError}
|
|
84
92
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -106,7 +114,7 @@ export class ReportsClient {
|
|
|
106
114
|
const _response = await core.fetcher({
|
|
107
115
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
108
116
|
(await core.Supplier.get(this._options.environment)) ??
|
|
109
|
-
environments.ToltApiEnvironment.
|
|
117
|
+
environments.ToltApiEnvironment.Default, "v2/reports/partners"),
|
|
110
118
|
method: "GET",
|
|
111
119
|
headers: _headers,
|
|
112
120
|
queryString: core.url
|
|
@@ -129,6 +137,8 @@ export class ReportsClient {
|
|
|
129
137
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
130
138
|
case 401:
|
|
131
139
|
throw new ToltApi.UnauthorizedError(_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:
|
|
@@ -142,11 +152,14 @@ export class ReportsClient {
|
|
|
142
152
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/partners");
|
|
143
153
|
}
|
|
144
154
|
/**
|
|
155
|
+
* Returns one row of revenue, commissions, customers and clicks per link over a date range, sorted and paged by offset.
|
|
156
|
+
*
|
|
145
157
|
* @param {ToltApi.LinksReportsRequest} request
|
|
146
158
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
147
159
|
*
|
|
148
160
|
* @throws {@link ToltApi.BadRequestError}
|
|
149
161
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
162
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
150
163
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
151
164
|
* @throws {@link errors.ToltApiError}
|
|
152
165
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -174,7 +187,7 @@ export class ReportsClient {
|
|
|
174
187
|
const _response = await core.fetcher({
|
|
175
188
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
176
189
|
(await core.Supplier.get(this._options.environment)) ??
|
|
177
|
-
environments.ToltApiEnvironment.
|
|
190
|
+
environments.ToltApiEnvironment.Default, "v2/reports/links"),
|
|
178
191
|
method: "GET",
|
|
179
192
|
headers: _headers,
|
|
180
193
|
queryString: core.url
|
|
@@ -197,6 +210,8 @@ export class ReportsClient {
|
|
|
197
210
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
198
211
|
case 401:
|
|
199
212
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
213
|
+
case 413:
|
|
214
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
200
215
|
case 429:
|
|
201
216
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
202
217
|
default:
|
|
@@ -210,11 +225,14 @@ export class ReportsClient {
|
|
|
210
225
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/links");
|
|
211
226
|
}
|
|
212
227
|
/**
|
|
228
|
+
* Returns revenue, commissions, customers and clicks per day, week or month over a date range, ready to chart.
|
|
229
|
+
*
|
|
213
230
|
* @param {ToltApi.TimeseriesReportsRequest} request
|
|
214
231
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
215
232
|
*
|
|
216
233
|
* @throws {@link ToltApi.BadRequestError}
|
|
217
234
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
235
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
218
236
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
219
237
|
* @throws {@link errors.ToltApiError}
|
|
220
238
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -239,7 +257,7 @@ export class ReportsClient {
|
|
|
239
257
|
const _response = await core.fetcher({
|
|
240
258
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
241
259
|
(await core.Supplier.get(this._options.environment)) ??
|
|
242
|
-
environments.ToltApiEnvironment.
|
|
260
|
+
environments.ToltApiEnvironment.Default, "v2/reports/timeseries"),
|
|
243
261
|
method: "GET",
|
|
244
262
|
headers: _headers,
|
|
245
263
|
queryString: core.url
|
|
@@ -262,6 +280,8 @@ export class ReportsClient {
|
|
|
262
280
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
263
281
|
case 401:
|
|
264
282
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
283
|
+
case 413:
|
|
284
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
265
285
|
case 429:
|
|
266
286
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
267
287
|
default:
|
|
@@ -275,11 +295,14 @@ export class ReportsClient {
|
|
|
275
295
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/timeseries");
|
|
276
296
|
}
|
|
277
297
|
/**
|
|
298
|
+
* Returns how many customers are in each subscription status for the organization or one program.
|
|
299
|
+
*
|
|
278
300
|
* @param {ToltApi.CustomerStatsReportsRequest} request
|
|
279
301
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
280
302
|
*
|
|
281
303
|
* @throws {@link ToltApi.BadRequestError}
|
|
282
304
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
305
|
+
* @throws {@link ToltApi.ContentTooLargeError}
|
|
283
306
|
* @throws {@link ToltApi.TooManyRequestsError}
|
|
284
307
|
* @throws {@link errors.ToltApiError}
|
|
285
308
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
@@ -302,7 +325,7 @@ export class ReportsClient {
|
|
|
302
325
|
const _response = await core.fetcher({
|
|
303
326
|
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
304
327
|
(await core.Supplier.get(this._options.environment)) ??
|
|
305
|
-
environments.ToltApiEnvironment.
|
|
328
|
+
environments.ToltApiEnvironment.Default, "v2/reports/customers"),
|
|
306
329
|
method: "GET",
|
|
307
330
|
headers: _headers,
|
|
308
331
|
queryString: core.url
|
|
@@ -325,6 +348,8 @@ export class ReportsClient {
|
|
|
325
348
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
326
349
|
case 401:
|
|
327
350
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
351
|
+
case 413:
|
|
352
|
+
throw new ToltApi.ContentTooLargeError(_response.error.body, _response.rawResponse);
|
|
328
353
|
case 429:
|
|
329
354
|
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
330
355
|
default:
|
|
@@ -3,7 +3,10 @@
|
|
|
3
3
|
* {}
|
|
4
4
|
*/
|
|
5
5
|
export interface CustomerStatsReportsRequest {
|
|
6
|
+
/** Limit to one program, by its id (prg_...) as returned when listing programs. */
|
|
6
7
|
program_id?: string;
|
|
8
|
+
/** Earliest day to include, by the day customers became active. Leave it out for no lower bound. */
|
|
7
9
|
start_date?: string;
|
|
10
|
+
/** Latest day to include, by the day customers became active; the whole day counts. Leave it out for no upper bound. */
|
|
8
11
|
end_date?: string;
|
|
9
12
|
}
|
|
@@ -4,12 +4,20 @@ import type * as ToltApi from "../../../../index.js";
|
|
|
4
4
|
* {}
|
|
5
5
|
*/
|
|
6
6
|
export interface LinksReportsRequest {
|
|
7
|
+
/** Limit to one program, by its id (prg_...) as returned when listing programs. */
|
|
7
8
|
program_id?: string;
|
|
9
|
+
/** Earliest day to include, by creation date (customers by the day they became active). Leave it out for no lower bound. */
|
|
8
10
|
start_date?: string;
|
|
11
|
+
/** Latest day to include, by creation date (customers by the day they became active); the whole day counts. Leave it out for no upper bound. */
|
|
9
12
|
end_date?: string;
|
|
13
|
+
/** Only include transactions and commissions in this currency, such as USD; matching ignores case. Rows without their own currency use their program's. */
|
|
10
14
|
currency?: string;
|
|
15
|
+
/** How many rows to return in one page. */
|
|
11
16
|
limit?: number;
|
|
17
|
+
/** How many rows to skip before this page begins. */
|
|
12
18
|
offset?: number | null;
|
|
19
|
+
/** Metric to rank by, computed over the date window. */
|
|
13
20
|
sort?: ToltApi.LinksReportsRequestSort;
|
|
21
|
+
/** Ranking direction: desc puts the highest values first. */
|
|
14
22
|
order?: ToltApi.LinksReportsRequestOrder;
|
|
15
23
|
}
|