@kard-financial/sdk 22.2.0 → 22.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/cjs/BaseClient.js +2 -2
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.d.ts +27 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.js +76 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.ts +9 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.js +3 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/BatchSlotData.d.ts +18 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/BatchSlotData.js +3 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/BatchesResponseObject.d.ts +7 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/BatchesResponseObject.js +3 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/index.d.ts +2 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/index.js +2 -0
- 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/rewards/client/Client.d.mts +27 -0
- package/dist/esm/api/resources/users/resources/rewards/client/Client.mjs +76 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.d.mts +9 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetBatchesByPlacementRequest.mjs +2 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/users/resources/rewards/types/BatchSlotData.d.mts +18 -0
- package/dist/esm/api/resources/users/resources/rewards/types/BatchSlotData.mjs +2 -0
- package/dist/esm/api/resources/users/resources/rewards/types/BatchesResponseObject.d.mts +7 -0
- package/dist/esm/api/resources/users/resources/rewards/types/BatchesResponseObject.mjs +2 -0
- package/dist/esm/api/resources/users/resources/rewards/types/index.d.mts +2 -0
- package/dist/esm/api/resources/users/resources/rewards/types/index.mjs +2 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +95 -0
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": "22.
|
|
47
|
-
"User-Agent": "@kard-financial/sdk/22.
|
|
46
|
+
"X-Fern-SDK-Version": "22.3.0",
|
|
47
|
+
"User-Agent": "@kard-financial/sdk/22.3.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);
|
|
@@ -56,6 +56,33 @@ export declare class RewardsClient {
|
|
|
56
56
|
*/
|
|
57
57
|
placementOffers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetOffersByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
58
58
|
private __placementOffers;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieve batches for a batch-activation placement. Returns each slot in slot
|
|
61
|
+
* order with its current offer set, alias, and freshness fields (`isActive`,
|
|
62
|
+
* `lastActivatedAt`, `expiresAt`). Applies the same per-user eligibility and
|
|
63
|
+
* per-slot content-strategy filter as Get Offers By Placement, independently
|
|
64
|
+
* per slot. A slot only flips to `isActive: false` when its refresh interval
|
|
65
|
+
* has elapsed AND its post-eligibility `offers[]` is non-empty; otherwise the
|
|
66
|
+
* slot is still returned and stays active so the partner UI does not promote
|
|
67
|
+
* "refresh" with nothing to show.<br/>
|
|
68
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
69
|
+
*
|
|
70
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
71
|
+
* @param {KardApi.UserId} userId
|
|
72
|
+
* @param {string} placementId
|
|
73
|
+
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
74
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
|
+
*
|
|
76
|
+
* @throws {@link KardApi.InternalServerError}
|
|
77
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
78
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
79
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
83
|
+
*/
|
|
84
|
+
placementBatches(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetBatchesByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BatchesResponseObject>;
|
|
85
|
+
private __placementBatches;
|
|
59
86
|
/**
|
|
60
87
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
61
88
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -214,6 +214,82 @@ class RewardsClient {
|
|
|
214
214
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/offers");
|
|
215
215
|
});
|
|
216
216
|
}
|
|
217
|
+
/**
|
|
218
|
+
* Retrieve batches for a batch-activation placement. Returns each slot in slot
|
|
219
|
+
* order with its current offer set, alias, and freshness fields (`isActive`,
|
|
220
|
+
* `lastActivatedAt`, `expiresAt`). Applies the same per-user eligibility and
|
|
221
|
+
* per-slot content-strategy filter as Get Offers By Placement, independently
|
|
222
|
+
* per slot. A slot only flips to `isActive: false` when its refresh interval
|
|
223
|
+
* has elapsed AND its post-eligibility `offers[]` is non-empty; otherwise the
|
|
224
|
+
* slot is still returned and stays active so the partner UI does not promote
|
|
225
|
+
* "refresh" with nothing to show.<br/>
|
|
226
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
227
|
+
*
|
|
228
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
229
|
+
* @param {KardApi.UserId} userId
|
|
230
|
+
* @param {string} placementId
|
|
231
|
+
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
232
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
233
|
+
*
|
|
234
|
+
* @throws {@link KardApi.InternalServerError}
|
|
235
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
236
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
237
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
241
|
+
*/
|
|
242
|
+
placementBatches(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
243
|
+
return core.HttpResponsePromise.fromPromise(this.__placementBatches(organizationId, userId, placementId, request, requestOptions));
|
|
244
|
+
}
|
|
245
|
+
__placementBatches(organizationId_1, userId_1, placementId_1) {
|
|
246
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
247
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
248
|
+
const { supportedComponents } = request;
|
|
249
|
+
const _queryParams = {
|
|
250
|
+
supportedComponents: Array.isArray(supportedComponents)
|
|
251
|
+
? supportedComponents.map((item) => item)
|
|
252
|
+
: supportedComponents != null
|
|
253
|
+
? supportedComponents
|
|
254
|
+
: undefined,
|
|
255
|
+
};
|
|
256
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
257
|
+
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);
|
|
258
|
+
const _response = yield core.fetcher({
|
|
259
|
+
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`),
|
|
260
|
+
method: "GET",
|
|
261
|
+
headers: _headers,
|
|
262
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
263
|
+
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,
|
|
264
|
+
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,
|
|
265
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
266
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
267
|
+
logging: this._options.logging,
|
|
268
|
+
});
|
|
269
|
+
if (_response.ok) {
|
|
270
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
271
|
+
}
|
|
272
|
+
if (_response.error.reason === "status-code") {
|
|
273
|
+
switch (_response.error.statusCode) {
|
|
274
|
+
case 500:
|
|
275
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
276
|
+
case 400:
|
|
277
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
278
|
+
case 404:
|
|
279
|
+
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
280
|
+
case 401:
|
|
281
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
282
|
+
default:
|
|
283
|
+
throw new errors.KardApiError({
|
|
284
|
+
statusCode: _response.error.statusCode,
|
|
285
|
+
body: _response.error.body,
|
|
286
|
+
rawResponse: _response.rawResponse,
|
|
287
|
+
});
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/batches");
|
|
291
|
+
});
|
|
292
|
+
}
|
|
217
293
|
/**
|
|
218
294
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
219
295
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -0,0 +1,9 @@
|
|
|
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,3 +1,4 @@
|
|
|
1
|
+
export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementRequest.js";
|
|
1
2
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.js";
|
|
2
3
|
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.js";
|
|
3
4
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* One slot in a batch-activation placement, with freshness fields and the offers that resolve under the slot's content strategy.
|
|
4
|
+
*/
|
|
5
|
+
export interface BatchSlotData {
|
|
6
|
+
/** Stable identifier for the slot within the placement */
|
|
7
|
+
slotId: string;
|
|
8
|
+
/** Customer-defined alias for the slot, unique within the placement */
|
|
9
|
+
alias: string;
|
|
10
|
+
/** Whether the slot is still considered "fresh" for the user. Set to false only when the slot's `expiresAt` is in the past AND the slot resolves to a non-empty offer set; an empty offer set keeps the slot active so partner UIs do not promote "tap to refresh" with nothing to show. */
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
/** Timestamp of the most recent placementSlotAttribution ACTIVATE event for this (user, placement, slot). Absent for cold slots that have never been activated. */
|
|
13
|
+
lastActivatedAt?: string | undefined;
|
|
14
|
+
/** Computed as `lastActivatedAt + placement.refreshInterval`. Absent for cold slots that have never been activated. */
|
|
15
|
+
expiresAt?: string | undefined;
|
|
16
|
+
/** The set of offers eligible for the user under this slot's content strategy. */
|
|
17
|
+
offers: KardApi.users.OfferDataUnion[];
|
|
18
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./Amount.js";
|
|
2
2
|
export * from "./AmountType.js";
|
|
3
3
|
export * from "./Asset.js";
|
|
4
|
+
export * from "./BatchesResponseObject.js";
|
|
5
|
+
export * from "./BatchSlotData.js";
|
|
4
6
|
export * from "./ButtonStyle.js";
|
|
5
7
|
export * from "./CategoryData.js";
|
|
6
8
|
export * from "./CategoryFields.js";
|
|
@@ -17,6 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
17
17
|
__exportStar(require("./Amount.js"), exports);
|
|
18
18
|
__exportStar(require("./AmountType.js"), exports);
|
|
19
19
|
__exportStar(require("./Asset.js"), exports);
|
|
20
|
+
__exportStar(require("./BatchesResponseObject.js"), exports);
|
|
21
|
+
__exportStar(require("./BatchSlotData.js"), exports);
|
|
20
22
|
__exportStar(require("./ButtonStyle.js"), exports);
|
|
21
23
|
__exportStar(require("./CategoryData.js"), exports);
|
|
22
24
|
__exportStar(require("./CategoryFields.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "22.
|
|
1
|
+
export declare const SDK_VERSION = "22.3.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": "22.
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/22.
|
|
9
|
+
"X-Fern-SDK-Version": "22.3.0",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/22.3.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);
|
|
@@ -56,6 +56,33 @@ export declare class RewardsClient {
|
|
|
56
56
|
*/
|
|
57
57
|
placementOffers(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetOffersByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.OffersResponseObject>;
|
|
58
58
|
private __placementOffers;
|
|
59
|
+
/**
|
|
60
|
+
* Retrieve batches for a batch-activation placement. Returns each slot in slot
|
|
61
|
+
* order with its current offer set, alias, and freshness fields (`isActive`,
|
|
62
|
+
* `lastActivatedAt`, `expiresAt`). Applies the same per-user eligibility and
|
|
63
|
+
* per-slot content-strategy filter as Get Offers By Placement, independently
|
|
64
|
+
* per slot. A slot only flips to `isActive: false` when its refresh interval
|
|
65
|
+
* has elapsed AND its post-eligibility `offers[]` is non-empty; otherwise the
|
|
66
|
+
* slot is still returned and stays active so the partner UI does not promote
|
|
67
|
+
* "refresh" with nothing to show.<br/>
|
|
68
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
69
|
+
*
|
|
70
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
71
|
+
* @param {KardApi.UserId} userId
|
|
72
|
+
* @param {string} placementId
|
|
73
|
+
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
74
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
75
|
+
*
|
|
76
|
+
* @throws {@link KardApi.InternalServerError}
|
|
77
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
78
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
79
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
83
|
+
*/
|
|
84
|
+
placementBatches(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetBatchesByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BatchesResponseObject>;
|
|
85
|
+
private __placementBatches;
|
|
59
86
|
/**
|
|
60
87
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
61
88
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -178,6 +178,82 @@ export class RewardsClient {
|
|
|
178
178
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/offers");
|
|
179
179
|
});
|
|
180
180
|
}
|
|
181
|
+
/**
|
|
182
|
+
* Retrieve batches for a batch-activation placement. Returns each slot in slot
|
|
183
|
+
* order with its current offer set, alias, and freshness fields (`isActive`,
|
|
184
|
+
* `lastActivatedAt`, `expiresAt`). Applies the same per-user eligibility and
|
|
185
|
+
* per-slot content-strategy filter as Get Offers By Placement, independently
|
|
186
|
+
* per slot. A slot only flips to `isActive: false` when its refresh interval
|
|
187
|
+
* has elapsed AND its post-eligibility `offers[]` is non-empty; otherwise the
|
|
188
|
+
* slot is still returned and stays active so the partner UI does not promote
|
|
189
|
+
* "refresh" with nothing to show.<br/>
|
|
190
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
191
|
+
*
|
|
192
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
193
|
+
* @param {KardApi.UserId} userId
|
|
194
|
+
* @param {string} placementId
|
|
195
|
+
* @param {KardApi.users.GetBatchesByPlacementRequest} request
|
|
196
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
197
|
+
*
|
|
198
|
+
* @throws {@link KardApi.InternalServerError}
|
|
199
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
200
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
201
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* await client.users.rewards.placementBatches("organizationId", "userId", "placementId")
|
|
205
|
+
*/
|
|
206
|
+
placementBatches(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
207
|
+
return core.HttpResponsePromise.fromPromise(this.__placementBatches(organizationId, userId, placementId, request, requestOptions));
|
|
208
|
+
}
|
|
209
|
+
__placementBatches(organizationId_1, userId_1, placementId_1) {
|
|
210
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
211
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
212
|
+
const { supportedComponents } = request;
|
|
213
|
+
const _queryParams = {
|
|
214
|
+
supportedComponents: Array.isArray(supportedComponents)
|
|
215
|
+
? supportedComponents.map((item) => item)
|
|
216
|
+
: supportedComponents != null
|
|
217
|
+
? supportedComponents
|
|
218
|
+
: undefined,
|
|
219
|
+
};
|
|
220
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
221
|
+
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);
|
|
222
|
+
const _response = yield core.fetcher({
|
|
223
|
+
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`),
|
|
224
|
+
method: "GET",
|
|
225
|
+
headers: _headers,
|
|
226
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
227
|
+
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,
|
|
228
|
+
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,
|
|
229
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
230
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
231
|
+
logging: this._options.logging,
|
|
232
|
+
});
|
|
233
|
+
if (_response.ok) {
|
|
234
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
235
|
+
}
|
|
236
|
+
if (_response.error.reason === "status-code") {
|
|
237
|
+
switch (_response.error.statusCode) {
|
|
238
|
+
case 500:
|
|
239
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
240
|
+
case 400:
|
|
241
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
242
|
+
case 404:
|
|
243
|
+
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
244
|
+
case 401:
|
|
245
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
246
|
+
default:
|
|
247
|
+
throw new errors.KardApiError({
|
|
248
|
+
statusCode: _response.error.statusCode,
|
|
249
|
+
body: _response.error.body,
|
|
250
|
+
rawResponse: _response.rawResponse,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/batches");
|
|
255
|
+
});
|
|
256
|
+
}
|
|
181
257
|
/**
|
|
182
258
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
183
259
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -0,0 +1,9 @@
|
|
|
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,3 +1,4 @@
|
|
|
1
|
+
export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementRequest.mjs";
|
|
1
2
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.mjs";
|
|
2
3
|
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.mjs";
|
|
3
4
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.mjs";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* One slot in a batch-activation placement, with freshness fields and the offers that resolve under the slot's content strategy.
|
|
4
|
+
*/
|
|
5
|
+
export interface BatchSlotData {
|
|
6
|
+
/** Stable identifier for the slot within the placement */
|
|
7
|
+
slotId: string;
|
|
8
|
+
/** Customer-defined alias for the slot, unique within the placement */
|
|
9
|
+
alias: string;
|
|
10
|
+
/** Whether the slot is still considered "fresh" for the user. Set to false only when the slot's `expiresAt` is in the past AND the slot resolves to a non-empty offer set; an empty offer set keeps the slot active so partner UIs do not promote "tap to refresh" with nothing to show. */
|
|
11
|
+
isActive: boolean;
|
|
12
|
+
/** Timestamp of the most recent placementSlotAttribution ACTIVATE event for this (user, placement, slot). Absent for cold slots that have never been activated. */
|
|
13
|
+
lastActivatedAt?: string | undefined;
|
|
14
|
+
/** Computed as `lastActivatedAt + placement.refreshInterval`. Absent for cold slots that have never been activated. */
|
|
15
|
+
expiresAt?: string | undefined;
|
|
16
|
+
/** The set of offers eligible for the user under this slot's content strategy. */
|
|
17
|
+
offers: KardApi.users.OfferDataUnion[];
|
|
18
|
+
}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./Amount.mjs";
|
|
2
2
|
export * from "./AmountType.mjs";
|
|
3
3
|
export * from "./Asset.mjs";
|
|
4
|
+
export * from "./BatchesResponseObject.mjs";
|
|
5
|
+
export * from "./BatchSlotData.mjs";
|
|
4
6
|
export * from "./ButtonStyle.mjs";
|
|
5
7
|
export * from "./CategoryData.mjs";
|
|
6
8
|
export * from "./CategoryFields.mjs";
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./Amount.mjs";
|
|
2
2
|
export * from "./AmountType.mjs";
|
|
3
3
|
export * from "./Asset.mjs";
|
|
4
|
+
export * from "./BatchesResponseObject.mjs";
|
|
5
|
+
export * from "./BatchSlotData.mjs";
|
|
4
6
|
export * from "./ButtonStyle.mjs";
|
|
5
7
|
export * from "./CategoryData.mjs";
|
|
6
8
|
export * from "./CategoryFields.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "22.
|
|
1
|
+
export declare const SDK_VERSION = "22.3.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "22.
|
|
1
|
+
export const SDK_VERSION = "22.3.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -2965,6 +2965,101 @@ await client.users.rewards.placementOffers("organizationId", "userId", "placemen
|
|
|
2965
2965
|
</dl>
|
|
2966
2966
|
|
|
2967
2967
|
|
|
2968
|
+
</dd>
|
|
2969
|
+
</dl>
|
|
2970
|
+
</details>
|
|
2971
|
+
|
|
2972
|
+
<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>
|
|
2973
|
+
<dl>
|
|
2974
|
+
<dd>
|
|
2975
|
+
|
|
2976
|
+
#### 📝 Description
|
|
2977
|
+
|
|
2978
|
+
<dl>
|
|
2979
|
+
<dd>
|
|
2980
|
+
|
|
2981
|
+
<dl>
|
|
2982
|
+
<dd>
|
|
2983
|
+
|
|
2984
|
+
Retrieve batches for a batch-activation placement. Returns each slot in slot
|
|
2985
|
+
order with its current offer set, alias, and freshness fields (`isActive`,
|
|
2986
|
+
`lastActivatedAt`, `expiresAt`). Applies the same per-user eligibility and
|
|
2987
|
+
per-slot content-strategy filter as Get Offers By Placement, independently
|
|
2988
|
+
per slot. A slot only flips to `isActive: false` when its refresh interval
|
|
2989
|
+
has elapsed AND its post-eligibility `offers[]` is non-empty; otherwise the
|
|
2990
|
+
slot is still returned and stays active so the partner UI does not promote
|
|
2991
|
+
"refresh" with nothing to show.<br/>
|
|
2992
|
+
<b>Required scopes:</b> `rewards:read`
|
|
2993
|
+
</dd>
|
|
2994
|
+
</dl>
|
|
2995
|
+
</dd>
|
|
2996
|
+
</dl>
|
|
2997
|
+
|
|
2998
|
+
#### 🔌 Usage
|
|
2999
|
+
|
|
3000
|
+
<dl>
|
|
3001
|
+
<dd>
|
|
3002
|
+
|
|
3003
|
+
<dl>
|
|
3004
|
+
<dd>
|
|
3005
|
+
|
|
3006
|
+
```typescript
|
|
3007
|
+
await client.users.rewards.placementBatches("organizationId", "userId", "placementId");
|
|
3008
|
+
|
|
3009
|
+
```
|
|
3010
|
+
</dd>
|
|
3011
|
+
</dl>
|
|
3012
|
+
</dd>
|
|
3013
|
+
</dl>
|
|
3014
|
+
|
|
3015
|
+
#### ⚙️ Parameters
|
|
3016
|
+
|
|
3017
|
+
<dl>
|
|
3018
|
+
<dd>
|
|
3019
|
+
|
|
3020
|
+
<dl>
|
|
3021
|
+
<dd>
|
|
3022
|
+
|
|
3023
|
+
**organizationId:** `KardApi.OrganizationId`
|
|
3024
|
+
|
|
3025
|
+
</dd>
|
|
3026
|
+
</dl>
|
|
3027
|
+
|
|
3028
|
+
<dl>
|
|
3029
|
+
<dd>
|
|
3030
|
+
|
|
3031
|
+
**userId:** `KardApi.UserId`
|
|
3032
|
+
|
|
3033
|
+
</dd>
|
|
3034
|
+
</dl>
|
|
3035
|
+
|
|
3036
|
+
<dl>
|
|
3037
|
+
<dd>
|
|
3038
|
+
|
|
3039
|
+
**placementId:** `string`
|
|
3040
|
+
|
|
3041
|
+
</dd>
|
|
3042
|
+
</dl>
|
|
3043
|
+
|
|
3044
|
+
<dl>
|
|
3045
|
+
<dd>
|
|
3046
|
+
|
|
3047
|
+
**request:** `KardApi.users.GetBatchesByPlacementRequest`
|
|
3048
|
+
|
|
3049
|
+
</dd>
|
|
3050
|
+
</dl>
|
|
3051
|
+
|
|
3052
|
+
<dl>
|
|
3053
|
+
<dd>
|
|
3054
|
+
|
|
3055
|
+
**requestOptions:** `RewardsClient.RequestOptions`
|
|
3056
|
+
|
|
3057
|
+
</dd>
|
|
3058
|
+
</dl>
|
|
3059
|
+
</dd>
|
|
3060
|
+
</dl>
|
|
3061
|
+
|
|
3062
|
+
|
|
2968
3063
|
</dd>
|
|
2969
3064
|
</dl>
|
|
2970
3065
|
</details>
|