@kard-financial/sdk 14.1.0 → 14.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/organizations/resources/placements/client/Client.d.ts +1 -0
- package/dist/cjs/api/resources/organizations/resources/placements/client/Client.js +6 -1
- package/dist/cjs/api/resources/organizations/resources/placements/client/requests/ListPlacementsRequest.d.ts +5 -0
- package/dist/cjs/api/resources/organizations/resources/placements/types/PlacementTypeFilter.d.ts +6 -0
- package/dist/cjs/api/resources/organizations/resources/placements/types/PlacementTypeFilter.js +9 -0
- package/dist/cjs/api/resources/organizations/resources/placements/types/index.d.ts +1 -0
- package/dist/cjs/api/resources/organizations/resources/placements/types/index.js +1 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.d.ts +21 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/Client.js +75 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.d.ts +16 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.js +3 -0
- package/dist/cjs/api/resources/users/resources/rewards/client/requests/index.d.ts +1 -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/organizations/resources/placements/client/Client.d.mts +1 -0
- package/dist/esm/api/resources/organizations/resources/placements/client/Client.mjs +6 -1
- package/dist/esm/api/resources/organizations/resources/placements/client/requests/ListPlacementsRequest.d.mts +5 -0
- package/dist/esm/api/resources/organizations/resources/placements/types/PlacementTypeFilter.d.mts +6 -0
- package/dist/esm/api/resources/organizations/resources/placements/types/PlacementTypeFilter.mjs +6 -0
- package/dist/esm/api/resources/organizations/resources/placements/types/index.d.mts +1 -0
- package/dist/esm/api/resources/organizations/resources/placements/types/index.mjs +1 -0
- package/dist/esm/api/resources/users/resources/rewards/client/Client.d.mts +21 -0
- package/dist/esm/api/resources/users/resources/rewards/client/Client.mjs +75 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.d.mts +16 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/GetOffersByPlacementRequest.mjs +2 -0
- package/dist/esm/api/resources/users/resources/rewards/client/requests/index.d.mts +1 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +89 -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": "14.
|
|
47
|
-
"User-Agent": "@kard-financial/sdk/14.
|
|
46
|
+
"X-Fern-SDK-Version": "14.3.0",
|
|
47
|
+
"User-Agent": "@kard-financial/sdk/14.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);
|
|
@@ -59,6 +59,7 @@ export declare class PlacementsClient {
|
|
|
59
59
|
*
|
|
60
60
|
* @throws {@link KardApi.UnauthorizedError}
|
|
61
61
|
* @throws {@link KardApi.ForbiddenError}
|
|
62
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
62
63
|
* @throws {@link KardApi.DoesNotExistError}
|
|
63
64
|
* @throws {@link KardApi.InternalServerError}
|
|
64
65
|
*
|
|
@@ -153,6 +153,7 @@ class PlacementsClient {
|
|
|
153
153
|
*
|
|
154
154
|
* @throws {@link KardApi.UnauthorizedError}
|
|
155
155
|
* @throws {@link KardApi.ForbiddenError}
|
|
156
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
156
157
|
* @throws {@link KardApi.DoesNotExistError}
|
|
157
158
|
* @throws {@link KardApi.InternalServerError}
|
|
158
159
|
*
|
|
@@ -165,8 +166,10 @@ class PlacementsClient {
|
|
|
165
166
|
__list(organizationId_1) {
|
|
166
167
|
return __awaiter(this, arguments, void 0, function* (organizationId, request = {}, requestOptions) {
|
|
167
168
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
168
|
-
const { "page[after]": pageAfter, "page[size]": pageSize } = request;
|
|
169
|
+
const { "filter[type]": filterType, "filter[name]": filterName, "page[after]": pageAfter, "page[size]": pageSize, } = request;
|
|
169
170
|
const _queryParams = {
|
|
171
|
+
"filter[type]": filterType != null ? filterType : undefined,
|
|
172
|
+
"filter[name]": filterName,
|
|
170
173
|
"page[after]": pageAfter,
|
|
171
174
|
"page[size]": pageSize,
|
|
172
175
|
};
|
|
@@ -195,6 +198,8 @@ class PlacementsClient {
|
|
|
195
198
|
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
196
199
|
case 403:
|
|
197
200
|
throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
201
|
+
case 400:
|
|
202
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
198
203
|
case 404:
|
|
199
204
|
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
200
205
|
case 500:
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.js";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {}
|
|
4
5
|
*/
|
|
5
6
|
export interface ListPlacementsRequest {
|
|
7
|
+
/** Filter by placement type (placementMainPage or placementPushNotification) */
|
|
8
|
+
"filter[type]"?: KardApi.organizations.PlacementTypeFilter;
|
|
9
|
+
/** Filter by exact placement name (unique within an organization per type) */
|
|
10
|
+
"filter[name]"?: string;
|
|
6
11
|
/** Cursor value for the next page of results */
|
|
7
12
|
"page[after]"?: string;
|
|
8
13
|
/** Maximum number of records to return [1 - 200] (default = 200) */
|
package/dist/cjs/api/resources/organizations/resources/placements/types/PlacementTypeFilter.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Placement type discriminator used as a list filter */
|
|
2
|
+
export declare const PlacementTypeFilter: {
|
|
3
|
+
readonly PlacementMainPage: "placementMainPage";
|
|
4
|
+
readonly PlacementPushNotification: "placementPushNotification";
|
|
5
|
+
};
|
|
6
|
+
export type PlacementTypeFilter = (typeof PlacementTypeFilter)[keyof typeof PlacementTypeFilter];
|
package/dist/cjs/api/resources/organizations/resources/placements/types/PlacementTypeFilter.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.PlacementTypeFilter = void 0;
|
|
5
|
+
/** Placement type discriminator used as a list filter */
|
|
6
|
+
exports.PlacementTypeFilter = {
|
|
7
|
+
PlacementMainPage: "placementMainPage",
|
|
8
|
+
PlacementPushNotification: "placementPushNotification",
|
|
9
|
+
};
|
|
@@ -11,6 +11,7 @@ export * from "./MainPagePlacementAttributes.js";
|
|
|
11
11
|
export * from "./MainPagePlacementData.js";
|
|
12
12
|
export * from "./PlacementFormatUnion.js";
|
|
13
13
|
export * from "./PlacementListResponse.js";
|
|
14
|
+
export * from "./PlacementTypeFilter.js";
|
|
14
15
|
export * from "./PushNotificationPlacementAttributes.js";
|
|
15
16
|
export * from "./PushNotificationPlacementData.js";
|
|
16
17
|
export * from "./UpdateMainPageAttributes.js";
|
|
@@ -27,6 +27,7 @@ __exportStar(require("./MainPagePlacementAttributes.js"), exports);
|
|
|
27
27
|
__exportStar(require("./MainPagePlacementData.js"), exports);
|
|
28
28
|
__exportStar(require("./PlacementFormatUnion.js"), exports);
|
|
29
29
|
__exportStar(require("./PlacementListResponse.js"), exports);
|
|
30
|
+
__exportStar(require("./PlacementTypeFilter.js"), exports);
|
|
30
31
|
__exportStar(require("./PushNotificationPlacementAttributes.js"), exports);
|
|
31
32
|
__exportStar(require("./PushNotificationPlacementData.js"), exports);
|
|
32
33
|
__exportStar(require("./UpdateMainPageAttributes.js"), exports);
|
|
@@ -35,6 +35,27 @@ 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;
|
|
38
59
|
/**
|
|
39
60
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
40
61
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -139,6 +139,81 @@ 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
|
+
}
|
|
142
217
|
/**
|
|
143
218
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
144
219
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "14.
|
|
1
|
+
export declare const SDK_VERSION = "14.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": "14.
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/14.
|
|
9
|
+
"X-Fern-SDK-Version": "14.3.0",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/14.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);
|
|
@@ -59,6 +59,7 @@ export declare class PlacementsClient {
|
|
|
59
59
|
*
|
|
60
60
|
* @throws {@link KardApi.UnauthorizedError}
|
|
61
61
|
* @throws {@link KardApi.ForbiddenError}
|
|
62
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
62
63
|
* @throws {@link KardApi.DoesNotExistError}
|
|
63
64
|
* @throws {@link KardApi.InternalServerError}
|
|
64
65
|
*
|
|
@@ -117,6 +117,7 @@ export class PlacementsClient {
|
|
|
117
117
|
*
|
|
118
118
|
* @throws {@link KardApi.UnauthorizedError}
|
|
119
119
|
* @throws {@link KardApi.ForbiddenError}
|
|
120
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
120
121
|
* @throws {@link KardApi.DoesNotExistError}
|
|
121
122
|
* @throws {@link KardApi.InternalServerError}
|
|
122
123
|
*
|
|
@@ -129,8 +130,10 @@ export class PlacementsClient {
|
|
|
129
130
|
__list(organizationId_1) {
|
|
130
131
|
return __awaiter(this, arguments, void 0, function* (organizationId, request = {}, requestOptions) {
|
|
131
132
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
132
|
-
const { "page[after]": pageAfter, "page[size]": pageSize } = request;
|
|
133
|
+
const { "filter[type]": filterType, "filter[name]": filterName, "page[after]": pageAfter, "page[size]": pageSize, } = request;
|
|
133
134
|
const _queryParams = {
|
|
135
|
+
"filter[type]": filterType != null ? filterType : undefined,
|
|
136
|
+
"filter[name]": filterName,
|
|
134
137
|
"page[after]": pageAfter,
|
|
135
138
|
"page[size]": pageSize,
|
|
136
139
|
};
|
|
@@ -159,6 +162,8 @@ export class PlacementsClient {
|
|
|
159
162
|
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
160
163
|
case 403:
|
|
161
164
|
throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
|
|
165
|
+
case 400:
|
|
166
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
162
167
|
case 404:
|
|
163
168
|
throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
|
|
164
169
|
case 500:
|
|
@@ -1,8 +1,13 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.mjs";
|
|
1
2
|
/**
|
|
2
3
|
* @example
|
|
3
4
|
* {}
|
|
4
5
|
*/
|
|
5
6
|
export interface ListPlacementsRequest {
|
|
7
|
+
/** Filter by placement type (placementMainPage or placementPushNotification) */
|
|
8
|
+
"filter[type]"?: KardApi.organizations.PlacementTypeFilter;
|
|
9
|
+
/** Filter by exact placement name (unique within an organization per type) */
|
|
10
|
+
"filter[name]"?: string;
|
|
6
11
|
/** Cursor value for the next page of results */
|
|
7
12
|
"page[after]"?: string;
|
|
8
13
|
/** Maximum number of records to return [1 - 200] (default = 200) */
|
package/dist/esm/api/resources/organizations/resources/placements/types/PlacementTypeFilter.d.mts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Placement type discriminator used as a list filter */
|
|
2
|
+
export declare const PlacementTypeFilter: {
|
|
3
|
+
readonly PlacementMainPage: "placementMainPage";
|
|
4
|
+
readonly PlacementPushNotification: "placementPushNotification";
|
|
5
|
+
};
|
|
6
|
+
export type PlacementTypeFilter = (typeof PlacementTypeFilter)[keyof typeof PlacementTypeFilter];
|
|
@@ -11,6 +11,7 @@ export * from "./MainPagePlacementAttributes.mjs";
|
|
|
11
11
|
export * from "./MainPagePlacementData.mjs";
|
|
12
12
|
export * from "./PlacementFormatUnion.mjs";
|
|
13
13
|
export * from "./PlacementListResponse.mjs";
|
|
14
|
+
export * from "./PlacementTypeFilter.mjs";
|
|
14
15
|
export * from "./PushNotificationPlacementAttributes.mjs";
|
|
15
16
|
export * from "./PushNotificationPlacementData.mjs";
|
|
16
17
|
export * from "./UpdateMainPageAttributes.mjs";
|
|
@@ -11,6 +11,7 @@ export * from "./MainPagePlacementAttributes.mjs";
|
|
|
11
11
|
export * from "./MainPagePlacementData.mjs";
|
|
12
12
|
export * from "./PlacementFormatUnion.mjs";
|
|
13
13
|
export * from "./PlacementListResponse.mjs";
|
|
14
|
+
export * from "./PlacementTypeFilter.mjs";
|
|
14
15
|
export * from "./PushNotificationPlacementAttributes.mjs";
|
|
15
16
|
export * from "./PushNotificationPlacementData.mjs";
|
|
16
17
|
export * from "./UpdateMainPageAttributes.mjs";
|
|
@@ -35,6 +35,27 @@ 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;
|
|
38
59
|
/**
|
|
39
60
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
40
61
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -103,6 +103,81 @@ 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
|
+
}
|
|
106
181
|
/**
|
|
107
182
|
* Retrieve national and local geographic locations that a specified user has eligible in-store offers at. Use this endpoint to build
|
|
108
183
|
* out your [map-specific UX experiences](/2024-10-01/api/getting-started#c-discover-clos-near-you-map-view). Please note
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "14.
|
|
1
|
+
export declare const SDK_VERSION = "14.3.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "14.
|
|
1
|
+
export const SDK_VERSION = "14.3.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -2491,6 +2491,95 @@ await client.users.rewards.offers("organization-123", "user-123", {
|
|
|
2491
2491
|
</dl>
|
|
2492
2492
|
|
|
2493
2493
|
|
|
2494
|
+
</dd>
|
|
2495
|
+
</dl>
|
|
2496
|
+
</details>
|
|
2497
|
+
|
|
2498
|
+
<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>
|
|
2499
|
+
<dl>
|
|
2500
|
+
<dd>
|
|
2501
|
+
|
|
2502
|
+
#### 📝 Description
|
|
2503
|
+
|
|
2504
|
+
<dl>
|
|
2505
|
+
<dd>
|
|
2506
|
+
|
|
2507
|
+
<dl>
|
|
2508
|
+
<dd>
|
|
2509
|
+
|
|
2510
|
+
Retrieve offers for a placement slot. Returns offers sorted by highest cash back,
|
|
2511
|
+
limited by the placement's available slots.<br/>
|
|
2512
|
+
<b>Required scopes:</b> `rewards:read`
|
|
2513
|
+
</dd>
|
|
2514
|
+
</dl>
|
|
2515
|
+
</dd>
|
|
2516
|
+
</dl>
|
|
2517
|
+
|
|
2518
|
+
#### 🔌 Usage
|
|
2519
|
+
|
|
2520
|
+
<dl>
|
|
2521
|
+
<dd>
|
|
2522
|
+
|
|
2523
|
+
<dl>
|
|
2524
|
+
<dd>
|
|
2525
|
+
|
|
2526
|
+
```typescript
|
|
2527
|
+
await client.users.rewards.placementOffers("organizationId", "userId", "placementId");
|
|
2528
|
+
|
|
2529
|
+
```
|
|
2530
|
+
</dd>
|
|
2531
|
+
</dl>
|
|
2532
|
+
</dd>
|
|
2533
|
+
</dl>
|
|
2534
|
+
|
|
2535
|
+
#### ⚙️ Parameters
|
|
2536
|
+
|
|
2537
|
+
<dl>
|
|
2538
|
+
<dd>
|
|
2539
|
+
|
|
2540
|
+
<dl>
|
|
2541
|
+
<dd>
|
|
2542
|
+
|
|
2543
|
+
**organizationId:** `KardApi.OrganizationId`
|
|
2544
|
+
|
|
2545
|
+
</dd>
|
|
2546
|
+
</dl>
|
|
2547
|
+
|
|
2548
|
+
<dl>
|
|
2549
|
+
<dd>
|
|
2550
|
+
|
|
2551
|
+
**userId:** `KardApi.UserId`
|
|
2552
|
+
|
|
2553
|
+
</dd>
|
|
2554
|
+
</dl>
|
|
2555
|
+
|
|
2556
|
+
<dl>
|
|
2557
|
+
<dd>
|
|
2558
|
+
|
|
2559
|
+
**placementId:** `string`
|
|
2560
|
+
|
|
2561
|
+
</dd>
|
|
2562
|
+
</dl>
|
|
2563
|
+
|
|
2564
|
+
<dl>
|
|
2565
|
+
<dd>
|
|
2566
|
+
|
|
2567
|
+
**request:** `KardApi.users.GetOffersByPlacementRequest`
|
|
2568
|
+
|
|
2569
|
+
</dd>
|
|
2570
|
+
</dl>
|
|
2571
|
+
|
|
2572
|
+
<dl>
|
|
2573
|
+
<dd>
|
|
2574
|
+
|
|
2575
|
+
**requestOptions:** `RewardsClient.RequestOptions`
|
|
2576
|
+
|
|
2577
|
+
</dd>
|
|
2578
|
+
</dl>
|
|
2579
|
+
</dd>
|
|
2580
|
+
</dl>
|
|
2581
|
+
|
|
2582
|
+
|
|
2494
2583
|
</dd>
|
|
2495
2584
|
</dl>
|
|
2496
2585
|
</details>
|