@tolt/api 0.1.1 → 0.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.
- package/dist/Client.d.ts +3 -0
- package/dist/Client.js +4 -0
- package/dist/api/errors/TooManyRequestsError.d.ts +7 -0
- package/dist/api/errors/TooManyRequestsError.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 +10 -4
- package/dist/api/resources/clicks/client/Client.js +22 -24
- package/dist/api/resources/clicks/client/requests/index.d.ts +0 -1
- package/dist/api/resources/clicks/types/CreateClickRequest.d.ts +1 -0
- package/dist/api/resources/clicks/types/CreateClickResponse.d.ts +6 -0
- package/dist/api/resources/clicks/types/index.d.ts +2 -2
- package/dist/api/resources/clicks/types/index.js +2 -2
- package/dist/api/resources/commissions/client/Client.d.ts +45 -0
- package/dist/api/resources/commissions/client/Client.js +154 -1
- package/dist/api/resources/commissions/client/requests/BulkApproveCommissionsRequest.d.ts +10 -0
- package/dist/api/resources/commissions/client/requests/BulkDeclineCommissionsRequest.d.ts +10 -0
- package/dist/api/resources/commissions/client/requests/BulkDeclineCommissionsRequest.js +2 -0
- package/dist/api/resources/commissions/client/requests/ListCommissionsRequest.d.ts +13 -0
- package/dist/api/resources/commissions/client/requests/UpdateCommissionRequest.d.ts +3 -3
- package/dist/api/resources/commissions/client/requests/index.d.ts +2 -0
- package/dist/api/resources/commissions/types/BulkApproveCommissionsResponse.d.ts +6 -0
- package/dist/api/resources/commissions/types/BulkApproveCommissionsResponse.js +2 -0
- package/dist/api/resources/commissions/types/BulkDeclineCommissionsResponse.d.ts +6 -0
- package/dist/api/resources/commissions/types/BulkDeclineCommissionsResponse.js +2 -0
- package/dist/api/resources/commissions/types/ListCommissionsRequestSort.d.ts +6 -0
- package/dist/api/resources/commissions/types/ListCommissionsRequestSort.js +6 -0
- package/dist/api/resources/commissions/types/ListCommissionsResponse.d.ts +4 -0
- package/dist/api/resources/commissions/types/index.d.ts +3 -0
- package/dist/api/resources/commissions/types/index.js +3 -0
- package/dist/api/resources/customers/client/Client.d.ts +7 -4
- package/dist/api/resources/customers/client/Client.js +25 -6
- package/dist/api/resources/customers/client/requests/CreateCustomerRequest.d.ts +14 -0
- package/dist/api/resources/customers/client/requests/CreateCustomerRequest.js +2 -0
- package/dist/api/resources/customers/client/requests/ListCustomersRequest.d.ts +13 -0
- package/dist/api/resources/customers/client/requests/UpdateCustomerRequest.d.ts +6 -6
- package/dist/api/resources/customers/client/requests/index.d.ts +1 -0
- package/dist/api/resources/customers/types/ListCustomersRequestSort.d.ts +6 -0
- package/dist/api/resources/customers/types/ListCustomersRequestSort.js +6 -0
- package/dist/api/resources/customers/types/ListCustomersResponse.d.ts +4 -0
- package/dist/api/resources/customers/types/index.d.ts +1 -1
- package/dist/api/resources/customers/types/index.js +1 -1
- package/dist/api/resources/embed/client/Client.d.ts +31 -0
- package/dist/api/resources/embed/client/Client.js +75 -0
- package/dist/api/resources/embed/client/index.d.ts +1 -0
- package/dist/api/resources/embed/client/index.js +1 -0
- package/dist/api/resources/embed/client/requests/CreateEmbedTokenRequest.d.ts +14 -0
- package/dist/api/resources/embed/client/requests/CreateEmbedTokenRequest.js +2 -0
- package/dist/api/resources/embed/client/requests/index.d.ts +1 -0
- package/dist/api/resources/embed/client/requests/index.js +1 -0
- package/dist/api/resources/embed/exports.d.ts +2 -0
- package/dist/api/resources/embed/exports.js +3 -0
- package/dist/api/resources/embed/index.d.ts +2 -0
- package/dist/api/resources/embed/index.js +2 -0
- package/dist/api/resources/embed/types/CreateEmbedTokenResponse.d.ts +6 -0
- package/dist/api/resources/embed/types/CreateEmbedTokenResponse.js +2 -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 +2 -0
- package/dist/api/resources/flows/client/Client.js +13 -1
- package/dist/api/resources/flows/client/requests/ListFlowsRequest.d.ts +13 -0
- package/dist/api/resources/flows/types/ListFlowsRequestSort.d.ts +6 -0
- package/dist/api/resources/flows/types/ListFlowsRequestSort.js +6 -0
- package/dist/api/resources/flows/types/ListFlowsResponse.d.ts +4 -0
- package/dist/api/resources/flows/types/index.d.ts +1 -0
- package/dist/api/resources/flows/types/index.js +1 -0
- package/dist/api/resources/groups/client/Client.d.ts +2 -0
- package/dist/api/resources/groups/client/Client.js +13 -1
- package/dist/api/resources/groups/client/requests/ListGroupsRequest.d.ts +13 -0
- package/dist/api/resources/groups/types/ListGroupsRequestSort.d.ts +6 -0
- package/dist/api/resources/groups/types/ListGroupsRequestSort.js +6 -0
- package/dist/api/resources/groups/types/ListGroupsResponse.d.ts +4 -0
- package/dist/api/resources/groups/types/index.d.ts +1 -0
- package/dist/api/resources/groups/types/index.js +1 -0
- package/dist/api/resources/index.d.ts +3 -0
- package/dist/api/resources/index.js +3 -0
- package/dist/api/resources/links/client/Client.d.ts +6 -1
- package/dist/api/resources/links/client/Client.js +23 -2
- package/dist/api/resources/links/client/requests/CreateLinkRequest.d.ts +2 -2
- package/dist/api/resources/links/client/requests/ListLinksRequest.d.ts +13 -0
- package/dist/api/resources/links/types/ListLinksRequestSort.d.ts +6 -0
- package/dist/api/resources/links/types/ListLinksRequestSort.js +6 -0
- package/dist/api/resources/links/types/ListLinksResponse.d.ts +4 -0
- package/dist/api/resources/links/types/index.d.ts +1 -0
- package/dist/api/resources/links/types/index.js +1 -0
- package/dist/api/resources/partners/client/Client.d.ts +85 -0
- package/dist/api/resources/partners/client/Client.js +273 -1
- package/dist/api/resources/partners/client/requests/BulkApprovePartnersRequest.d.ts +10 -0
- package/dist/api/resources/partners/client/requests/BulkApprovePartnersRequest.js +2 -0
- package/dist/api/resources/partners/client/requests/BulkRejectPartnersRequest.d.ts +11 -0
- package/dist/api/resources/partners/client/requests/BulkRejectPartnersRequest.js +2 -0
- package/dist/api/resources/partners/client/requests/CreatePartnerRequest.d.ts +41 -0
- package/dist/api/resources/partners/client/requests/CreatePartnerRequest.js +8 -0
- package/dist/api/resources/partners/client/requests/ListPartnersRequest.d.ts +13 -0
- package/dist/api/resources/partners/client/requests/RejectPartnerRequest.d.ts +1 -1
- package/dist/api/resources/partners/client/requests/SuspendPartnerRequest.d.ts +1 -1
- package/dist/api/resources/partners/client/requests/UpdatePartnerRequest.d.ts +16 -0
- package/dist/api/resources/partners/client/requests/UpdatePartnerRequest.js +2 -0
- package/dist/api/resources/partners/client/requests/index.d.ts +4 -0
- package/dist/api/resources/partners/client/requests/index.js +1 -1
- package/dist/api/resources/partners/types/BulkApprovePartnersResponse.d.ts +6 -0
- package/dist/api/resources/partners/types/BulkApprovePartnersResponse.js +2 -0
- package/dist/api/resources/partners/types/BulkRejectPartnersResponse.d.ts +6 -0
- package/dist/api/resources/partners/types/BulkRejectPartnersResponse.js +2 -0
- package/dist/api/resources/partners/types/CreatePartnerResponse.d.ts +6 -0
- package/dist/api/resources/partners/types/CreatePartnerResponse.js +2 -0
- package/dist/api/resources/partners/types/ListPartnersRequestSort.d.ts +6 -0
- package/dist/api/resources/partners/types/ListPartnersRequestSort.js +6 -0
- package/dist/api/resources/partners/types/ListPartnersResponse.d.ts +4 -0
- package/dist/api/resources/partners/types/UpdatePartnerResponse.d.ts +6 -0
- package/dist/api/resources/partners/types/UpdatePartnerResponse.js +2 -0
- package/dist/api/resources/partners/types/index.d.ts +5 -0
- package/dist/api/resources/partners/types/index.js +5 -0
- package/dist/api/resources/programs/client/Client.d.ts +2 -0
- package/dist/api/resources/programs/client/Client.js +13 -1
- package/dist/api/resources/programs/client/requests/ListProgramsRequest.d.ts +13 -0
- package/dist/api/resources/programs/types/ListProgramsRequestSort.d.ts +6 -0
- package/dist/api/resources/programs/types/ListProgramsRequestSort.js +6 -0
- package/dist/api/resources/programs/types/ListProgramsResponse.d.ts +4 -0
- package/dist/api/resources/programs/types/index.d.ts +1 -0
- package/dist/api/resources/programs/types/index.js +1 -0
- package/dist/api/resources/promotionCodes/client/Client.d.ts +6 -1
- package/dist/api/resources/promotionCodes/client/Client.js +23 -2
- package/dist/api/resources/promotionCodes/client/requests/CreatePromotionCodeRequest.d.ts +2 -2
- package/dist/api/resources/promotionCodes/client/requests/ListPromotionCodesRequest.d.ts +13 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.d.ts +6 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesRequestSort.js +6 -0
- package/dist/api/resources/promotionCodes/types/ListPromotionCodesResponse.d.ts +4 -0
- package/dist/api/resources/promotionCodes/types/index.d.ts +1 -0
- package/dist/api/resources/promotionCodes/types/index.js +1 -0
- package/dist/api/resources/reports/client/Client.d.ts +61 -2
- package/dist/api/resources/reports/client/Client.js +264 -2
- package/dist/api/resources/reports/client/requests/ReportsCustomerStatsRequest.d.ts +9 -0
- package/dist/api/resources/reports/client/requests/ReportsCustomerStatsRequest.js +2 -0
- package/dist/api/resources/reports/client/requests/ReportsLinksRequest.d.ts +14 -0
- package/dist/api/resources/reports/client/requests/ReportsLinksRequest.js +2 -0
- package/dist/api/resources/reports/client/requests/ReportsPartnersRequest.d.ts +14 -0
- package/dist/api/resources/reports/client/requests/ReportsPartnersRequest.js +2 -0
- package/dist/api/resources/reports/client/requests/ReportsTimeseriesRequest.d.ts +11 -0
- package/dist/api/resources/reports/client/requests/ReportsTimeseriesRequest.js +2 -0
- package/dist/api/resources/reports/client/requests/index.d.ts +4 -0
- package/dist/api/resources/reports/types/ReportsCustomerStatsResponse.d.ts +6 -0
- package/dist/api/resources/reports/types/ReportsCustomerStatsResponse.js +2 -0
- package/dist/api/resources/reports/types/ReportsLinksRequestOrder.d.ts +5 -0
- package/dist/api/resources/{clicks/types/ListClicksRequestOrder.js → reports/types/ReportsLinksRequestOrder.js} +1 -1
- package/dist/api/resources/reports/types/ReportsLinksRequestSort.d.ts +7 -0
- package/dist/api/resources/reports/types/ReportsLinksRequestSort.js +7 -0
- package/dist/api/resources/{clicks/types/ListClicksResponse.d.ts → reports/types/ReportsLinksResponse.d.ts} +2 -2
- package/dist/api/resources/reports/types/ReportsLinksResponse.js +2 -0
- package/dist/api/resources/reports/types/ReportsPartnersRequestOrder.d.ts +5 -0
- package/dist/api/resources/reports/types/ReportsPartnersRequestOrder.js +5 -0
- package/dist/api/resources/reports/types/ReportsPartnersRequestSort.d.ts +7 -0
- package/dist/api/resources/reports/types/ReportsPartnersRequestSort.js +7 -0
- package/dist/api/resources/reports/types/ReportsPartnersResponse.d.ts +7 -0
- package/dist/api/resources/reports/types/ReportsPartnersResponse.js +2 -0
- package/dist/api/resources/reports/types/ReportsTimeseriesRequestGranularity.d.ts +6 -0
- package/dist/api/resources/reports/types/ReportsTimeseriesRequestGranularity.js +6 -0
- package/dist/api/resources/reports/types/ReportsTimeseriesResponse.d.ts +6 -0
- package/dist/api/resources/reports/types/ReportsTimeseriesResponse.js +2 -0
- package/dist/api/resources/reports/types/index.d.ts +9 -0
- package/dist/api/resources/reports/types/index.js +9 -0
- package/dist/api/resources/transactions/client/Client.d.ts +8 -1
- package/dist/api/resources/transactions/client/Client.js +29 -2
- package/dist/api/resources/transactions/client/requests/CreateTransactionRequest.d.ts +5 -5
- package/dist/api/resources/transactions/client/requests/ListTransactionsRequest.d.ts +13 -0
- package/dist/api/resources/transactions/client/requests/UpdateTransactionRequest.d.ts +4 -4
- package/dist/api/resources/transactions/types/ListTransactionsRequestSort.d.ts +6 -0
- package/dist/api/resources/transactions/types/ListTransactionsRequestSort.js +6 -0
- package/dist/api/resources/transactions/types/ListTransactionsResponse.d.ts +4 -0
- package/dist/api/resources/transactions/types/index.d.ts +1 -0
- package/dist/api/resources/transactions/types/index.js +1 -0
- package/dist/api/types/BulkResult.d.ts +24 -0
- package/dist/api/types/BulkResult.js +14 -0
- package/dist/api/types/Click.d.ts +5 -5
- package/dist/api/types/Commission.d.ts +13 -13
- package/dist/api/types/CreatedPartner.d.ts +19 -0
- package/dist/api/types/CreatedPartner.js +2 -0
- package/dist/api/types/Customer.d.ts +11 -11
- package/dist/api/types/EmbedToken.d.ts +4 -0
- package/dist/api/types/EmbedToken.js +2 -0
- package/dist/api/types/Error_.d.ts +34 -0
- package/dist/api/types/Error_.js +21 -1
- package/dist/api/types/Flow.d.ts +8 -8
- package/dist/api/types/Group.d.ts +9 -9
- package/dist/api/types/Link.d.ts +5 -5
- package/dist/api/types/Partner.d.ts +12 -8
- package/dist/api/types/Program.d.ts +8 -8
- package/dist/api/types/PromotionCode.d.ts +8 -8
- package/dist/api/types/ReportsCustomerStats.d.ts +6 -0
- package/dist/api/types/ReportsCustomerStats.js +2 -0
- package/dist/api/types/ReportsLinkRow.d.ts +12 -0
- package/dist/api/types/ReportsLinkRow.js +2 -0
- package/dist/api/types/ReportsOverview.d.ts +5 -5
- package/dist/api/types/ReportsPartnerRow.d.ts +15 -0
- package/dist/api/types/ReportsPartnerRow.js +2 -0
- package/dist/api/types/ReportsTimeseriesPoint.d.ts +10 -0
- package/dist/api/types/ReportsTimeseriesPoint.js +2 -0
- package/dist/api/types/Transaction.d.ts +17 -17
- package/dist/api/types/index.d.ts +7 -0
- package/dist/api/types/index.js +7 -0
- package/dist/environments.d.ts +1 -1
- package/dist/environments.js +1 -1
- package/package.json +1 -1
- package/dist/api/resources/clicks/client/requests/ListClicksRequest.d.ts +0 -16
- package/dist/api/resources/clicks/types/ListClicksRequestOrder.d.ts +0 -5
- package/dist/api/resources/customers/types/CreateCustomerRequest.d.ts +0 -1
- /package/dist/api/resources/clicks/{client/requests/ListClicksRequest.js → types/CreateClickRequest.js} +0 -0
- /package/dist/api/resources/clicks/types/{ListClicksResponse.js → CreateClickResponse.js} +0 -0
- /package/dist/api/resources/{customers/types/CreateCustomerRequest.js → commissions/client/requests/BulkApproveCommissionsRequest.js} +0 -0
|
@@ -11,13 +11,12 @@ export class ReportsClient {
|
|
|
11
11
|
this._options = normalizeClientOptionsWithAuth(options);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
|
-
* Aggregate revenue and commission totals (grouped by currency) plus commission, customer, and partner counts for the organization. Supports optional program_id and start_date/end_date filters.
|
|
15
|
-
*
|
|
16
14
|
* @param {ToltApi.ReportsOverviewRequest} request
|
|
17
15
|
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
18
16
|
*
|
|
19
17
|
* @throws {@link ToltApi.BadRequestError}
|
|
20
18
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
19
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
21
20
|
* @throws {@link errors.ToltApiError}
|
|
22
21
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
23
22
|
*
|
|
@@ -62,6 +61,8 @@ export class ReportsClient {
|
|
|
62
61
|
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
63
62
|
case 401:
|
|
64
63
|
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
64
|
+
case 429:
|
|
65
|
+
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
65
66
|
default:
|
|
66
67
|
throw new errors.ToltApiError({
|
|
67
68
|
statusCode: _response.error.statusCode,
|
|
@@ -72,4 +73,265 @@ export class ReportsClient {
|
|
|
72
73
|
}
|
|
73
74
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/overview");
|
|
74
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* @param {ToltApi.ReportsPartnersRequest} request
|
|
78
|
+
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
+
*
|
|
80
|
+
* @throws {@link ToltApi.BadRequestError}
|
|
81
|
+
* @throws {@link ToltApi.UnauthorizedError}
|
|
82
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
83
|
+
* @throws {@link errors.ToltApiError}
|
|
84
|
+
* @throws {@link errors.ToltApiTimeoutError}
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* await client.reports.partners()
|
|
88
|
+
*/
|
|
89
|
+
partners(request = {}, requestOptions) {
|
|
90
|
+
return core.HttpResponsePromise.fromPromise(this.__partners(request, requestOptions));
|
|
91
|
+
}
|
|
92
|
+
async __partners(request = {}, requestOptions) {
|
|
93
|
+
const { program_id: programId, start_date: startDate, end_date: endDate, limit, offset, sort, order } = request;
|
|
94
|
+
const _queryParams = {
|
|
95
|
+
program_id: programId,
|
|
96
|
+
start_date: startDate != null ? startDate : undefined,
|
|
97
|
+
end_date: endDate != null ? endDate : undefined,
|
|
98
|
+
limit,
|
|
99
|
+
offset,
|
|
100
|
+
sort: sort != null ? sort : undefined,
|
|
101
|
+
order: order != null ? order : undefined,
|
|
102
|
+
};
|
|
103
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
104
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
105
|
+
const _response = await core.fetcher({
|
|
106
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
107
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
108
|
+
environments.ToltApiEnvironment.Production, "v2/reports/partners"),
|
|
109
|
+
method: "GET",
|
|
110
|
+
headers: _headers,
|
|
111
|
+
queryString: core.url
|
|
112
|
+
.queryBuilder()
|
|
113
|
+
.addMany(_queryParams)
|
|
114
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
115
|
+
.build(),
|
|
116
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
117
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
118
|
+
abortSignal: requestOptions?.abortSignal,
|
|
119
|
+
fetchFn: this._options?.fetch,
|
|
120
|
+
logging: this._options.logging,
|
|
121
|
+
});
|
|
122
|
+
if (_response.ok) {
|
|
123
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
124
|
+
}
|
|
125
|
+
if (_response.error.reason === "status-code") {
|
|
126
|
+
switch (_response.error.statusCode) {
|
|
127
|
+
case 400:
|
|
128
|
+
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
129
|
+
case 401:
|
|
130
|
+
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
131
|
+
case 429:
|
|
132
|
+
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
133
|
+
default:
|
|
134
|
+
throw new errors.ToltApiError({
|
|
135
|
+
statusCode: _response.error.statusCode,
|
|
136
|
+
body: _response.error.body,
|
|
137
|
+
rawResponse: _response.rawResponse,
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/partners");
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @param {ToltApi.ReportsLinksRequest} request
|
|
145
|
+
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
146
|
+
*
|
|
147
|
+
* @throws {@link ToltApi.BadRequestError}
|
|
148
|
+
* @throws {@link ToltApi.UnauthorizedError}
|
|
149
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
150
|
+
* @throws {@link errors.ToltApiError}
|
|
151
|
+
* @throws {@link errors.ToltApiTimeoutError}
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* await client.reports.links()
|
|
155
|
+
*/
|
|
156
|
+
links(request = {}, requestOptions) {
|
|
157
|
+
return core.HttpResponsePromise.fromPromise(this.__links(request, requestOptions));
|
|
158
|
+
}
|
|
159
|
+
async __links(request = {}, requestOptions) {
|
|
160
|
+
const { program_id: programId, start_date: startDate, end_date: endDate, limit, offset, sort, order } = request;
|
|
161
|
+
const _queryParams = {
|
|
162
|
+
program_id: programId,
|
|
163
|
+
start_date: startDate != null ? startDate : undefined,
|
|
164
|
+
end_date: endDate != null ? endDate : undefined,
|
|
165
|
+
limit,
|
|
166
|
+
offset,
|
|
167
|
+
sort: sort != null ? sort : undefined,
|
|
168
|
+
order: order != null ? order : undefined,
|
|
169
|
+
};
|
|
170
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
171
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
172
|
+
const _response = await core.fetcher({
|
|
173
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
174
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
175
|
+
environments.ToltApiEnvironment.Production, "v2/reports/links"),
|
|
176
|
+
method: "GET",
|
|
177
|
+
headers: _headers,
|
|
178
|
+
queryString: core.url
|
|
179
|
+
.queryBuilder()
|
|
180
|
+
.addMany(_queryParams)
|
|
181
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
182
|
+
.build(),
|
|
183
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
184
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
185
|
+
abortSignal: requestOptions?.abortSignal,
|
|
186
|
+
fetchFn: this._options?.fetch,
|
|
187
|
+
logging: this._options.logging,
|
|
188
|
+
});
|
|
189
|
+
if (_response.ok) {
|
|
190
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
191
|
+
}
|
|
192
|
+
if (_response.error.reason === "status-code") {
|
|
193
|
+
switch (_response.error.statusCode) {
|
|
194
|
+
case 400:
|
|
195
|
+
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
196
|
+
case 401:
|
|
197
|
+
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
198
|
+
case 429:
|
|
199
|
+
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
200
|
+
default:
|
|
201
|
+
throw new errors.ToltApiError({
|
|
202
|
+
statusCode: _response.error.statusCode,
|
|
203
|
+
body: _response.error.body,
|
|
204
|
+
rawResponse: _response.rawResponse,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/links");
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* @param {ToltApi.ReportsTimeseriesRequest} request
|
|
212
|
+
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
213
|
+
*
|
|
214
|
+
* @throws {@link ToltApi.BadRequestError}
|
|
215
|
+
* @throws {@link ToltApi.UnauthorizedError}
|
|
216
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
217
|
+
* @throws {@link errors.ToltApiError}
|
|
218
|
+
* @throws {@link errors.ToltApiTimeoutError}
|
|
219
|
+
*
|
|
220
|
+
* @example
|
|
221
|
+
* await client.reports.timeseries()
|
|
222
|
+
*/
|
|
223
|
+
timeseries(request = {}, requestOptions) {
|
|
224
|
+
return core.HttpResponsePromise.fromPromise(this.__timeseries(request, requestOptions));
|
|
225
|
+
}
|
|
226
|
+
async __timeseries(request = {}, requestOptions) {
|
|
227
|
+
const { program_id: programId, start_date: startDate, end_date: endDate, granularity } = request;
|
|
228
|
+
const _queryParams = {
|
|
229
|
+
program_id: programId,
|
|
230
|
+
start_date: startDate != null ? startDate : undefined,
|
|
231
|
+
end_date: endDate != null ? endDate : undefined,
|
|
232
|
+
granularity: granularity != null ? granularity : undefined,
|
|
233
|
+
};
|
|
234
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
235
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
236
|
+
const _response = await core.fetcher({
|
|
237
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
238
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
239
|
+
environments.ToltApiEnvironment.Production, "v2/reports/timeseries"),
|
|
240
|
+
method: "GET",
|
|
241
|
+
headers: _headers,
|
|
242
|
+
queryString: core.url
|
|
243
|
+
.queryBuilder()
|
|
244
|
+
.addMany(_queryParams)
|
|
245
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
246
|
+
.build(),
|
|
247
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
248
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
249
|
+
abortSignal: requestOptions?.abortSignal,
|
|
250
|
+
fetchFn: this._options?.fetch,
|
|
251
|
+
logging: this._options.logging,
|
|
252
|
+
});
|
|
253
|
+
if (_response.ok) {
|
|
254
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
255
|
+
}
|
|
256
|
+
if (_response.error.reason === "status-code") {
|
|
257
|
+
switch (_response.error.statusCode) {
|
|
258
|
+
case 400:
|
|
259
|
+
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
260
|
+
case 401:
|
|
261
|
+
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
262
|
+
case 429:
|
|
263
|
+
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
264
|
+
default:
|
|
265
|
+
throw new errors.ToltApiError({
|
|
266
|
+
statusCode: _response.error.statusCode,
|
|
267
|
+
body: _response.error.body,
|
|
268
|
+
rawResponse: _response.rawResponse,
|
|
269
|
+
});
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/timeseries");
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* @param {ToltApi.ReportsCustomerStatsRequest} request
|
|
276
|
+
* @param {ReportsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
277
|
+
*
|
|
278
|
+
* @throws {@link ToltApi.BadRequestError}
|
|
279
|
+
* @throws {@link ToltApi.UnauthorizedError}
|
|
280
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
281
|
+
* @throws {@link errors.ToltApiError}
|
|
282
|
+
* @throws {@link errors.ToltApiTimeoutError}
|
|
283
|
+
*
|
|
284
|
+
* @example
|
|
285
|
+
* await client.reports.customerStats()
|
|
286
|
+
*/
|
|
287
|
+
customerStats(request = {}, requestOptions) {
|
|
288
|
+
return core.HttpResponsePromise.fromPromise(this.__customerStats(request, requestOptions));
|
|
289
|
+
}
|
|
290
|
+
async __customerStats(request = {}, requestOptions) {
|
|
291
|
+
const { program_id: programId, start_date: startDate, end_date: endDate } = request;
|
|
292
|
+
const _queryParams = {
|
|
293
|
+
program_id: programId,
|
|
294
|
+
start_date: startDate != null ? startDate : undefined,
|
|
295
|
+
end_date: endDate != null ? endDate : undefined,
|
|
296
|
+
};
|
|
297
|
+
const _authRequest = await this._options.authProvider.getAuthRequest();
|
|
298
|
+
const _headers = mergeHeaders(_authRequest.headers, this._options?.headers, requestOptions?.headers);
|
|
299
|
+
const _response = await core.fetcher({
|
|
300
|
+
url: core.url.join((await core.Supplier.get(this._options.baseUrl)) ??
|
|
301
|
+
(await core.Supplier.get(this._options.environment)) ??
|
|
302
|
+
environments.ToltApiEnvironment.Production, "v2/reports/customers"),
|
|
303
|
+
method: "GET",
|
|
304
|
+
headers: _headers,
|
|
305
|
+
queryString: core.url
|
|
306
|
+
.queryBuilder()
|
|
307
|
+
.addMany(_queryParams)
|
|
308
|
+
.mergeAdditional(requestOptions?.queryParams)
|
|
309
|
+
.build(),
|
|
310
|
+
timeoutMs: (requestOptions?.timeoutInSeconds ?? this._options?.timeoutInSeconds ?? 60) * 1000,
|
|
311
|
+
maxRetries: requestOptions?.maxRetries ?? this._options?.maxRetries,
|
|
312
|
+
abortSignal: requestOptions?.abortSignal,
|
|
313
|
+
fetchFn: this._options?.fetch,
|
|
314
|
+
logging: this._options.logging,
|
|
315
|
+
});
|
|
316
|
+
if (_response.ok) {
|
|
317
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
318
|
+
}
|
|
319
|
+
if (_response.error.reason === "status-code") {
|
|
320
|
+
switch (_response.error.statusCode) {
|
|
321
|
+
case 400:
|
|
322
|
+
throw new ToltApi.BadRequestError(_response.error.body, _response.rawResponse);
|
|
323
|
+
case 401:
|
|
324
|
+
throw new ToltApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
325
|
+
case 429:
|
|
326
|
+
throw new ToltApi.TooManyRequestsError(_response.error.body, _response.rawResponse);
|
|
327
|
+
default:
|
|
328
|
+
throw new errors.ToltApiError({
|
|
329
|
+
statusCode: _response.error.statusCode,
|
|
330
|
+
body: _response.error.body,
|
|
331
|
+
rawResponse: _response.rawResponse,
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/reports/customers");
|
|
336
|
+
}
|
|
75
337
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as ToltApi from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface ReportsLinksRequest {
|
|
7
|
+
program_id?: string;
|
|
8
|
+
start_date?: string;
|
|
9
|
+
end_date?: string;
|
|
10
|
+
limit?: number;
|
|
11
|
+
offset?: number | null;
|
|
12
|
+
sort?: ToltApi.ReportsLinksRequestSort;
|
|
13
|
+
order?: ToltApi.ReportsLinksRequestOrder;
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type * as ToltApi from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface ReportsPartnersRequest {
|
|
7
|
+
program_id?: string;
|
|
8
|
+
start_date?: string;
|
|
9
|
+
end_date?: string;
|
|
10
|
+
limit?: number;
|
|
11
|
+
offset?: number | null;
|
|
12
|
+
sort?: ToltApi.ReportsPartnersRequestSort;
|
|
13
|
+
order?: ToltApi.ReportsPartnersRequestOrder;
|
|
14
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as ToltApi from "../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface ReportsTimeseriesRequest {
|
|
7
|
+
program_id?: string;
|
|
8
|
+
start_date?: string;
|
|
9
|
+
end_date?: string;
|
|
10
|
+
granularity?: ToltApi.ReportsTimeseriesRequestGranularity;
|
|
11
|
+
}
|
|
@@ -1 +1,5 @@
|
|
|
1
|
+
export type { ReportsCustomerStatsRequest } from "./ReportsCustomerStatsRequest.js";
|
|
2
|
+
export type { ReportsLinksRequest } from "./ReportsLinksRequest.js";
|
|
1
3
|
export type { ReportsOverviewRequest } from "./ReportsOverviewRequest.js";
|
|
4
|
+
export type { ReportsPartnersRequest } from "./ReportsPartnersRequest.js";
|
|
5
|
+
export type { ReportsTimeseriesRequest } from "./ReportsTimeseriesRequest.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ReportsLinksRequestSort: {
|
|
2
|
+
readonly Revenue: "revenue";
|
|
3
|
+
readonly Commissions: "commissions";
|
|
4
|
+
readonly Clicks: "clicks";
|
|
5
|
+
readonly Customers: "customers";
|
|
6
|
+
};
|
|
7
|
+
export type ReportsLinksRequestSort = (typeof ReportsLinksRequestSort)[keyof typeof ReportsLinksRequestSort];
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ReportsPartnersRequestSort: {
|
|
2
|
+
readonly Revenue: "revenue";
|
|
3
|
+
readonly Commissions: "commissions";
|
|
4
|
+
readonly Clicks: "clicks";
|
|
5
|
+
readonly Customers: "customers";
|
|
6
|
+
};
|
|
7
|
+
export type ReportsPartnersRequestSort = (typeof ReportsPartnersRequestSort)[keyof typeof ReportsPartnersRequestSort];
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ReportsTimeseriesRequestGranularity: {
|
|
2
|
+
readonly Day: "day";
|
|
3
|
+
readonly Week: "week";
|
|
4
|
+
readonly Month: "month";
|
|
5
|
+
};
|
|
6
|
+
export type ReportsTimeseriesRequestGranularity = (typeof ReportsTimeseriesRequestGranularity)[keyof typeof ReportsTimeseriesRequestGranularity];
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
export * from "./ReportsCustomerStatsResponse.js";
|
|
2
|
+
export * from "./ReportsLinksRequestOrder.js";
|
|
3
|
+
export * from "./ReportsLinksRequestSort.js";
|
|
4
|
+
export * from "./ReportsLinksResponse.js";
|
|
1
5
|
export * from "./ReportsOverviewResponse.js";
|
|
6
|
+
export * from "./ReportsPartnersRequestOrder.js";
|
|
7
|
+
export * from "./ReportsPartnersRequestSort.js";
|
|
8
|
+
export * from "./ReportsPartnersResponse.js";
|
|
9
|
+
export * from "./ReportsTimeseriesRequestGranularity.js";
|
|
10
|
+
export * from "./ReportsTimeseriesResponse.js";
|
|
@@ -1 +1,10 @@
|
|
|
1
|
+
export * from "./ReportsCustomerStatsResponse.js";
|
|
2
|
+
export * from "./ReportsLinksRequestOrder.js";
|
|
3
|
+
export * from "./ReportsLinksRequestSort.js";
|
|
4
|
+
export * from "./ReportsLinksResponse.js";
|
|
1
5
|
export * from "./ReportsOverviewResponse.js";
|
|
6
|
+
export * from "./ReportsPartnersRequestOrder.js";
|
|
7
|
+
export * from "./ReportsPartnersRequestSort.js";
|
|
8
|
+
export * from "./ReportsPartnersResponse.js";
|
|
9
|
+
export * from "./ReportsTimeseriesRequestGranularity.js";
|
|
10
|
+
export * from "./ReportsTimeseriesResponse.js";
|
|
@@ -16,6 +16,7 @@ export declare class TransactionsClient {
|
|
|
16
16
|
*
|
|
17
17
|
* @throws {@link ToltApi.BadRequestError}
|
|
18
18
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
19
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
19
20
|
* @throws {@link errors.ToltApiError}
|
|
20
21
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
21
22
|
*
|
|
@@ -30,13 +31,14 @@ export declare class TransactionsClient {
|
|
|
30
31
|
*
|
|
31
32
|
* @throws {@link ToltApi.BadRequestError}
|
|
32
33
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
34
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
33
35
|
* @throws {@link errors.ToltApiError}
|
|
34
36
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
35
37
|
*
|
|
36
38
|
* @example
|
|
37
39
|
* await client.transactions.createTransaction({
|
|
38
40
|
* amount: 1,
|
|
39
|
-
*
|
|
41
|
+
* customer_id: "customer_id"
|
|
40
42
|
* })
|
|
41
43
|
*/
|
|
42
44
|
createTransaction(request: ToltApi.CreateTransactionRequest, requestOptions?: TransactionsClient.RequestOptions): core.HttpResponsePromise<ToltApi.CreateTransactionResponse>;
|
|
@@ -47,6 +49,7 @@ export declare class TransactionsClient {
|
|
|
47
49
|
*
|
|
48
50
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
49
51
|
* @throws {@link ToltApi.NotFoundError}
|
|
52
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
50
53
|
* @throws {@link errors.ToltApiError}
|
|
51
54
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
52
55
|
*
|
|
@@ -65,6 +68,7 @@ export declare class TransactionsClient {
|
|
|
65
68
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
66
69
|
* @throws {@link ToltApi.NotFoundError}
|
|
67
70
|
* @throws {@link ToltApi.ConflictError}
|
|
71
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
68
72
|
* @throws {@link errors.ToltApiError}
|
|
69
73
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
70
74
|
*
|
|
@@ -82,6 +86,7 @@ export declare class TransactionsClient {
|
|
|
82
86
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
83
87
|
* @throws {@link ToltApi.NotFoundError}
|
|
84
88
|
* @throws {@link ToltApi.ConflictError}
|
|
89
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
85
90
|
* @throws {@link errors.ToltApiError}
|
|
86
91
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
87
92
|
*
|
|
@@ -99,6 +104,7 @@ export declare class TransactionsClient {
|
|
|
99
104
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
100
105
|
* @throws {@link ToltApi.NotFoundError}
|
|
101
106
|
* @throws {@link ToltApi.ConflictError}
|
|
107
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
102
108
|
* @throws {@link errors.ToltApiError}
|
|
103
109
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
104
110
|
*
|
|
@@ -118,6 +124,7 @@ export declare class TransactionsClient {
|
|
|
118
124
|
* @throws {@link ToltApi.UnauthorizedError}
|
|
119
125
|
* @throws {@link ToltApi.NotFoundError}
|
|
120
126
|
* @throws {@link ToltApi.ConflictError}
|
|
127
|
+
* @throws {@link ToltApi.TooManyRequestsError}
|
|
121
128
|
* @throws {@link errors.ToltApiError}
|
|
122
129
|
* @throws {@link errors.ToltApiTimeoutError}
|
|
123
130
|
*
|