@kard-financial/sdk 29.1.0 → 29.2.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 +36 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.js +89 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetPlacementContentRequest.d.ts +18 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetPlacementContentRequest.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/PlacementContentData.d.ts +5 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/PlacementContentData.js +3 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/PlacementContentResponse.d.ts +10 -0
- package/dist/cjs/api/resources/users/resources/rewards/types/PlacementContentResponse.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 +36 -0
- package/dist/esm/api/resources/users/resources/rewards/client/Client.mjs +89 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetPlacementContentRequest.d.mts +18 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetPlacementContentRequest.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/PlacementContentData.d.mts +5 -0
- package/dist/esm/api/resources/users/resources/rewards/types/PlacementContentData.mjs +2 -0
- package/dist/esm/api/resources/users/resources/rewards/types/PlacementContentResponse.d.mts +10 -0
- package/dist/esm/api/resources/users/resources/rewards/types/PlacementContentResponse.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 +99 -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": "29.
|
|
47
|
-
"User-Agent": "@kard-financial/sdk/29.
|
|
46
|
+
"X-Fern-SDK-Version": "29.2.0",
|
|
47
|
+
"User-Agent": "@kard-financial/sdk/29.2.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);
|
|
@@ -87,6 +87,42 @@ export declare class RewardsClient {
|
|
|
87
87
|
*/
|
|
88
88
|
placementBatches(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetBatchesByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BatchesResponseObject>;
|
|
89
89
|
private __placementBatches;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
92
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
93
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
94
|
+
* by `type`: a standard placement returns `standardOffer` resources (the
|
|
95
|
+
* same payload as Get Offers By Placement — with `links`, optional
|
|
96
|
+
* `included` categories, and `meta`); a batch-activation or group
|
|
97
|
+
* placement returns `placementBatch` slot resources (the same payload as
|
|
98
|
+
* Get Batches By Placement). Distinguish the two by each resource's
|
|
99
|
+
* `type`. Email and push-notification placements are not servable through
|
|
100
|
+
* this endpoint and respond with a `400`.<br/>
|
|
101
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
102
|
+
*
|
|
103
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
104
|
+
* @param {KardApi.UserId} userId
|
|
105
|
+
* @param {string} placementId
|
|
106
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
107
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
|
+
*
|
|
109
|
+
* @throws {@link KardApi.InternalServerError}
|
|
110
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
111
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
112
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
116
|
+
* include: "categories"
|
|
117
|
+
* })
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
121
|
+
* supportedComponents: "baseReward"
|
|
122
|
+
* })
|
|
123
|
+
*/
|
|
124
|
+
placementContent(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetPlacementContentRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.PlacementContentResponse>;
|
|
125
|
+
private __placementContent;
|
|
90
126
|
/**
|
|
91
127
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
92
128
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -294,6 +294,95 @@ class RewardsClient {
|
|
|
294
294
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/batches");
|
|
295
295
|
});
|
|
296
296
|
}
|
|
297
|
+
/**
|
|
298
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
299
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
300
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
301
|
+
* by `type`: a standard placement returns `standardOffer` resources (the
|
|
302
|
+
* same payload as Get Offers By Placement — with `links`, optional
|
|
303
|
+
* `included` categories, and `meta`); a batch-activation or group
|
|
304
|
+
* placement returns `placementBatch` slot resources (the same payload as
|
|
305
|
+
* Get Batches By Placement). Distinguish the two by each resource's
|
|
306
|
+
* `type`. Email and push-notification placements are not servable through
|
|
307
|
+
* this endpoint and respond with a `400`.<br/>
|
|
308
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
309
|
+
*
|
|
310
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
311
|
+
* @param {KardApi.UserId} userId
|
|
312
|
+
* @param {string} placementId
|
|
313
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
314
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
315
|
+
*
|
|
316
|
+
* @throws {@link KardApi.InternalServerError}
|
|
317
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
318
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
319
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
320
|
+
*
|
|
321
|
+
* @example
|
|
322
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
323
|
+
* include: "categories"
|
|
324
|
+
* })
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
328
|
+
* supportedComponents: "baseReward"
|
|
329
|
+
* })
|
|
330
|
+
*/
|
|
331
|
+
placementContent(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
332
|
+
return core.HttpResponsePromise.fromPromise(this.__placementContent(organizationId, userId, placementId, request, requestOptions));
|
|
333
|
+
}
|
|
334
|
+
__placementContent(organizationId_1, userId_1, placementId_1) {
|
|
335
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
336
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
337
|
+
const { include, supportedComponents } = request;
|
|
338
|
+
const _queryParams = {
|
|
339
|
+
include,
|
|
340
|
+
supportedComponents: Array.isArray(supportedComponents)
|
|
341
|
+
? supportedComponents.map((item) => item)
|
|
342
|
+
: supportedComponents != null
|
|
343
|
+
? supportedComponents
|
|
344
|
+
: undefined,
|
|
345
|
+
};
|
|
346
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
347
|
+
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);
|
|
348
|
+
const _response = yield core.fetcher({
|
|
349
|
+
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)}/content`),
|
|
350
|
+
method: "GET",
|
|
351
|
+
headers: _headers,
|
|
352
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
353
|
+
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,
|
|
354
|
+
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,
|
|
355
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
356
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
357
|
+
logging: this._options.logging,
|
|
358
|
+
});
|
|
359
|
+
if (_response.ok) {
|
|
360
|
+
return {
|
|
361
|
+
data: _response.body,
|
|
362
|
+
rawResponse: _response.rawResponse,
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
if (_response.error.reason === "status-code") {
|
|
366
|
+
switch (_response.error.statusCode) {
|
|
367
|
+
case 500:
|
|
368
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
369
|
+
case 400:
|
|
370
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
371
|
+
case 404:
|
|
372
|
+
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
373
|
+
case 401:
|
|
374
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
375
|
+
default:
|
|
376
|
+
throw new errors.KardApiError({
|
|
377
|
+
statusCode: _response.error.statusCode,
|
|
378
|
+
body: _response.error.body,
|
|
379
|
+
rawResponse: _response.rawResponse,
|
|
380
|
+
});
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/content");
|
|
384
|
+
});
|
|
385
|
+
}
|
|
297
386
|
/**
|
|
298
387
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
299
388
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* include: "categories"
|
|
6
|
+
* }
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* {
|
|
10
|
+
* supportedComponents: "baseReward"
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export interface GetPlacementContentRequest {
|
|
14
|
+
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. Only applies to standard placements (those returning `standardOffer` resources). */
|
|
15
|
+
include?: string | string[];
|
|
16
|
+
/** UI component types to include in the response. */
|
|
17
|
+
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
18
|
+
}
|
|
@@ -2,3 +2,4 @@ export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementReques
|
|
|
2
2
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.js";
|
|
3
3
|
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.js";
|
|
4
4
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.js";
|
|
5
|
+
export type { GetPlacementContentRequest } from "./GetPlacementContentRequest.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Combined placement-content response, shaped as a JSON:API document. The placement is resolved server-side: a standard placement yields `standardOffer` resources (with `links`, optional `included` categories, and `meta`), while a batch-activation or group placement yields `placementBatch` slot resources. Callers distinguish the two by each resource's `type` rather than a separate discriminator, and the payload mirrors Get Offers By Placement / Get Batches By Placement exactly.
|
|
4
|
+
*/
|
|
5
|
+
export interface PlacementContentResponse {
|
|
6
|
+
data: KardApi.users.PlacementContentData[];
|
|
7
|
+
links?: KardApi.Links | undefined;
|
|
8
|
+
included?: KardApi.users.EligibilityOfferIncluded[] | undefined;
|
|
9
|
+
meta?: KardApi.users.OffersMeta | undefined;
|
|
10
|
+
}
|
|
@@ -41,6 +41,8 @@ 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
|
+
export * from "./PlacementContentResponse.js";
|
|
44
46
|
export * from "./ProgressBar.js";
|
|
45
47
|
export * from "./ProgressBarLabelPair.js";
|
|
46
48
|
export * from "./ProgressBarLabels.js";
|
|
@@ -57,6 +57,8 @@ __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
|
+
__exportStar(require("./PlacementContentResponse.js"), exports);
|
|
60
62
|
__exportStar(require("./ProgressBar.js"), exports);
|
|
61
63
|
__exportStar(require("./ProgressBarLabelPair.js"), exports);
|
|
62
64
|
__exportStar(require("./ProgressBarLabels.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "29.
|
|
1
|
+
export declare const SDK_VERSION = "29.2.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": "29.
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/29.
|
|
9
|
+
"X-Fern-SDK-Version": "29.2.0",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/29.2.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);
|
|
@@ -87,6 +87,42 @@ export declare class RewardsClient {
|
|
|
87
87
|
*/
|
|
88
88
|
placementBatches(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetBatchesByPlacementRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BatchesResponseObject>;
|
|
89
89
|
private __placementBatches;
|
|
90
|
+
/**
|
|
91
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
92
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
93
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
94
|
+
* by `type`: a standard placement returns `standardOffer` resources (the
|
|
95
|
+
* same payload as Get Offers By Placement — with `links`, optional
|
|
96
|
+
* `included` categories, and `meta`); a batch-activation or group
|
|
97
|
+
* placement returns `placementBatch` slot resources (the same payload as
|
|
98
|
+
* Get Batches By Placement). Distinguish the two by each resource's
|
|
99
|
+
* `type`. Email and push-notification placements are not servable through
|
|
100
|
+
* this endpoint and respond with a `400`.<br/>
|
|
101
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
102
|
+
*
|
|
103
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
104
|
+
* @param {KardApi.UserId} userId
|
|
105
|
+
* @param {string} placementId
|
|
106
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
107
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
108
|
+
*
|
|
109
|
+
* @throws {@link KardApi.InternalServerError}
|
|
110
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
111
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
112
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
113
|
+
*
|
|
114
|
+
* @example
|
|
115
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
116
|
+
* include: "categories"
|
|
117
|
+
* })
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
121
|
+
* supportedComponents: "baseReward"
|
|
122
|
+
* })
|
|
123
|
+
*/
|
|
124
|
+
placementContent(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, request?: KardApi.users.GetPlacementContentRequest, requestOptions?: RewardsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.PlacementContentResponse>;
|
|
125
|
+
private __placementContent;
|
|
90
126
|
/**
|
|
91
127
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
92
128
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -258,6 +258,95 @@ export class RewardsClient {
|
|
|
258
258
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/batches");
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Retrieve the content for a placement. The placement type is resolved
|
|
263
|
+
* server-side so callers no longer pick an endpoint by placement type.
|
|
264
|
+
* Returns a JSON:API document whose `data` resources are self-describing
|
|
265
|
+
* by `type`: a standard placement returns `standardOffer` resources (the
|
|
266
|
+
* same payload as Get Offers By Placement — with `links`, optional
|
|
267
|
+
* `included` categories, and `meta`); a batch-activation or group
|
|
268
|
+
* placement returns `placementBatch` slot resources (the same payload as
|
|
269
|
+
* Get Batches By Placement). Distinguish the two by each resource's
|
|
270
|
+
* `type`. Email and push-notification placements are not servable through
|
|
271
|
+
* this endpoint and respond with a `400`.<br/>
|
|
272
|
+
* <b>Required scopes:</b> `rewards:read`
|
|
273
|
+
*
|
|
274
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
275
|
+
* @param {KardApi.UserId} userId
|
|
276
|
+
* @param {string} placementId
|
|
277
|
+
* @param {KardApi.users.GetPlacementContentRequest} request
|
|
278
|
+
* @param {RewardsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
279
|
+
*
|
|
280
|
+
* @throws {@link KardApi.InternalServerError}
|
|
281
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
282
|
+
* @throws {@link KardApi.DoesNotExistError}
|
|
283
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
284
|
+
*
|
|
285
|
+
* @example
|
|
286
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
287
|
+
* include: "categories"
|
|
288
|
+
* })
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* await client.users.rewards.placementContent("organization-123", "user-123", "placement-weekly-bundles", {
|
|
292
|
+
* supportedComponents: "baseReward"
|
|
293
|
+
* })
|
|
294
|
+
*/
|
|
295
|
+
placementContent(organizationId, userId, placementId, request = {}, requestOptions) {
|
|
296
|
+
return core.HttpResponsePromise.fromPromise(this.__placementContent(organizationId, userId, placementId, request, requestOptions));
|
|
297
|
+
}
|
|
298
|
+
__placementContent(organizationId_1, userId_1, placementId_1) {
|
|
299
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, placementId, request = {}, requestOptions) {
|
|
300
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
301
|
+
const { include, supportedComponents } = request;
|
|
302
|
+
const _queryParams = {
|
|
303
|
+
include,
|
|
304
|
+
supportedComponents: Array.isArray(supportedComponents)
|
|
305
|
+
? supportedComponents.map((item) => item)
|
|
306
|
+
: supportedComponents != null
|
|
307
|
+
? supportedComponents
|
|
308
|
+
: undefined,
|
|
309
|
+
};
|
|
310
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
311
|
+
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);
|
|
312
|
+
const _response = yield core.fetcher({
|
|
313
|
+
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)}/content`),
|
|
314
|
+
method: "GET",
|
|
315
|
+
headers: _headers,
|
|
316
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
317
|
+
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,
|
|
318
|
+
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,
|
|
319
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
320
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
321
|
+
logging: this._options.logging,
|
|
322
|
+
});
|
|
323
|
+
if (_response.ok) {
|
|
324
|
+
return {
|
|
325
|
+
data: _response.body,
|
|
326
|
+
rawResponse: _response.rawResponse,
|
|
327
|
+
};
|
|
328
|
+
}
|
|
329
|
+
if (_response.error.reason === "status-code") {
|
|
330
|
+
switch (_response.error.statusCode) {
|
|
331
|
+
case 500:
|
|
332
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
333
|
+
case 400:
|
|
334
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
335
|
+
case 404:
|
|
336
|
+
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
337
|
+
case 401:
|
|
338
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
339
|
+
default:
|
|
340
|
+
throw new errors.KardApiError({
|
|
341
|
+
statusCode: _response.error.statusCode,
|
|
342
|
+
body: _response.error.body,
|
|
343
|
+
rawResponse: _response.rawResponse,
|
|
344
|
+
});
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/content");
|
|
348
|
+
});
|
|
349
|
+
}
|
|
261
350
|
/**
|
|
262
351
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
263
352
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* include: "categories"
|
|
6
|
+
* }
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* {
|
|
10
|
+
* supportedComponents: "baseReward"
|
|
11
|
+
* }
|
|
12
|
+
*/
|
|
13
|
+
export interface GetPlacementContentRequest {
|
|
14
|
+
/** CSV list of included resources in the response (e.g "categories"). Allowed value is `categories`. Only applies to standard placements (those returning `standardOffer` resources). */
|
|
15
|
+
include?: string | string[];
|
|
16
|
+
/** UI component types to include in the response. */
|
|
17
|
+
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
18
|
+
}
|
|
@@ -2,3 +2,4 @@ export type { GetBatchesByPlacementRequest } from "./GetBatchesByPlacementReques
|
|
|
2
2
|
export type { GetLocationsByUserRequest } from "./GetLocationsByUserRequest.mjs";
|
|
3
3
|
export type { GetOffersByPlacementRequest } from "./GetOffersByPlacementRequest.mjs";
|
|
4
4
|
export type { GetOffersByUserRequest } from "./GetOffersByUserRequest.mjs";
|
|
5
|
+
export type { GetPlacementContentRequest } from "./GetPlacementContentRequest.mjs";
|
|
@@ -0,0 +1,5 @@
|
|
|
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;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Combined placement-content response, shaped as a JSON:API document. The placement is resolved server-side: a standard placement yields `standardOffer` resources (with `links`, optional `included` categories, and `meta`), while a batch-activation or group placement yields `placementBatch` slot resources. Callers distinguish the two by each resource's `type` rather than a separate discriminator, and the payload mirrors Get Offers By Placement / Get Batches By Placement exactly.
|
|
4
|
+
*/
|
|
5
|
+
export interface PlacementContentResponse {
|
|
6
|
+
data: KardApi.users.PlacementContentData[];
|
|
7
|
+
links?: KardApi.Links | undefined;
|
|
8
|
+
included?: KardApi.users.EligibilityOfferIncluded[] | undefined;
|
|
9
|
+
meta?: KardApi.users.OffersMeta | undefined;
|
|
10
|
+
}
|
|
@@ -41,6 +41,8 @@ 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
|
+
export * from "./PlacementContentResponse.mjs";
|
|
44
46
|
export * from "./ProgressBar.mjs";
|
|
45
47
|
export * from "./ProgressBarLabelPair.mjs";
|
|
46
48
|
export * from "./ProgressBarLabels.mjs";
|
|
@@ -41,6 +41,8 @@ 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
|
+
export * from "./PlacementContentResponse.mjs";
|
|
44
46
|
export * from "./ProgressBar.mjs";
|
|
45
47
|
export * from "./ProgressBarLabelPair.mjs";
|
|
46
48
|
export * from "./ProgressBarLabels.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "29.
|
|
1
|
+
export declare const SDK_VERSION = "29.2.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "29.
|
|
1
|
+
export const SDK_VERSION = "29.2.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -3158,6 +3158,105 @@ await client.users.rewards.placementBatches("organizationId", "userId", "placeme
|
|
|
3158
3158
|
</dl>
|
|
3159
3159
|
|
|
3160
3160
|
|
|
3161
|
+
</dd>
|
|
3162
|
+
</dl>
|
|
3163
|
+
</details>
|
|
3164
|
+
|
|
3165
|
+
<details><summary><code>client.users.rewards.<a href="/src/api/resources/users/resources/rewards/client/Client.ts">placementContent</a>(organizationId, userId, placementId, { ...params }) -> KardApi.PlacementContentResponse</code></summary>
|
|
3166
|
+
<dl>
|
|
3167
|
+
<dd>
|
|
3168
|
+
|
|
3169
|
+
#### 📝 Description
|
|
3170
|
+
|
|
3171
|
+
<dl>
|
|
3172
|
+
<dd>
|
|
3173
|
+
|
|
3174
|
+
<dl>
|
|
3175
|
+
<dd>
|
|
3176
|
+
|
|
3177
|
+
Retrieve the content for a placement. The placement type is resolved
|
|
3178
|
+
server-side so callers no longer pick an endpoint by placement type.
|
|
3179
|
+
Returns a JSON:API document whose `data` resources are self-describing
|
|
3180
|
+
by `type`: a standard placement returns `standardOffer` resources (the
|
|
3181
|
+
same payload as Get Offers By Placement — with `links`, optional
|
|
3182
|
+
`included` categories, and `meta`); a batch-activation or group
|
|
3183
|
+
placement returns `placementBatch` slot resources (the same payload as
|
|
3184
|
+
Get Batches By Placement). Distinguish the two by each resource's
|
|
3185
|
+
`type`. Email and push-notification placements are not servable through
|
|
3186
|
+
this endpoint and respond with a `400`.<br/>
|
|
3187
|
+
<b>Required scopes:</b> `rewards:read`
|
|
3188
|
+
</dd>
|
|
3189
|
+
</dl>
|
|
3190
|
+
</dd>
|
|
3191
|
+
</dl>
|
|
3192
|
+
|
|
3193
|
+
#### 🔌 Usage
|
|
3194
|
+
|
|
3195
|
+
<dl>
|
|
3196
|
+
<dd>
|
|
3197
|
+
|
|
3198
|
+
<dl>
|
|
3199
|
+
<dd>
|
|
3200
|
+
|
|
3201
|
+
```typescript
|
|
3202
|
+
await client.users.rewards.placementContent("organization-123", "user-123", "placement-homepage-banner", {
|
|
3203
|
+
include: "categories"
|
|
3204
|
+
});
|
|
3205
|
+
|
|
3206
|
+
```
|
|
3207
|
+
</dd>
|
|
3208
|
+
</dl>
|
|
3209
|
+
</dd>
|
|
3210
|
+
</dl>
|
|
3211
|
+
|
|
3212
|
+
#### ⚙️ Parameters
|
|
3213
|
+
|
|
3214
|
+
<dl>
|
|
3215
|
+
<dd>
|
|
3216
|
+
|
|
3217
|
+
<dl>
|
|
3218
|
+
<dd>
|
|
3219
|
+
|
|
3220
|
+
**organizationId:** `KardApi.OrganizationId`
|
|
3221
|
+
|
|
3222
|
+
</dd>
|
|
3223
|
+
</dl>
|
|
3224
|
+
|
|
3225
|
+
<dl>
|
|
3226
|
+
<dd>
|
|
3227
|
+
|
|
3228
|
+
**userId:** `KardApi.UserId`
|
|
3229
|
+
|
|
3230
|
+
</dd>
|
|
3231
|
+
</dl>
|
|
3232
|
+
|
|
3233
|
+
<dl>
|
|
3234
|
+
<dd>
|
|
3235
|
+
|
|
3236
|
+
**placementId:** `string`
|
|
3237
|
+
|
|
3238
|
+
</dd>
|
|
3239
|
+
</dl>
|
|
3240
|
+
|
|
3241
|
+
<dl>
|
|
3242
|
+
<dd>
|
|
3243
|
+
|
|
3244
|
+
**request:** `KardApi.users.GetPlacementContentRequest`
|
|
3245
|
+
|
|
3246
|
+
</dd>
|
|
3247
|
+
</dl>
|
|
3248
|
+
|
|
3249
|
+
<dl>
|
|
3250
|
+
<dd>
|
|
3251
|
+
|
|
3252
|
+
**requestOptions:** `RewardsClient.RequestOptions`
|
|
3253
|
+
|
|
3254
|
+
</dd>
|
|
3255
|
+
</dl>
|
|
3256
|
+
</dd>
|
|
3257
|
+
</dl>
|
|
3258
|
+
|
|
3259
|
+
|
|
3161
3260
|
</dd>
|
|
3162
3261
|
</dl>
|
|
3163
3262
|
</details>
|