@kard-financial/sdk 4.2.1 → 4.3.1
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/attributions/client/Client.d.ts +19 -0
- package/dist/cjs/api/resources/users/resources/attributions/client/Client.js +95 -0
- package/dist/cjs/api/resources/users/resources/attributions/client/requests/BoostOfferRequest.d.ts +11 -0
- package/dist/cjs/api/resources/users/resources/attributions/client/requests/BoostOfferRequest.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/client/requests/index.d.ts +1 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferIncludeOption.d.ts +5 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferIncludeOption.js +8 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferIncluded.d.ts +2 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferIncluded.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferResponse.d.ts +20 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferResponse.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferResponseAttributes.d.ts +6 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferResponseAttributes.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferResponseData.d.ts +6 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/BoostOfferResponseData.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/EventCode.d.ts +1 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/EventCode.js +1 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/index.d.ts +5 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/index.js +5 -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/attributions/client/Client.d.mts +19 -0
- package/dist/esm/api/resources/users/resources/attributions/client/Client.mjs +95 -0
- package/dist/esm/api/resources/users/resources/attributions/client/requests/BoostOfferRequest.d.mts +11 -0
- package/dist/esm/api/resources/users/resources/attributions/client/requests/BoostOfferRequest.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/client/requests/index.d.mts +1 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferIncludeOption.d.mts +5 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferIncludeOption.mjs +5 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferIncluded.d.mts +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferIncluded.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferResponse.d.mts +20 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferResponse.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferResponseAttributes.d.mts +6 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferResponseAttributes.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferResponseData.d.mts +6 -0
- package/dist/esm/api/resources/users/resources/attributions/types/BoostOfferResponseData.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/EventCode.d.mts +1 -0
- package/dist/esm/api/resources/users/resources/attributions/types/EventCode.mjs +1 -0
- package/dist/esm/api/resources/users/resources/attributions/types/index.d.mts +5 -0
- package/dist/esm/api/resources/users/resources/attributions/types/index.mjs +5 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +88 -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": "4.
|
|
47
|
-
"User-Agent": "@kard-financial/sdk/4.
|
|
46
|
+
"X-Fern-SDK-Version": "4.3.1",
|
|
47
|
+
"User-Agent": "@kard-financial/sdk/4.3.1",
|
|
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);
|
|
@@ -75,4 +75,23 @@ export declare class AttributionsClient {
|
|
|
75
75
|
*/
|
|
76
76
|
activate(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.ActivateOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.ActivateOfferResponse>;
|
|
77
77
|
private __activate;
|
|
78
|
+
/**
|
|
79
|
+
* Record when a user boosts an offer. Creates an attribution event with eventCode=BOOST and medium=CTA.
|
|
80
|
+
* Optionally include the offer data by passing `include=offer`.
|
|
81
|
+
*
|
|
82
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
83
|
+
* @param {KardApi.UserId} userId
|
|
84
|
+
* @param {string} offerId - The unique identifier of the offer being boosted
|
|
85
|
+
* @param {KardApi.users.BoostOfferRequest} request
|
|
86
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
87
|
+
*
|
|
88
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
89
|
+
* @throws {@link KardApi.InternalServerError}
|
|
90
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await client.users.attributions.boost("organization-123", "user-123", "offer-456")
|
|
94
|
+
*/
|
|
95
|
+
boost(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.BoostOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BoostOfferResponse>;
|
|
96
|
+
private __boost;
|
|
78
97
|
}
|
|
@@ -258,5 +258,100 @@ class AttributionsClient {
|
|
|
258
258
|
}
|
|
259
259
|
});
|
|
260
260
|
}
|
|
261
|
+
/**
|
|
262
|
+
* Record when a user boosts an offer. Creates an attribution event with eventCode=BOOST and medium=CTA.
|
|
263
|
+
* Optionally include the offer data by passing `include=offer`.
|
|
264
|
+
*
|
|
265
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
266
|
+
* @param {KardApi.UserId} userId
|
|
267
|
+
* @param {string} offerId - The unique identifier of the offer being boosted
|
|
268
|
+
* @param {KardApi.users.BoostOfferRequest} request
|
|
269
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
270
|
+
*
|
|
271
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
272
|
+
* @throws {@link KardApi.InternalServerError}
|
|
273
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* await client.users.attributions.boost("organization-123", "user-123", "offer-456")
|
|
277
|
+
*/
|
|
278
|
+
boost(organizationId, userId, offerId, request = {}, requestOptions) {
|
|
279
|
+
return core.HttpResponsePromise.fromPromise(this.__boost(organizationId, userId, offerId, request, requestOptions));
|
|
280
|
+
}
|
|
281
|
+
__boost(organizationId_1, userId_1, offerId_1) {
|
|
282
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, offerId, request = {}, requestOptions) {
|
|
283
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
284
|
+
const { supportedComponents, include } = request;
|
|
285
|
+
const _queryParams = {};
|
|
286
|
+
if (supportedComponents != null) {
|
|
287
|
+
if (Array.isArray(supportedComponents)) {
|
|
288
|
+
_queryParams.supportedComponents = supportedComponents.map((item) => item);
|
|
289
|
+
}
|
|
290
|
+
else {
|
|
291
|
+
_queryParams.supportedComponents = supportedComponents;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
if (include != null) {
|
|
295
|
+
if (Array.isArray(include)) {
|
|
296
|
+
_queryParams.include = include.map((item) => item);
|
|
297
|
+
}
|
|
298
|
+
else {
|
|
299
|
+
_queryParams.include = include;
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
303
|
+
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);
|
|
304
|
+
const _response = yield core.fetcher({
|
|
305
|
+
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)}/offers/${core.url.encodePathParam(offerId)}/boost`),
|
|
306
|
+
method: "POST",
|
|
307
|
+
headers: _headers,
|
|
308
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
309
|
+
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,
|
|
310
|
+
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,
|
|
311
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
312
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
313
|
+
logging: this._options.logging,
|
|
314
|
+
});
|
|
315
|
+
if (_response.ok) {
|
|
316
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
317
|
+
}
|
|
318
|
+
if (_response.error.reason === "status-code") {
|
|
319
|
+
switch (_response.error.statusCode) {
|
|
320
|
+
case 401:
|
|
321
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
322
|
+
case 500:
|
|
323
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
324
|
+
case 400:
|
|
325
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
326
|
+
default:
|
|
327
|
+
throw new errors.KardApiError({
|
|
328
|
+
statusCode: _response.error.statusCode,
|
|
329
|
+
body: _response.error.body,
|
|
330
|
+
rawResponse: _response.rawResponse,
|
|
331
|
+
});
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
switch (_response.error.reason) {
|
|
335
|
+
case "non-json":
|
|
336
|
+
throw new errors.KardApiError({
|
|
337
|
+
statusCode: _response.error.statusCode,
|
|
338
|
+
body: _response.error.rawBody,
|
|
339
|
+
rawResponse: _response.rawResponse,
|
|
340
|
+
});
|
|
341
|
+
case "body-is-null":
|
|
342
|
+
throw new errors.KardApiError({
|
|
343
|
+
statusCode: _response.error.statusCode,
|
|
344
|
+
rawResponse: _response.rawResponse,
|
|
345
|
+
});
|
|
346
|
+
case "timeout":
|
|
347
|
+
throw new errors.KardApiTimeoutError("Timeout exceeded when calling POST /v2/issuers/{organizationId}/users/{userId}/offers/{offerId}/boost.");
|
|
348
|
+
case "unknown":
|
|
349
|
+
throw new errors.KardApiError({
|
|
350
|
+
message: _response.error.errorMessage,
|
|
351
|
+
rawResponse: _response.rawResponse,
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
});
|
|
355
|
+
}
|
|
261
356
|
}
|
|
262
357
|
exports.AttributionsClient = AttributionsClient;
|
package/dist/cjs/api/resources/users/resources/attributions/client/requests/BoostOfferRequest.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface BoostOfferRequest {
|
|
7
|
+
/** UI component types to include in the offer response (when include=offer). */
|
|
8
|
+
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
9
|
+
/** Related resources to include in the response. Allowed value is `offer`. */
|
|
10
|
+
include?: KardApi.users.BoostOfferIncludeOption | KardApi.users.BoostOfferIncludeOption[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// This file was auto-generated by Fern from our API Definition.
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.BoostOfferIncludeOption = void 0;
|
|
5
|
+
/** Options for what to include in the boost offer response */
|
|
6
|
+
exports.BoostOfferIncludeOption = {
|
|
7
|
+
Offer: "offer",
|
|
8
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* data: {
|
|
6
|
+
* type: "offerAttribution",
|
|
7
|
+
* id: "c94a93a7-beb9-4e58-960c-2c812f849398",
|
|
8
|
+
* attributes: {
|
|
9
|
+
* entityId: "offer-456",
|
|
10
|
+
* eventCode: "BOOST",
|
|
11
|
+
* medium: "CTA",
|
|
12
|
+
* eventDate: "2025-01-01T00:00:00Z"
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
export interface BoostOfferResponse {
|
|
18
|
+
data: KardApi.users.BoostOfferResponseData;
|
|
19
|
+
included?: KardApi.users.BoostOfferIncluded[];
|
|
20
|
+
}
|
|
@@ -3,6 +3,11 @@ export * from "./ActivateOfferIncludeOption.js";
|
|
|
3
3
|
export * from "./ActivateOfferResponse.js";
|
|
4
4
|
export * from "./ActivateOfferResponseAttributes.js";
|
|
5
5
|
export * from "./ActivateOfferResponseData.js";
|
|
6
|
+
export * from "./BoostOfferIncluded.js";
|
|
7
|
+
export * from "./BoostOfferIncludeOption.js";
|
|
8
|
+
export * from "./BoostOfferResponse.js";
|
|
9
|
+
export * from "./BoostOfferResponseAttributes.js";
|
|
10
|
+
export * from "./BoostOfferResponseData.js";
|
|
6
11
|
export * from "./CreateAttributionRequestObject.js";
|
|
7
12
|
export * from "./CreateAttributionRequestUnion.js";
|
|
8
13
|
export * from "./CreateAttributionResponse.js";
|
|
@@ -19,6 +19,11 @@ __exportStar(require("./ActivateOfferIncludeOption.js"), exports);
|
|
|
19
19
|
__exportStar(require("./ActivateOfferResponse.js"), exports);
|
|
20
20
|
__exportStar(require("./ActivateOfferResponseAttributes.js"), exports);
|
|
21
21
|
__exportStar(require("./ActivateOfferResponseData.js"), exports);
|
|
22
|
+
__exportStar(require("./BoostOfferIncluded.js"), exports);
|
|
23
|
+
__exportStar(require("./BoostOfferIncludeOption.js"), exports);
|
|
24
|
+
__exportStar(require("./BoostOfferResponse.js"), exports);
|
|
25
|
+
__exportStar(require("./BoostOfferResponseAttributes.js"), exports);
|
|
26
|
+
__exportStar(require("./BoostOfferResponseData.js"), exports);
|
|
22
27
|
__exportStar(require("./CreateAttributionRequestObject.js"), exports);
|
|
23
28
|
__exportStar(require("./CreateAttributionRequestUnion.js"), exports);
|
|
24
29
|
__exportStar(require("./CreateAttributionResponse.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.
|
|
1
|
+
export declare const SDK_VERSION = "4.3.1";
|
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": "4.
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/4.
|
|
9
|
+
"X-Fern-SDK-Version": "4.3.1",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/4.3.1",
|
|
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);
|
|
@@ -75,4 +75,23 @@ export declare class AttributionsClient {
|
|
|
75
75
|
*/
|
|
76
76
|
activate(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.ActivateOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.ActivateOfferResponse>;
|
|
77
77
|
private __activate;
|
|
78
|
+
/**
|
|
79
|
+
* Record when a user boosts an offer. Creates an attribution event with eventCode=BOOST and medium=CTA.
|
|
80
|
+
* Optionally include the offer data by passing `include=offer`.
|
|
81
|
+
*
|
|
82
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
83
|
+
* @param {KardApi.UserId} userId
|
|
84
|
+
* @param {string} offerId - The unique identifier of the offer being boosted
|
|
85
|
+
* @param {KardApi.users.BoostOfferRequest} request
|
|
86
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
87
|
+
*
|
|
88
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
89
|
+
* @throws {@link KardApi.InternalServerError}
|
|
90
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* await client.users.attributions.boost("organization-123", "user-123", "offer-456")
|
|
94
|
+
*/
|
|
95
|
+
boost(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.BoostOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BoostOfferResponse>;
|
|
96
|
+
private __boost;
|
|
78
97
|
}
|
|
@@ -222,4 +222,99 @@ export class AttributionsClient {
|
|
|
222
222
|
}
|
|
223
223
|
});
|
|
224
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Record when a user boosts an offer. Creates an attribution event with eventCode=BOOST and medium=CTA.
|
|
227
|
+
* Optionally include the offer data by passing `include=offer`.
|
|
228
|
+
*
|
|
229
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
230
|
+
* @param {KardApi.UserId} userId
|
|
231
|
+
* @param {string} offerId - The unique identifier of the offer being boosted
|
|
232
|
+
* @param {KardApi.users.BoostOfferRequest} request
|
|
233
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
234
|
+
*
|
|
235
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
236
|
+
* @throws {@link KardApi.InternalServerError}
|
|
237
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* await client.users.attributions.boost("organization-123", "user-123", "offer-456")
|
|
241
|
+
*/
|
|
242
|
+
boost(organizationId, userId, offerId, request = {}, requestOptions) {
|
|
243
|
+
return core.HttpResponsePromise.fromPromise(this.__boost(organizationId, userId, offerId, request, requestOptions));
|
|
244
|
+
}
|
|
245
|
+
__boost(organizationId_1, userId_1, offerId_1) {
|
|
246
|
+
return __awaiter(this, arguments, void 0, function* (organizationId, userId, offerId, request = {}, requestOptions) {
|
|
247
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
248
|
+
const { supportedComponents, include } = request;
|
|
249
|
+
const _queryParams = {};
|
|
250
|
+
if (supportedComponents != null) {
|
|
251
|
+
if (Array.isArray(supportedComponents)) {
|
|
252
|
+
_queryParams.supportedComponents = supportedComponents.map((item) => item);
|
|
253
|
+
}
|
|
254
|
+
else {
|
|
255
|
+
_queryParams.supportedComponents = supportedComponents;
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
if (include != null) {
|
|
259
|
+
if (Array.isArray(include)) {
|
|
260
|
+
_queryParams.include = include.map((item) => item);
|
|
261
|
+
}
|
|
262
|
+
else {
|
|
263
|
+
_queryParams.include = include;
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
267
|
+
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);
|
|
268
|
+
const _response = yield core.fetcher({
|
|
269
|
+
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)}/offers/${core.url.encodePathParam(offerId)}/boost`),
|
|
270
|
+
method: "POST",
|
|
271
|
+
headers: _headers,
|
|
272
|
+
queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
|
|
273
|
+
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,
|
|
274
|
+
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,
|
|
275
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
276
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
277
|
+
logging: this._options.logging,
|
|
278
|
+
});
|
|
279
|
+
if (_response.ok) {
|
|
280
|
+
return { data: _response.body, rawResponse: _response.rawResponse };
|
|
281
|
+
}
|
|
282
|
+
if (_response.error.reason === "status-code") {
|
|
283
|
+
switch (_response.error.statusCode) {
|
|
284
|
+
case 401:
|
|
285
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
286
|
+
case 500:
|
|
287
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
288
|
+
case 400:
|
|
289
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
290
|
+
default:
|
|
291
|
+
throw new errors.KardApiError({
|
|
292
|
+
statusCode: _response.error.statusCode,
|
|
293
|
+
body: _response.error.body,
|
|
294
|
+
rawResponse: _response.rawResponse,
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
switch (_response.error.reason) {
|
|
299
|
+
case "non-json":
|
|
300
|
+
throw new errors.KardApiError({
|
|
301
|
+
statusCode: _response.error.statusCode,
|
|
302
|
+
body: _response.error.rawBody,
|
|
303
|
+
rawResponse: _response.rawResponse,
|
|
304
|
+
});
|
|
305
|
+
case "body-is-null":
|
|
306
|
+
throw new errors.KardApiError({
|
|
307
|
+
statusCode: _response.error.statusCode,
|
|
308
|
+
rawResponse: _response.rawResponse,
|
|
309
|
+
});
|
|
310
|
+
case "timeout":
|
|
311
|
+
throw new errors.KardApiTimeoutError("Timeout exceeded when calling POST /v2/issuers/{organizationId}/users/{userId}/offers/{offerId}/boost.");
|
|
312
|
+
case "unknown":
|
|
313
|
+
throw new errors.KardApiError({
|
|
314
|
+
message: _response.error.errorMessage,
|
|
315
|
+
rawResponse: _response.rawResponse,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
});
|
|
319
|
+
}
|
|
225
320
|
}
|
package/dist/esm/api/resources/users/resources/attributions/client/requests/BoostOfferRequest.d.mts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {}
|
|
5
|
+
*/
|
|
6
|
+
export interface BoostOfferRequest {
|
|
7
|
+
/** UI component types to include in the offer response (when include=offer). */
|
|
8
|
+
supportedComponents?: KardApi.users.ComponentType | KardApi.users.ComponentType[];
|
|
9
|
+
/** Related resources to include in the response. Allowed value is `offer`. */
|
|
10
|
+
include?: KardApi.users.BoostOfferIncludeOption | KardApi.users.BoostOfferIncludeOption[];
|
|
11
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* @example
|
|
4
|
+
* {
|
|
5
|
+
* data: {
|
|
6
|
+
* type: "offerAttribution",
|
|
7
|
+
* id: "c94a93a7-beb9-4e58-960c-2c812f849398",
|
|
8
|
+
* attributes: {
|
|
9
|
+
* entityId: "offer-456",
|
|
10
|
+
* eventCode: "BOOST",
|
|
11
|
+
* medium: "CTA",
|
|
12
|
+
* eventDate: "2025-01-01T00:00:00Z"
|
|
13
|
+
* }
|
|
14
|
+
* }
|
|
15
|
+
* }
|
|
16
|
+
*/
|
|
17
|
+
export interface BoostOfferResponse {
|
|
18
|
+
data: KardApi.users.BoostOfferResponseData;
|
|
19
|
+
included?: KardApi.users.BoostOfferIncluded[];
|
|
20
|
+
}
|
|
@@ -3,6 +3,11 @@ export * from "./ActivateOfferIncludeOption.mjs";
|
|
|
3
3
|
export * from "./ActivateOfferResponse.mjs";
|
|
4
4
|
export * from "./ActivateOfferResponseAttributes.mjs";
|
|
5
5
|
export * from "./ActivateOfferResponseData.mjs";
|
|
6
|
+
export * from "./BoostOfferIncluded.mjs";
|
|
7
|
+
export * from "./BoostOfferIncludeOption.mjs";
|
|
8
|
+
export * from "./BoostOfferResponse.mjs";
|
|
9
|
+
export * from "./BoostOfferResponseAttributes.mjs";
|
|
10
|
+
export * from "./BoostOfferResponseData.mjs";
|
|
6
11
|
export * from "./CreateAttributionRequestObject.mjs";
|
|
7
12
|
export * from "./CreateAttributionRequestUnion.mjs";
|
|
8
13
|
export * from "./CreateAttributionResponse.mjs";
|
|
@@ -3,6 +3,11 @@ export * from "./ActivateOfferIncludeOption.mjs";
|
|
|
3
3
|
export * from "./ActivateOfferResponse.mjs";
|
|
4
4
|
export * from "./ActivateOfferResponseAttributes.mjs";
|
|
5
5
|
export * from "./ActivateOfferResponseData.mjs";
|
|
6
|
+
export * from "./BoostOfferIncluded.mjs";
|
|
7
|
+
export * from "./BoostOfferIncludeOption.mjs";
|
|
8
|
+
export * from "./BoostOfferResponse.mjs";
|
|
9
|
+
export * from "./BoostOfferResponseAttributes.mjs";
|
|
10
|
+
export * from "./BoostOfferResponseData.mjs";
|
|
6
11
|
export * from "./CreateAttributionRequestObject.mjs";
|
|
7
12
|
export * from "./CreateAttributionRequestUnion.mjs";
|
|
8
13
|
export * from "./CreateAttributionResponse.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "4.
|
|
1
|
+
export declare const SDK_VERSION = "4.3.1";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "4.
|
|
1
|
+
export const SDK_VERSION = "4.3.1";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -1325,6 +1325,94 @@ await client.users.attributions.activate("organization-123", "user-123", "offer-
|
|
|
1325
1325
|
</dl>
|
|
1326
1326
|
|
|
1327
1327
|
|
|
1328
|
+
</dd>
|
|
1329
|
+
</dl>
|
|
1330
|
+
</details>
|
|
1331
|
+
|
|
1332
|
+
<details><summary><code>client.users.attributions.<a href="/src/api/resources/users/resources/attributions/client/Client.ts">boost</a>(organizationId, userId, offerId, { ...params }) -> KardApi.BoostOfferResponse</code></summary>
|
|
1333
|
+
<dl>
|
|
1334
|
+
<dd>
|
|
1335
|
+
|
|
1336
|
+
#### 📝 Description
|
|
1337
|
+
|
|
1338
|
+
<dl>
|
|
1339
|
+
<dd>
|
|
1340
|
+
|
|
1341
|
+
<dl>
|
|
1342
|
+
<dd>
|
|
1343
|
+
|
|
1344
|
+
Record when a user boosts an offer. Creates an attribution event with eventCode=BOOST and medium=CTA.
|
|
1345
|
+
Optionally include the offer data by passing `include=offer`.
|
|
1346
|
+
</dd>
|
|
1347
|
+
</dl>
|
|
1348
|
+
</dd>
|
|
1349
|
+
</dl>
|
|
1350
|
+
|
|
1351
|
+
#### 🔌 Usage
|
|
1352
|
+
|
|
1353
|
+
<dl>
|
|
1354
|
+
<dd>
|
|
1355
|
+
|
|
1356
|
+
<dl>
|
|
1357
|
+
<dd>
|
|
1358
|
+
|
|
1359
|
+
```typescript
|
|
1360
|
+
await client.users.attributions.boost("organization-123", "user-123", "offer-456");
|
|
1361
|
+
|
|
1362
|
+
```
|
|
1363
|
+
</dd>
|
|
1364
|
+
</dl>
|
|
1365
|
+
</dd>
|
|
1366
|
+
</dl>
|
|
1367
|
+
|
|
1368
|
+
#### ⚙️ Parameters
|
|
1369
|
+
|
|
1370
|
+
<dl>
|
|
1371
|
+
<dd>
|
|
1372
|
+
|
|
1373
|
+
<dl>
|
|
1374
|
+
<dd>
|
|
1375
|
+
|
|
1376
|
+
**organizationId:** `KardApi.OrganizationId`
|
|
1377
|
+
|
|
1378
|
+
</dd>
|
|
1379
|
+
</dl>
|
|
1380
|
+
|
|
1381
|
+
<dl>
|
|
1382
|
+
<dd>
|
|
1383
|
+
|
|
1384
|
+
**userId:** `KardApi.UserId`
|
|
1385
|
+
|
|
1386
|
+
</dd>
|
|
1387
|
+
</dl>
|
|
1388
|
+
|
|
1389
|
+
<dl>
|
|
1390
|
+
<dd>
|
|
1391
|
+
|
|
1392
|
+
**offerId:** `string` — The unique identifier of the offer being boosted
|
|
1393
|
+
|
|
1394
|
+
</dd>
|
|
1395
|
+
</dl>
|
|
1396
|
+
|
|
1397
|
+
<dl>
|
|
1398
|
+
<dd>
|
|
1399
|
+
|
|
1400
|
+
**request:** `KardApi.users.BoostOfferRequest`
|
|
1401
|
+
|
|
1402
|
+
</dd>
|
|
1403
|
+
</dl>
|
|
1404
|
+
|
|
1405
|
+
<dl>
|
|
1406
|
+
<dd>
|
|
1407
|
+
|
|
1408
|
+
**requestOptions:** `AttributionsClient.RequestOptions`
|
|
1409
|
+
|
|
1410
|
+
</dd>
|
|
1411
|
+
</dl>
|
|
1412
|
+
</dd>
|
|
1413
|
+
</dl>
|
|
1414
|
+
|
|
1415
|
+
|
|
1328
1416
|
</dd>
|
|
1329
1417
|
</dl>
|
|
1330
1418
|
</details>
|