@kard-financial/sdk 29.2.0 → 30.0.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/LICENSE +21 -0
- package/dist/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/users/resources/attributions/client/Client.d.ts +2 -2
- package/dist/cjs/api/resources/users/resources/attributions/client/Client.js +2 -2
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.d.ts +6 -59
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.js +6 -162
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/index.d.ts +0 -2
- package/dist/cjs/api/resources/users/resources/rewards/types/PlacementContentResponse.d.ts +2 -7
- package/dist/cjs/api/resources/users/resources/rewards/types/index.d.ts +0 -1
- package/dist/cjs/api/resources/users/resources/rewards/types/index.js +0 -1
- package/dist/cjs/version.d.ts +1 -1
- package/dist/cjs/version.js +1 -1
- package/dist/esm/BaseClient.mjs +2 -2
- package/dist/esm/api/resources/users/resources/attributions/client/Client.d.mts +2 -2
- package/dist/esm/api/resources/users/resources/attributions/client/Client.mjs +2 -2
- package/dist/esm/api/resources/users/resources/rewards/client/Client.d.mts +6 -59
- package/dist/esm/api/resources/users/resources/rewards/client/Client.mjs +6 -162
- package/dist/esm/api/resources/users/resources/rewards/client/requests/index.d.mts +0 -2
- package/dist/esm/api/resources/users/resources/rewards/types/PlacementContentResponse.d.mts +2 -7
- package/dist/esm/api/resources/users/resources/rewards/types/index.d.mts +0 -1
- package/dist/esm/api/resources/users/resources/rewards/types/index.mjs +0 -1
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +8 -197
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.ts +0 -9
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.js +0 -3
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.d.ts +0 -16
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.js +0 -3
- package/dist/cjs/api/resources/users/resources/rewards/types/PlacementContentData.d.ts +0 -5
- package/dist/cjs/api/resources/users/resources/rewards/types/PlacementContentData.js +0 -3
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.mts +0 -9
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.mjs +0 -2
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.d.mts +0 -16
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.mjs +0 -2
- package/dist/esm/api/resources/users/resources/rewards/types/PlacementContentData.d.mts +0 -5
- package/dist/esm/api/resources/users/resources/rewards/types/PlacementContentData.mjs +0 -2
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Kard Financial
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@kard-financial/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "
|
|
47
|
-
"User-Agent": "@kard-financial/sdk/
|
|
46
|
+
"X-Fern-SDK-Version": "30.0.0",
|
|
47
|
+
"User-Agent": "@kard-financial/sdk/30.0.0",
|
|
48
48
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
49
49
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
50
50
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -98,8 +98,8 @@ export declare class AttributionsClient {
|
|
|
98
98
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
99
99
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
100
100
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
101
|
-
* partner can render the batch immediately without an extra
|
|
102
|
-
*
|
|
101
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
102
|
+
* the placement content.
|
|
103
103
|
*
|
|
104
104
|
* <b>Required scopes:</b> `attributions:write`
|
|
105
105
|
*
|
|
@@ -284,8 +284,8 @@ class AttributionsClient {
|
|
|
284
284
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
285
285
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
286
286
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
287
|
-
* partner can render the batch immediately without an extra
|
|
288
|
-
*
|
|
287
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
288
|
+
* the placement content.
|
|
289
289
|
*
|
|
290
290
|
* <b>Required scopes:</b> `attributions:write`
|
|
291
291
|
*
|
|
@@ -35,69 +35,16 @@ export declare class RewardsClient {
|
|
|
35
35
|
*/
|
|
36
36
|
offers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, request?: KardApi.users.GetOffersByUserRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
37
37
|
private __offers;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieve offers for a placement slot. Returns offers sorted by highest cash back,
|
|
40
|
-
* limited by the placement's available slots.<br/>
|
|
41
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
42
|
-
*
|
|
43
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
44
|
-
* @param {KardApi.UserId} userId
|
|
45
|
-
* @param {string} placementId
|
|
46
|
-
* @param {KardApi.users.GetOffersByPlacementRequest} request
|
|
47
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
|
-
*
|
|
49
|
-
* @throws {@link KardApi.InternalServerError}
|
|
50
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
51
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
52
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* await client.users.rewards.placementOffers("organizationId", "userId", "placementId")
|
|
56
|
-
*/
|
|
57
|
-
placementOffers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetOffersByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
58
|
-
private __placementOffers;
|
|
59
|
-
/**
|
|
60
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
61
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
62
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
63
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
64
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
65
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
66
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
67
|
-
* still returned and stays active so the partner UI does not promote
|
|
68
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
69
|
-
* active and each slot returns its offers regardless of activation state,
|
|
70
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
71
|
-
* no activation record.<br/>
|
|
72
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
73
|
-
*
|
|
74
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
75
|
-
* @param {KardApi.UserId} userId
|
|
76
|
-
* @param {string} placementId
|
|
77
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
78
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
-
*
|
|
80
|
-
* @throws {@link KardApi.InternalServerError}
|
|
81
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
82
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
83
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
87
|
-
*/
|
|
88
|
-
placementBatches(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetBatchesByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BatchesResponseObject>;
|
|
89
|
-
private __placementBatches;
|
|
90
38
|
/**
|
|
91
39
|
* Retrieve the content for a placement. The placement type is resolved
|
|
92
40
|
* server-side so callers no longer pick an endpoint by placement type.
|
|
93
41
|
* Returns a JSON:API document whose `data` resources are self-describing
|
|
94
|
-
* by `type`: a standard placement returns `standardOffer` resources (
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `
|
|
100
|
-
* this endpoint and respond with a `400`.<br/>
|
|
42
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
43
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
44
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
45
|
+
* the two by each resource's `type`. Email and push-notification
|
|
46
|
+
* placements are not servable through this endpoint and respond with a
|
|
47
|
+
* `400`.<br/>
|
|
101
48
|
* <b>Required scopes:</b> `rewards:read`
|
|
102
49
|
*
|
|
103
50
|
* @param {KardApi.OrganizationId} organizationId
|
|
@@ -139,172 +139,16 @@ class RewardsClient {
|
|
|
139
139
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/offers");
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
|
-
/**
|
|
143
|
-
* Retrieve offers for a placement slot. Returns offers sorted by highest cash back,
|
|
144
|
-
* limited by the placement's available slots.<br/>
|
|
145
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
146
|
-
*
|
|
147
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
148
|
-
* @param {KardApi.UserId} userId
|
|
149
|
-
* @param {string} placementId
|
|
150
|
-
* @param {KardApi.users.GetOffersByPlacementRequest} request
|
|
151
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
152
|
-
*
|
|
153
|
-
* @throws {@link KardApi.InternalServerError}
|
|
154
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
155
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
156
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
157
|
-
*
|
|
158
|
-
* @example
|
|
159
|
-
* await client.users.rewards.placementOffers("organizationId", "userId", "placementId")
|
|
160
|
-
*/
|
|
161
|
-
placementOffers(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
162
|
-
return core.HttpResponsePromise.fromPromise(this.__placementOffers(organizationId, userId, placementId, request, requestOptions));
|
|
163
|
-
}
|
|
164
|
-
__placementOffers(organizationId_1, userId_1, placementId_1) {
|
|
165
|
-
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
166
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
167
|
-
const { "filter[search]": filterSearch, "filter[purchaseChannel]": filterPurchaseChannel, "filter[category]": filterCategory, "filter[isTargeted]": filterIsTargeted, include, supportedComponents, } = request;
|
|
168
|
-
const _queryParams = {
|
|
169
|
-
"filter[search]": filterSearch,
|
|
170
|
-
"filter[purchaseChannel]": filterPurchaseChannel != null ? (0, json_js_1.toJson)(filterPurchaseChannel) : undefined,
|
|
171
|
-
"filter[category]": filterCategory != null ? filterCategory : undefined,
|
|
172
|
-
"filter[isTargeted]": filterIsTargeted,
|
|
173
|
-
include,
|
|
174
|
-
supportedComponents: Array.isArray(supportedComponents)
|
|
175
|
-
? supportedComponents.map((item) => item)
|
|
176
|
-
: supportedComponents != null
|
|
177
|
-
? supportedComponents
|
|
178
|
-
: undefined,
|
|
179
|
-
};
|
|
180
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
181
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
182
|
-
const _response = yield core.fetcher({
|
|
183
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/offers`),
|
|
184
|
-
method: "GET",
|
|
185
|
-
headers: _headers,
|
|
186
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
187
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
188
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
189
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
190
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
191
|
-
logging: this._options.logging,
|
|
192
|
-
});
|
|
193
|
-
if (_response.ok) {
|
|
194
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
195
|
-
}
|
|
196
|
-
if (_response.error.reason === "status-code") {
|
|
197
|
-
switch (_response.error.statusCode) {
|
|
198
|
-
case 500:
|
|
199
|
-
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
200
|
-
case 400:
|
|
201
|
-
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
202
|
-
case 404:
|
|
203
|
-
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
204
|
-
case 401:
|
|
205
|
-
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
206
|
-
default:
|
|
207
|
-
throw new errors.KardApiError({
|
|
208
|
-
statusCode: _response.error.statusCode,
|
|
209
|
-
body: _response.error.body,
|
|
210
|
-
rawResponse: _response.rawResponse,
|
|
211
|
-
});
|
|
212
|
-
}
|
|
213
|
-
}
|
|
214
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/offers");
|
|
215
|
-
});
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
219
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
220
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
221
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
222
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
223
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
224
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
225
|
-
* still returned and stays active so the partner UI does not promote
|
|
226
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
227
|
-
* active and each slot returns its offers regardless of activation state,
|
|
228
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
229
|
-
* no activation record.<br/>
|
|
230
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
231
|
-
*
|
|
232
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
233
|
-
* @param {KardApi.UserId} userId
|
|
234
|
-
* @param {string} placementId
|
|
235
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
236
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
237
|
-
*
|
|
238
|
-
* @throws {@link KardApi.InternalServerError}
|
|
239
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
240
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
241
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
245
|
-
*/
|
|
246
|
-
placementBatches(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
247
|
-
return core.HttpResponsePromise.fromPromise(this.__placementBatches(organizationId, userId, placementId, request, requestOptions));
|
|
248
|
-
}
|
|
249
|
-
__placementBatches(organizationId_1, userId_1, placementId_1) {
|
|
250
|
-
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
251
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
252
|
-
const { supportedComponents } = request;
|
|
253
|
-
const _queryParams = {
|
|
254
|
-
supportedComponents: Array.isArray(supportedComponents)
|
|
255
|
-
? supportedComponents.map((item) => item)
|
|
256
|
-
: supportedComponents != null
|
|
257
|
-
? supportedComponents
|
|
258
|
-
: undefined,
|
|
259
|
-
};
|
|
260
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
261
|
-
const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
262
|
-
const _response = yield core.fetcher({
|
|
263
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/batches`),
|
|
264
|
-
method: "GET",
|
|
265
|
-
headers: _headers,
|
|
266
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
267
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
268
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
269
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
270
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
271
|
-
logging: this._options.logging,
|
|
272
|
-
});
|
|
273
|
-
if (_response.ok) {
|
|
274
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
275
|
-
}
|
|
276
|
-
if (_response.error.reason === "status-code") {
|
|
277
|
-
switch (_response.error.statusCode) {
|
|
278
|
-
case 500:
|
|
279
|
-
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
280
|
-
case 400:
|
|
281
|
-
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
282
|
-
case 404:
|
|
283
|
-
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
284
|
-
case 401:
|
|
285
|
-
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
286
|
-
default:
|
|
287
|
-
throw new errors.KardApiError({
|
|
288
|
-
statusCode: _response.error.statusCode,
|
|
289
|
-
body: _response.error.body,
|
|
290
|
-
rawResponse: _response.rawResponse,
|
|
291
|
-
});
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/batches");
|
|
295
|
-
});
|
|
296
|
-
}
|
|
297
142
|
/**
|
|
298
143
|
* Retrieve the content for a placement. The placement type is resolved
|
|
299
144
|
* server-side so callers no longer pick an endpoint by placement type.
|
|
300
145
|
* Returns a JSON:API document whose `data` resources are self-describing
|
|
301
|
-
* by `type`: a standard placement returns `standardOffer` resources (
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
306
|
-
* `
|
|
307
|
-
* this endpoint and respond with a `400`.<br/>
|
|
146
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
147
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
148
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
149
|
+
* the two by each resource's `type`. Email and push-notification
|
|
150
|
+
* placements are not servable through this endpoint and respond with a
|
|
151
|
+
* `400`.<br/>
|
|
308
152
|
* <b>Required scopes:</b> `rewards:read`
|
|
309
153
|
*
|
|
310
154
|
* @param {KardApi.OrganizationId} organizationId
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementRequest.js";
|
|
2
1
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.js";
|
|
3
|
-
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.js";
|
|
4
2
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.js";
|
|
5
3
|
export type { GetPlacementContentRequest } from "./GetPlacementContentRequest.js";
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type * as KardApi from "../../../../../index.js";
|
|
2
2
|
/**
|
|
3
|
-
* Combined placement-content response
|
|
3
|
+
* Combined placement-content response. The placement is resolved server-side and the response is returned verbatim as one of two variants: a standard placement yields the offers response (`standardOffer` resources with `links`, optional `included` categories, and `meta`), while a batch-activation or group placement yields the batches response (`placementBatch` slot resources). Callers distinguish the two by each resource's `type` rather than a separate discriminator.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
data: KardApi.users.PlacementContentData[];
|
|
7
|
-
links?: KardApi.Links | undefined;
|
|
8
|
-
included?: KardApi.users.EligibilityOfferIncluded[] | undefined;
|
|
9
|
-
meta?: KardApi.users.OffersMeta | undefined;
|
|
10
|
-
}
|
|
5
|
+
export type PlacementContentResponse = KardApi.users.OffersResponseObject | KardApi.users.BatchesResponseObject;
|
|
@@ -41,7 +41,6 @@ export * from "./OperationPeriod.js";
|
|
|
41
41
|
export * from "./OperationTime.js";
|
|
42
42
|
export * from "./PlacementBatchAttributes.js";
|
|
43
43
|
export * from "./PlacementBatchData.js";
|
|
44
|
-
export * from "./PlacementContentData.js";
|
|
45
44
|
export * from "./PlacementContentResponse.js";
|
|
46
45
|
export * from "./ProgressBar.js";
|
|
47
46
|
export * from "./ProgressBarLabelPair.js";
|
|
@@ -57,7 +57,6 @@ __exportStar(require("./OperationPeriod.js"), exports);
|
|
|
57
57
|
__exportStar(require("./OperationTime.js"), exports);
|
|
58
58
|
__exportStar(require("./PlacementBatchAttributes.js"), exports);
|
|
59
59
|
__exportStar(require("./PlacementBatchData.js"), exports);
|
|
60
|
-
__exportStar(require("./PlacementContentData.js"), exports);
|
|
61
60
|
__exportStar(require("./PlacementContentResponse.js"), exports);
|
|
62
61
|
__exportStar(require("./ProgressBar.js"), exports);
|
|
63
62
|
__exportStar(require("./ProgressBarLabelPair.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "30.0.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@kard-financial/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/
|
|
9
|
+
"X-Fern-SDK-Version": "30.0.0",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/30.0.0",
|
|
11
11
|
"X-Fern-Runtime": core.RUNTIME.type,
|
|
12
12
|
"X-Fern-Runtime-Version": core.RUNTIME.version,
|
|
13
13
|
}, options === null || options === void 0 ? void 0 : options.headers);
|
|
@@ -98,8 +98,8 @@ export declare class AttributionsClient {
|
|
|
98
98
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
99
99
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
100
100
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
101
|
-
* partner can render the batch immediately without an extra
|
|
102
|
-
*
|
|
101
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
102
|
+
* the placement content.
|
|
103
103
|
*
|
|
104
104
|
* <b>Required scopes:</b> `attributions:write`
|
|
105
105
|
*
|
|
@@ -248,8 +248,8 @@ export class AttributionsClient {
|
|
|
248
248
|
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
249
249
|
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
250
250
|
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
251
|
-
* partner can render the batch immediately without an extra
|
|
252
|
-
*
|
|
251
|
+
* partner can render the batch immediately without an extra round-trip to re-fetch
|
|
252
|
+
* the placement content.
|
|
253
253
|
*
|
|
254
254
|
* <b>Required scopes:</b> `attributions:write`
|
|
255
255
|
*
|
|
@@ -35,69 +35,16 @@ export declare class RewardsClient {
|
|
|
35
35
|
*/
|
|
36
36
|
offers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, request?: KardApi.users.GetOffersByUserRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
37
37
|
private __offers;
|
|
38
|
-
/**
|
|
39
|
-
* Retrieve offers for a placement slot. Returns offers sorted by highest cash back,
|
|
40
|
-
* limited by the placement's available slots.<br/>
|
|
41
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
42
|
-
*
|
|
43
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
44
|
-
* @param {KardApi.UserId} userId
|
|
45
|
-
* @param {string} placementId
|
|
46
|
-
* @param {KardApi.users.GetOffersByPlacementRequest} request
|
|
47
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
48
|
-
*
|
|
49
|
-
* @throws {@link KardApi.InternalServerError}
|
|
50
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
51
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
52
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
53
|
-
*
|
|
54
|
-
* @example
|
|
55
|
-
* await client.users.rewards.placementOffers("organizationId", "userId", "placementId")
|
|
56
|
-
*/
|
|
57
|
-
placementOffers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetOffersByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
58
|
-
private __placementOffers;
|
|
59
|
-
/**
|
|
60
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
61
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
62
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
63
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
64
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
65
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
66
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
67
|
-
* still returned and stays active so the partner UI does not promote
|
|
68
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
69
|
-
* active and each slot returns its offers regardless of activation state,
|
|
70
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
71
|
-
* no activation record.<br/>
|
|
72
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
73
|
-
*
|
|
74
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
75
|
-
* @param {KardApi.UserId} userId
|
|
76
|
-
* @param {string} placementId
|
|
77
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
78
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
79
|
-
*
|
|
80
|
-
* @throws {@link KardApi.InternalServerError}
|
|
81
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
82
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
83
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
84
|
-
*
|
|
85
|
-
* @example
|
|
86
|
-
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
87
|
-
*/
|
|
88
|
-
placementBatches(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetBatchesByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BatchesResponseObject>;
|
|
89
|
-
private __placementBatches;
|
|
90
38
|
/**
|
|
91
39
|
* Retrieve the content for a placement. The placement type is resolved
|
|
92
40
|
* server-side so callers no longer pick an endpoint by placement type.
|
|
93
41
|
* Returns a JSON:API document whose `data` resources are self-describing
|
|
94
|
-
* by `type`: a standard placement returns `standardOffer` resources (
|
|
95
|
-
*
|
|
96
|
-
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
* `
|
|
100
|
-
* this endpoint and respond with a `400`.<br/>
|
|
42
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
43
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
44
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
45
|
+
* the two by each resource's `type`. Email and push-notification
|
|
46
|
+
* placements are not servable through this endpoint and respond with a
|
|
47
|
+
* `400`.<br/>
|
|
101
48
|
* <b>Required scopes:</b> `rewards:read`
|
|
102
49
|
*
|
|
103
50
|
* @param {KardApi.OrganizationId} organizationId
|
|
@@ -103,172 +103,16 @@ export class RewardsClient {
|
|
|
103
103
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/offers");
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
/**
|
|
107
|
-
* Retrieve offers for a placement slot. Returns offers sorted by highest cash back,
|
|
108
|
-
* limited by the placement's available slots.<br/>
|
|
109
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
110
|
-
*
|
|
111
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
112
|
-
* @param {KardApi.UserId} userId
|
|
113
|
-
* @param {string} placementId
|
|
114
|
-
* @param {KardApi.users.GetOffersByPlacementRequest} request
|
|
115
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
116
|
-
*
|
|
117
|
-
* @throws {@link KardApi.InternalServerError}
|
|
118
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
119
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
120
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
121
|
-
*
|
|
122
|
-
* @example
|
|
123
|
-
* await client.users.rewards.placementOffers("organizationId", "userId", "placementId")
|
|
124
|
-
*/
|
|
125
|
-
placementOffers(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
126
|
-
return core.HttpResponsePromise.fromPromise(this.__placementOffers(organizationId, userId, placementId, request, requestOptions));
|
|
127
|
-
}
|
|
128
|
-
__placementOffers(organizationId_1, userId_1, placementId_1) {
|
|
129
|
-
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
130
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
131
|
-
const { "filter[search]": filterSearch, "filter[purchaseChannel]": filterPurchaseChannel, "filter[category]": filterCategory, "filter[isTargeted]": filterIsTargeted, include, supportedComponents, } = request;
|
|
132
|
-
const _queryParams = {
|
|
133
|
-
"filter[search]": filterSearch,
|
|
134
|
-
"filter[purchaseChannel]": filterPurchaseChannel != null ? toJson(filterPurchaseChannel) : undefined,
|
|
135
|
-
"filter[category]": filterCategory != null ? filterCategory : undefined,
|
|
136
|
-
"filter[isTargeted]": filterIsTargeted,
|
|
137
|
-
include,
|
|
138
|
-
supportedComponents: Array.isArray(supportedComponents)
|
|
139
|
-
? supportedComponents.map((item) => item)
|
|
140
|
-
: supportedComponents != null
|
|
141
|
-
? supportedComponents
|
|
142
|
-
: undefined,
|
|
143
|
-
};
|
|
144
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
145
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
146
|
-
const _response = yield core.fetcher({
|
|
147
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/offers`),
|
|
148
|
-
method: "GET",
|
|
149
|
-
headers: _headers,
|
|
150
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
151
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
152
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
153
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
154
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
155
|
-
logging: this._options.logging,
|
|
156
|
-
});
|
|
157
|
-
if (_response.ok) {
|
|
158
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
159
|
-
}
|
|
160
|
-
if (_response.error.reason === "status-code") {
|
|
161
|
-
switch (_response.error.statusCode) {
|
|
162
|
-
case 500:
|
|
163
|
-
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
164
|
-
case 400:
|
|
165
|
-
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
166
|
-
case 404:
|
|
167
|
-
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
168
|
-
case 401:
|
|
169
|
-
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
170
|
-
default:
|
|
171
|
-
throw new errors.KardApiError({
|
|
172
|
-
statusCode: _response.error.statusCode,
|
|
173
|
-
body: _response.error.body,
|
|
174
|
-
rawResponse: _response.rawResponse,
|
|
175
|
-
});
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/offers");
|
|
179
|
-
});
|
|
180
|
-
}
|
|
181
|
-
/**
|
|
182
|
-
* Retrieve batches for a batch-activation or group placement. Returns each
|
|
183
|
-
* slot in slot order with its current offer set, alias, and freshness fields
|
|
184
|
-
* (`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
185
|
-
* eligibility and per-slot content-strategy filter as Get Offers By
|
|
186
|
-
* Placement, independently per slot. For a batch-activation placement, a
|
|
187
|
-
* slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
188
|
-
* AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
189
|
-
* still returned and stays active so the partner UI does not promote
|
|
190
|
-
* "refresh" with nothing to show. For a group placement, slots are always
|
|
191
|
-
* active and each slot returns its offers regardless of activation state,
|
|
192
|
-
* hiding only offers that require activation (`requiredInBatch`) and have
|
|
193
|
-
* no activation record.<br/>
|
|
194
|
-
* <b>Required scopes:</b> `rewards:read`
|
|
195
|
-
*
|
|
196
|
-
* @param {KardApi.OrganizationId} organizationId
|
|
197
|
-
* @param {KardApi.UserId} userId
|
|
198
|
-
* @param {string} placementId
|
|
199
|
-
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
200
|
-
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
201
|
-
*
|
|
202
|
-
* @throws {@link KardApi.InternalServerError}
|
|
203
|
-
* @throws {@link KardApi.InvalidRequest}
|
|
204
|
-
* @throws {@link KardApi.DoesNotExistError}
|
|
205
|
-
* @throws {@link KardApi.UnauthorizedError}
|
|
206
|
-
*
|
|
207
|
-
* @example
|
|
208
|
-
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
209
|
-
*/
|
|
210
|
-
placementBatches(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
211
|
-
return core.HttpResponsePromise.fromPromise(this.__placementBatches(organizationId, userId, placementId, request, requestOptions));
|
|
212
|
-
}
|
|
213
|
-
__placementBatches(organizationId_1, userId_1, placementId_1) {
|
|
214
|
-
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
215
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
216
|
-
const { supportedComponents } = request;
|
|
217
|
-
const _queryParams = {
|
|
218
|
-
supportedComponents: Array.isArray(supportedComponents)
|
|
219
|
-
? supportedComponents.map((item) => item)
|
|
220
|
-
: supportedComponents != null
|
|
221
|
-
? supportedComponents
|
|
222
|
-
: undefined,
|
|
223
|
-
};
|
|
224
|
-
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
225
|
-
const _headers = mergeHeaders(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
|
|
226
|
-
const _response = yield core.fetcher({
|
|
227
|
-
url: core.url.join((_c = (_b = (yield core.Supplier.get(this._options.baseUrl))) !== null && _b !== void 0 ? _b : (yield core.Supplier.get(this._options.environment))) !== null && _c !== void 0 ? _c : environments.KardApiEnvironment.Production, `/v2/issuers/${core.url.encodePathParam(organizationId)}/users/${core.url.encodePathParam(userId)}/placements/${core.url.encodePathParam(placementId)}/batches`),
|
|
228
|
-
method: "GET",
|
|
229
|
-
headers: _headers,
|
|
230
|
-
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
231
|
-
timeoutMs: ((_f = (_d = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _d !== void 0 ? _d : (_e = this._options) === null || _e === void 0 ? void 0 : _e.timeoutInSeconds) !== null && _f !== void 0 ? _f : 60) * 1000,
|
|
232
|
-
maxRetries: (_g = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _g !== void 0 ? _g : (_h = this._options) === null || _h === void 0 ? void 0 : _h.maxRetries,
|
|
233
|
-
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
234
|
-
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
235
|
-
logging: this._options.logging,
|
|
236
|
-
});
|
|
237
|
-
if (_response.ok) {
|
|
238
|
-
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
239
|
-
}
|
|
240
|
-
if (_response.error.reason === "status-code") {
|
|
241
|
-
switch (_response.error.statusCode) {
|
|
242
|
-
case 500:
|
|
243
|
-
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
244
|
-
case 400:
|
|
245
|
-
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
246
|
-
case 404:
|
|
247
|
-
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
248
|
-
case 401:
|
|
249
|
-
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
250
|
-
default:
|
|
251
|
-
throw new errors.KardApiError({
|
|
252
|
-
statusCode: _response.error.statusCode,
|
|
253
|
-
body: _response.error.body,
|
|
254
|
-
rawResponse: _response.rawResponse,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/batches");
|
|
259
|
-
});
|
|
260
|
-
}
|
|
261
106
|
/**
|
|
262
107
|
* Retrieve the content for a placement. The placement type is resolved
|
|
263
108
|
* server-side so callers no longer pick an endpoint by placement type.
|
|
264
109
|
* Returns a JSON:API document whose `data` resources are self-describing
|
|
265
|
-
* by `type`: a standard placement returns `standardOffer` resources (
|
|
266
|
-
*
|
|
267
|
-
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* `
|
|
271
|
-
* this endpoint and respond with a `400`.<br/>
|
|
110
|
+
* by `type`: a standard placement returns `standardOffer` resources (with
|
|
111
|
+
* `links`, optional `included` categories, and `meta`); a batch-activation
|
|
112
|
+
* or group placement returns `placementBatch` slot resources. Distinguish
|
|
113
|
+
* the two by each resource's `type`. Email and push-notification
|
|
114
|
+
* placements are not servable through this endpoint and respond with a
|
|
115
|
+
* `400`.<br/>
|
|
272
116
|
* <b>Required scopes:</b> `rewards:read`
|
|
273
117
|
*
|
|
274
118
|
* @param {KardApi.OrganizationId} organizationId
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementRequest.mjs";
|
|
2
1
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.mjs";
|
|
3
|
-
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.mjs";
|
|
4
2
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.mjs";
|
|
5
3
|
export type { GetPlacementContentRequest } from "./GetPlacementContentRequest.mjs";
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import type * as KardApi from "../../../../../index.mjs";
|
|
2
2
|
/**
|
|
3
|
-
* Combined placement-content response
|
|
3
|
+
* Combined placement-content response. The placement is resolved server-side and the response is returned verbatim as one of two variants: a standard placement yields the offers response (`standardOffer` resources with `links`, optional `included` categories, and `meta`), while a batch-activation or group placement yields the batches response (`placementBatch` slot resources). Callers distinguish the two by each resource's `type` rather than a separate discriminator.
|
|
4
4
|
*/
|
|
5
|
-
export
|
|
6
|
-
data: KardApi.users.PlacementContentData[];
|
|
7
|
-
links?: KardApi.Links | undefined;
|
|
8
|
-
included?: KardApi.users.EligibilityOfferIncluded[] | undefined;
|
|
9
|
-
meta?: KardApi.users.OffersMeta | undefined;
|
|
10
|
-
}
|
|
5
|
+
export type PlacementContentResponse = KardApi.users.OffersResponseObject | KardApi.users.BatchesResponseObject;
|
|
@@ -41,7 +41,6 @@ export * from "./OperationPeriod.mjs";
|
|
|
41
41
|
export * from "./OperationTime.mjs";
|
|
42
42
|
export * from "./PlacementBatchAttributes.mjs";
|
|
43
43
|
export * from "./PlacementBatchData.mjs";
|
|
44
|
-
export * from "./PlacementContentData.mjs";
|
|
45
44
|
export * from "./PlacementContentResponse.mjs";
|
|
46
45
|
export * from "./ProgressBar.mjs";
|
|
47
46
|
export * from "./ProgressBarLabelPair.mjs";
|
|
@@ -41,7 +41,6 @@ export * from "./OperationPeriod.mjs";
|
|
|
41
41
|
export * from "./OperationTime.mjs";
|
|
42
42
|
export * from "./PlacementBatchAttributes.mjs";
|
|
43
43
|
export * from "./PlacementBatchData.mjs";
|
|
44
|
-
export * from "./PlacementContentData.mjs";
|
|
45
44
|
export * from "./PlacementContentResponse.mjs";
|
|
46
45
|
export * from "./ProgressBar.mjs";
|
|
47
46
|
export * from "./ProgressBarLabelPair.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "
|
|
1
|
+
export declare const SDK_VERSION = "30.0.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "
|
|
1
|
+
export const SDK_VERSION = "30.0.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -2737,8 +2737,8 @@ Record when a user activates a batch-activation placement slot. Writes a slot-le
|
|
|
2737
2737
|
`placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
2738
2738
|
`offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
2739
2739
|
strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
2740
|
-
partner can render the batch immediately without an extra
|
|
2741
|
-
|
|
2740
|
+
partner can render the batch immediately without an extra round-trip to re-fetch
|
|
2741
|
+
the placement content.
|
|
2742
2742
|
|
|
2743
2743
|
<b>Required scopes:</b> `attributions:write`
|
|
2744
2744
|
</dd>
|
|
@@ -2970,194 +2970,6 @@ await client.users.rewards.offers("organization-123", "user-123", {
|
|
|
2970
2970
|
</dl>
|
|
2971
2971
|
|
|
2972
2972
|
|
|
2973
|
-
</dd>
|
|
2974
|
-
</dl>
|
|
2975
|
-
</details>
|
|
2976
|
-
|
|
2977
|
-
<details><summary><code>client.users.rewards.<a href="/src/api/resources/users/resources/rewards/client/Client.ts">placementOffers</a>(organizationId, userId, placementId, { ...params }) -> KardApi.OffersResponseObject</code></summary>
|
|
2978
|
-
<dl>
|
|
2979
|
-
<dd>
|
|
2980
|
-
|
|
2981
|
-
#### 📝 Description
|
|
2982
|
-
|
|
2983
|
-
<dl>
|
|
2984
|
-
<dd>
|
|
2985
|
-
|
|
2986
|
-
<dl>
|
|
2987
|
-
<dd>
|
|
2988
|
-
|
|
2989
|
-
Retrieve offers for a placement slot. Returns offers sorted by highest cash back,
|
|
2990
|
-
limited by the placement's available slots.<br/>
|
|
2991
|
-
<b>Required scopes:</b> `rewards:read`
|
|
2992
|
-
</dd>
|
|
2993
|
-
</dl>
|
|
2994
|
-
</dd>
|
|
2995
|
-
</dl>
|
|
2996
|
-
|
|
2997
|
-
#### 🔌 Usage
|
|
2998
|
-
|
|
2999
|
-
<dl>
|
|
3000
|
-
<dd>
|
|
3001
|
-
|
|
3002
|
-
<dl>
|
|
3003
|
-
<dd>
|
|
3004
|
-
|
|
3005
|
-
```typescript
|
|
3006
|
-
await client.users.rewards.placementOffers("organizationId", "userId", "placementId");
|
|
3007
|
-
|
|
3008
|
-
```
|
|
3009
|
-
</dd>
|
|
3010
|
-
</dl>
|
|
3011
|
-
</dd>
|
|
3012
|
-
</dl>
|
|
3013
|
-
|
|
3014
|
-
#### ⚙️ Parameters
|
|
3015
|
-
|
|
3016
|
-
<dl>
|
|
3017
|
-
<dd>
|
|
3018
|
-
|
|
3019
|
-
<dl>
|
|
3020
|
-
<dd>
|
|
3021
|
-
|
|
3022
|
-
**organizationId:** `KardApi.OrganizationId`
|
|
3023
|
-
|
|
3024
|
-
</dd>
|
|
3025
|
-
</dl>
|
|
3026
|
-
|
|
3027
|
-
<dl>
|
|
3028
|
-
<dd>
|
|
3029
|
-
|
|
3030
|
-
**userId:** `KardApi.UserId`
|
|
3031
|
-
|
|
3032
|
-
</dd>
|
|
3033
|
-
</dl>
|
|
3034
|
-
|
|
3035
|
-
<dl>
|
|
3036
|
-
<dd>
|
|
3037
|
-
|
|
3038
|
-
**placementId:** `string`
|
|
3039
|
-
|
|
3040
|
-
</dd>
|
|
3041
|
-
</dl>
|
|
3042
|
-
|
|
3043
|
-
<dl>
|
|
3044
|
-
<dd>
|
|
3045
|
-
|
|
3046
|
-
**request:** `KardApi.users.GetOffersByPlacementRequest`
|
|
3047
|
-
|
|
3048
|
-
</dd>
|
|
3049
|
-
</dl>
|
|
3050
|
-
|
|
3051
|
-
<dl>
|
|
3052
|
-
<dd>
|
|
3053
|
-
|
|
3054
|
-
**requestOptions:** `RewardsClient.RequestOptions`
|
|
3055
|
-
|
|
3056
|
-
</dd>
|
|
3057
|
-
</dl>
|
|
3058
|
-
</dd>
|
|
3059
|
-
</dl>
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
</dd>
|
|
3063
|
-
</dl>
|
|
3064
|
-
</details>
|
|
3065
|
-
|
|
3066
|
-
<details><summary><code>client.users.rewards.<a href="/src/api/resources/users/resources/rewards/client/Client.ts">placementBatches</a>(organizationId, userId, placementId, { ...params }) -> KardApi.BatchesResponseObject</code></summary>
|
|
3067
|
-
<dl>
|
|
3068
|
-
<dd>
|
|
3069
|
-
|
|
3070
|
-
#### 📝 Description
|
|
3071
|
-
|
|
3072
|
-
<dl>
|
|
3073
|
-
<dd>
|
|
3074
|
-
|
|
3075
|
-
<dl>
|
|
3076
|
-
<dd>
|
|
3077
|
-
|
|
3078
|
-
Retrieve batches for a batch-activation or group placement. Returns each
|
|
3079
|
-
slot in slot order with its current offer set, alias, and freshness fields
|
|
3080
|
-
(`isActive`, `lastActivatedAt`, `expiresAt`). Applies the same per-user
|
|
3081
|
-
eligibility and per-slot content-strategy filter as Get Offers By
|
|
3082
|
-
Placement, independently per slot. For a batch-activation placement, a
|
|
3083
|
-
slot only flips to `isActive: false` when its refresh interval has elapsed
|
|
3084
|
-
AND its post-eligibility `offers[]` is non-empty; otherwise the slot is
|
|
3085
|
-
still returned and stays active so the partner UI does not promote
|
|
3086
|
-
"refresh" with nothing to show. For a group placement, slots are always
|
|
3087
|
-
active and each slot returns its offers regardless of activation state,
|
|
3088
|
-
hiding only offers that require activation (`requiredInBatch`) and have
|
|
3089
|
-
no activation record.<br/>
|
|
3090
|
-
<b>Required scopes:</b> `rewards:read`
|
|
3091
|
-
</dd>
|
|
3092
|
-
</dl>
|
|
3093
|
-
</dd>
|
|
3094
|
-
</dl>
|
|
3095
|
-
|
|
3096
|
-
#### 🔌 Usage
|
|
3097
|
-
|
|
3098
|
-
<dl>
|
|
3099
|
-
<dd>
|
|
3100
|
-
|
|
3101
|
-
<dl>
|
|
3102
|
-
<dd>
|
|
3103
|
-
|
|
3104
|
-
```typescript
|
|
3105
|
-
await client.users.rewards.placementBatches("organizationId", "userId", "placementId");
|
|
3106
|
-
|
|
3107
|
-
```
|
|
3108
|
-
</dd>
|
|
3109
|
-
</dl>
|
|
3110
|
-
</dd>
|
|
3111
|
-
</dl>
|
|
3112
|
-
|
|
3113
|
-
#### ⚙️ Parameters
|
|
3114
|
-
|
|
3115
|
-
<dl>
|
|
3116
|
-
<dd>
|
|
3117
|
-
|
|
3118
|
-
<dl>
|
|
3119
|
-
<dd>
|
|
3120
|
-
|
|
3121
|
-
**organizationId:** `KardApi.OrganizationId`
|
|
3122
|
-
|
|
3123
|
-
</dd>
|
|
3124
|
-
</dl>
|
|
3125
|
-
|
|
3126
|
-
<dl>
|
|
3127
|
-
<dd>
|
|
3128
|
-
|
|
3129
|
-
**userId:** `KardApi.UserId`
|
|
3130
|
-
|
|
3131
|
-
</dd>
|
|
3132
|
-
</dl>
|
|
3133
|
-
|
|
3134
|
-
<dl>
|
|
3135
|
-
<dd>
|
|
3136
|
-
|
|
3137
|
-
**placementId:** `string`
|
|
3138
|
-
|
|
3139
|
-
</dd>
|
|
3140
|
-
</dl>
|
|
3141
|
-
|
|
3142
|
-
<dl>
|
|
3143
|
-
<dd>
|
|
3144
|
-
|
|
3145
|
-
**request:** `KardApi.users.GetBatchesByPlacementRequest`
|
|
3146
|
-
|
|
3147
|
-
</dd>
|
|
3148
|
-
</dl>
|
|
3149
|
-
|
|
3150
|
-
<dl>
|
|
3151
|
-
<dd>
|
|
3152
|
-
|
|
3153
|
-
**requestOptions:** `RewardsClient.RequestOptions`
|
|
3154
|
-
|
|
3155
|
-
</dd>
|
|
3156
|
-
</dl>
|
|
3157
|
-
</dd>
|
|
3158
|
-
</dl>
|
|
3159
|
-
|
|
3160
|
-
|
|
3161
2973
|
</dd>
|
|
3162
2974
|
</dl>
|
|
3163
2975
|
</details>
|
|
@@ -3177,13 +2989,12 @@ await client.users.rewards.placementBatches("organizationId", "userId", "placeme
|
|
|
3177
2989
|
Retrieve the content for a placement. The placement type is resolved
|
|
3178
2990
|
server-side so callers no longer pick an endpoint by placement type.
|
|
3179
2991
|
Returns a JSON:API document whose `data` resources are self-describing
|
|
3180
|
-
by `type`: a standard placement returns `standardOffer` resources (
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
`
|
|
3186
|
-
this endpoint and respond with a `400`.<br/>
|
|
2992
|
+
by `type`: a standard placement returns `standardOffer` resources (with
|
|
2993
|
+
`links`, optional `included` categories, and `meta`); a batch-activation
|
|
2994
|
+
or group placement returns `placementBatch` slot resources. Distinguish
|
|
2995
|
+
the two by each resource's `type`. Email and push-notification
|
|
2996
|
+
placements are not servable through this endpoint and respond with a
|
|
2997
|
+
`400`.<br/>
|
|
3187
2998
|
<b>Required scopes:</b> `rewards:read`
|
|
3188
2999
|
</dd>
|
|
3189
3000
|
</dl>
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.js";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetBatchesByPlacementRequest {
|
|
7
|
-
/** UI component types to include in the response. */
|
|
8
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.js";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetOffersByPlacementRequest {
|
|
7
|
-
/** Case-insensitive search string to filter offers by merchant name */
|
|
8
|
-
"filter[search]"?: string;
|
|
9
|
-
"filter[purchaseChannel]"?: KardApi.PurchaseChannel[];
|
|
10
|
-
"filter[category]"?: KardApi.CategoryOption;
|
|
11
|
-
"filter[isTargeted]"?: boolean;
|
|
12
|
-
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. */
|
|
13
|
-
include?: string | string[];
|
|
14
|
-
/** UI component types to include in the response. */
|
|
15
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
16
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../index.js";
|
|
2
|
-
/**
|
|
3
|
-
* A single placement-content resource: a `standardOffer` (returned for a standard placement) or a `placementBatch` slot (returned for a batch-activation or group placement). Discriminate on the resource `type`.
|
|
4
|
-
*/
|
|
5
|
-
export type PlacementContentData = KardApi.users.OfferDataUnion | KardApi.users.PlacementBatchData;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetBatchesByPlacementRequest {
|
|
7
|
-
/** UI component types to include in the response. */
|
|
8
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
9
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../../index.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* @example
|
|
4
|
-
* {}
|
|
5
|
-
*/
|
|
6
|
-
export interface GetOffersByPlacementRequest {
|
|
7
|
-
/** Case-insensitive search string to filter offers by merchant name */
|
|
8
|
-
"filter[search]"?: string;
|
|
9
|
-
"filter[purchaseChannel]"?: KardApi.PurchaseChannel[];
|
|
10
|
-
"filter[category]"?: KardApi.CategoryOption;
|
|
11
|
-
"filter[isTargeted]"?: boolean;
|
|
12
|
-
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. */
|
|
13
|
-
include?: string | string[];
|
|
14
|
-
/** UI component types to include in the response. */
|
|
15
|
-
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
16
|
-
}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* A single placement-content resource: a `standardOffer` (returned for a standard placement) or a `placementBatch` slot (returned for a batch-activation or group placement). Discriminate on the resource `type`.
|
|
4
|
-
*/
|
|
5
|
-
export type PlacementContentData = KardApi.users.OfferDataUnion | KardApi.users.PlacementBatchData;
|