@kard-financial/sdk 22.3.0 → 22.4.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/attributions/client/Client.d.ts +25 -0
- package/dist/cjs/api/resources/users/resources/attributions/client/Client.js +67 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.d.ts +23 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.d.ts +15 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.d.ts +7 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/AttributionState.d.ts +4 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/CreateAttributionRequestUnion.d.ts +4 -1
- package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.d.ts +19 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.d.ts +4 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.js +3 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotMedium.d.ts +5 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/PlacementSlotMedium.js +8 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/index.d.ts +6 -0
- package/dist/cjs/api/resources/users/resources/attributions/types/index.js +6 -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 +25 -0
- package/dist/esm/api/resources/users/resources/attributions/client/Client.mjs +67 -0
- package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.d.mts +23 -0
- package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.d.mts +15 -0
- package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseAttributes.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.d.mts +7 -0
- package/dist/esm/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponseData.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/AttributionState.d.mts +4 -0
- package/dist/esm/api/resources/users/resources/attributions/types/CreateAttributionRequestUnion.d.mts +4 -1
- package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.d.mts +19 -0
- package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionAttributes.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.d.mts +4 -0
- package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotAttributionRequest.mjs +2 -0
- package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotMedium.d.mts +5 -0
- package/dist/esm/api/resources/users/resources/attributions/types/PlacementSlotMedium.mjs +5 -0
- package/dist/esm/api/resources/users/resources/attributions/types/index.d.mts +6 -0
- package/dist/esm/api/resources/users/resources/attributions/types/index.mjs +6 -0
- package/dist/esm/version.d.mts +1 -1
- package/dist/esm/version.mjs +1 -1
- package/package.json +1 -1
- package/reference.md +94 -0
package/dist/cjs/BaseClient.js
CHANGED
|
@@ -43,8 +43,8 @@ function normalizeClientOptions(options) {
|
|
|
43
43
|
const headers = (0, headers_js_1.mergeHeaders)({
|
|
44
44
|
"X-Fern-Language": "JavaScript",
|
|
45
45
|
"X-Fern-SDK-Name": "@kard-financial/sdk",
|
|
46
|
-
"X-Fern-SDK-Version": "22.
|
|
47
|
-
"User-Agent": "@kard-financial/sdk/22.
|
|
46
|
+
"X-Fern-SDK-Version": "22.4.0",
|
|
47
|
+
"User-Agent": "@kard-financial/sdk/22.4.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);
|
|
@@ -93,4 +93,29 @@ export declare class AttributionsClient {
|
|
|
93
93
|
*/
|
|
94
94
|
boost(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.BoostOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BoostOfferResponse>;
|
|
95
95
|
private __boost;
|
|
96
|
+
/**
|
|
97
|
+
* Record when a user activates a batch-activation placement slot. Writes a slot-level
|
|
98
|
+
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
99
|
+
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
100
|
+
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
101
|
+
* partner can render the batch immediately without an extra `getBatchesByPlacement`
|
|
102
|
+
* round-trip.
|
|
103
|
+
*
|
|
104
|
+
* <b>Required scopes:</b> `attributions:write`
|
|
105
|
+
*
|
|
106
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
107
|
+
* @param {KardApi.UserId} userId
|
|
108
|
+
* @param {string} placementId - Unique identifier of the placement (UUID v7)
|
|
109
|
+
* @param {string} slotId - Stable identifier for the slot within the placement
|
|
110
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
111
|
+
*
|
|
112
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
113
|
+
* @throws {@link KardApi.InternalServerError}
|
|
114
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
|
|
118
|
+
*/
|
|
119
|
+
activatePlacementSlot(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, slotId: string, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.ActivatePlacementSlotResponse>;
|
|
120
|
+
private __activatePlacementSlot;
|
|
96
121
|
}
|
|
@@ -279,5 +279,72 @@ class AttributionsClient {
|
|
|
279
279
|
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/offers/{offerId}/boost");
|
|
280
280
|
});
|
|
281
281
|
}
|
|
282
|
+
/**
|
|
283
|
+
* Record when a user activates a batch-activation placement slot. Writes a slot-level
|
|
284
|
+
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
285
|
+
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
286
|
+
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
287
|
+
* partner can render the batch immediately without an extra `getBatchesByPlacement`
|
|
288
|
+
* round-trip.
|
|
289
|
+
*
|
|
290
|
+
* <b>Required scopes:</b> `attributions:write`
|
|
291
|
+
*
|
|
292
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
293
|
+
* @param {KardApi.UserId} userId
|
|
294
|
+
* @param {string} placementId - Unique identifier of the placement (UUID v7)
|
|
295
|
+
* @param {string} slotId - Stable identifier for the slot within the placement
|
|
296
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
297
|
+
*
|
|
298
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
299
|
+
* @throws {@link KardApi.InternalServerError}
|
|
300
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
301
|
+
*
|
|
302
|
+
* @example
|
|
303
|
+
* await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
|
|
304
|
+
*/
|
|
305
|
+
activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
|
|
306
|
+
return core.HttpResponsePromise.fromPromise(this.__activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions));
|
|
307
|
+
}
|
|
308
|
+
__activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
|
|
309
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
310
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
311
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
312
|
+
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);
|
|
313
|
+
const _response = yield core.fetcher({
|
|
314
|
+
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)}/slot/${core.url.encodePathParam(slotId)}/activate`),
|
|
315
|
+
method: "POST",
|
|
316
|
+
headers: _headers,
|
|
317
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
318
|
+
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,
|
|
319
|
+
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,
|
|
320
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
321
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
322
|
+
logging: this._options.logging,
|
|
323
|
+
});
|
|
324
|
+
if (_response.ok) {
|
|
325
|
+
return {
|
|
326
|
+
data: _response.body,
|
|
327
|
+
rawResponse: _response.rawResponse,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
if (_response.error.reason === "status-code") {
|
|
331
|
+
switch (_response.error.statusCode) {
|
|
332
|
+
case 401:
|
|
333
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
334
|
+
case 500:
|
|
335
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
336
|
+
case 400:
|
|
337
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
338
|
+
default:
|
|
339
|
+
throw new errors.KardApiError({
|
|
340
|
+
statusCode: _response.error.statusCode,
|
|
341
|
+
body: _response.error.body,
|
|
342
|
+
rawResponse: _response.rawResponse,
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/slot/{slotId}/activate");
|
|
347
|
+
});
|
|
348
|
+
}
|
|
282
349
|
}
|
|
283
350
|
exports.AttributionsClient = AttributionsClient;
|
package/dist/cjs/api/resources/users/resources/attributions/types/ActivatePlacementSlotResponse.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Ack payload for a slot activation request.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* data: {
|
|
8
|
+
* type: "placementSlotAttribution",
|
|
9
|
+
* id: "c94a93a7-beb9-4e58-960c-2c812f849398",
|
|
10
|
+
* attributes: {
|
|
11
|
+
* placementId: "018f8d6b-1abc-7def-9012-345678901234",
|
|
12
|
+
* slotId: "slot-a",
|
|
13
|
+
* eventCode: "ACTIVATE",
|
|
14
|
+
* medium: "CTA",
|
|
15
|
+
* eventDate: "2025-01-01T00:00:00Z",
|
|
16
|
+
* offerIds: ["offer-1", "offer-2", "offer-3"]
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export interface ActivatePlacementSlotResponse {
|
|
22
|
+
data: KardApi.users.ActivatePlacementSlotResponseData;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ActivatePlacementSlotResponseAttributes {
|
|
2
|
+
/** Unique identifier of the placement */
|
|
3
|
+
placementId: string;
|
|
4
|
+
/** Stable identifier for the slot within the placement */
|
|
5
|
+
slotId: string;
|
|
6
|
+
eventCode: string;
|
|
7
|
+
medium: string;
|
|
8
|
+
eventDate: string;
|
|
9
|
+
/**
|
|
10
|
+
* All offer IDs that resolved under the slot's content strategy and had
|
|
11
|
+
* per-offer `offerAttribution` ACTIVATE events written. The partner can use
|
|
12
|
+
* this to render the batch immediately without an extra round-trip.
|
|
13
|
+
*/
|
|
14
|
+
offerIds: string[];
|
|
15
|
+
}
|
|
@@ -4,4 +4,8 @@ export interface AttributionState {
|
|
|
4
4
|
rank?: number | undefined;
|
|
5
5
|
/** The active filters when the user saw the offer */
|
|
6
6
|
filters?: KardApi.users.AttributionFilter[] | undefined;
|
|
7
|
+
/** Unique identifier of the placement the attribution event originated from */
|
|
8
|
+
placementId?: string | undefined;
|
|
9
|
+
/** Stable identifier for the slot within the placement */
|
|
10
|
+
slotId?: string | undefined;
|
|
7
11
|
}
|
package/dist/cjs/api/resources/users/resources/attributions/types/CreateAttributionRequestUnion.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as KardApi from "../../../../../index.js";
|
|
2
|
-
export type CreateAttributionRequestUnion = KardApi.users.CreateAttributionRequestUnion.OfferAttribution | KardApi.users.CreateAttributionRequestUnion.NotificationAttribution;
|
|
2
|
+
export type CreateAttributionRequestUnion = KardApi.users.CreateAttributionRequestUnion.OfferAttribution | KardApi.users.CreateAttributionRequestUnion.NotificationAttribution | KardApi.users.CreateAttributionRequestUnion.PlacementSlotAttribution;
|
|
3
3
|
export declare namespace CreateAttributionRequestUnion {
|
|
4
4
|
interface OfferAttribution extends KardApi.users.OfferAttributionRequest {
|
|
5
5
|
type: "offerAttribution";
|
|
@@ -7,4 +7,7 @@ export declare namespace CreateAttributionRequestUnion {
|
|
|
7
7
|
interface NotificationAttribution extends KardApi.users.NotificationAttributionRequest {
|
|
8
8
|
type: "notificationAttribution";
|
|
9
9
|
}
|
|
10
|
+
interface PlacementSlotAttribution extends KardApi.users.PlacementSlotAttributionRequest {
|
|
11
|
+
type: "placementSlotAttribution";
|
|
12
|
+
}
|
|
10
13
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Attributes for a slot-level activation event on a batch-activation placement.
|
|
4
|
+
* A slot activation also writes per-offer `offerAttribution` ACTIVATE events for
|
|
5
|
+
* every offer resolved by the slot's content strategy (see `ActivatePlacementSlot`).
|
|
6
|
+
*/
|
|
7
|
+
export interface PlacementSlotAttributionAttributes {
|
|
8
|
+
/** The slot ID (matches `state.slotId`) */
|
|
9
|
+
entityId: string;
|
|
10
|
+
eventCode: KardApi.users.EventCode;
|
|
11
|
+
medium: KardApi.users.PlacementSlotMedium;
|
|
12
|
+
/**
|
|
13
|
+
* The timestamp of the attribution event.
|
|
14
|
+
* Must be in ISO 8601 format (e.g., "2025-01-01T00:00:00Z").
|
|
15
|
+
*/
|
|
16
|
+
eventDate: string;
|
|
17
|
+
/** Placement context for the attribution event */
|
|
18
|
+
state?: KardApi.users.AttributionState | undefined;
|
|
19
|
+
}
|
|
@@ -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.PlacementSlotMedium = void 0;
|
|
5
|
+
/** Where the placement-slot attribution event is taking place in your rewards experience. */
|
|
6
|
+
exports.PlacementSlotMedium = {
|
|
7
|
+
Cta: "CTA",
|
|
8
|
+
};
|
|
@@ -3,6 +3,9 @@ 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 "./ActivatePlacementSlotResponse.js";
|
|
7
|
+
export * from "./ActivatePlacementSlotResponseAttributes.js";
|
|
8
|
+
export * from "./ActivatePlacementSlotResponseData.js";
|
|
6
9
|
export * from "./AttributionFilter.js";
|
|
7
10
|
export * from "./AttributionState.js";
|
|
8
11
|
export * from "./BoostOfferIncluded.js";
|
|
@@ -20,3 +23,6 @@ export * from "./NotificationMedium.js";
|
|
|
20
23
|
export * from "./OfferAttributionAttributes.js";
|
|
21
24
|
export * from "./OfferAttributionRequest.js";
|
|
22
25
|
export * from "./OfferMedium.js";
|
|
26
|
+
export * from "./PlacementSlotAttributionAttributes.js";
|
|
27
|
+
export * from "./PlacementSlotAttributionRequest.js";
|
|
28
|
+
export * from "./PlacementSlotMedium.js";
|
|
@@ -19,6 +19,9 @@ __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("./ActivatePlacementSlotResponse.js"), exports);
|
|
23
|
+
__exportStar(require("./ActivatePlacementSlotResponseAttributes.js"), exports);
|
|
24
|
+
__exportStar(require("./ActivatePlacementSlotResponseData.js"), exports);
|
|
22
25
|
__exportStar(require("./AttributionFilter.js"), exports);
|
|
23
26
|
__exportStar(require("./AttributionState.js"), exports);
|
|
24
27
|
__exportStar(require("./BoostOfferIncluded.js"), exports);
|
|
@@ -36,3 +39,6 @@ __exportStar(require("./NotificationMedium.js"), exports);
|
|
|
36
39
|
__exportStar(require("./OfferAttributionAttributes.js"), exports);
|
|
37
40
|
__exportStar(require("./OfferAttributionRequest.js"), exports);
|
|
38
41
|
__exportStar(require("./OfferMedium.js"), exports);
|
|
42
|
+
__exportStar(require("./PlacementSlotAttributionAttributes.js"), exports);
|
|
43
|
+
__exportStar(require("./PlacementSlotAttributionRequest.js"), exports);
|
|
44
|
+
__exportStar(require("./PlacementSlotMedium.js"), exports);
|
package/dist/cjs/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "22.
|
|
1
|
+
export declare const SDK_VERSION = "22.4.0";
|
package/dist/cjs/version.js
CHANGED
package/dist/esm/BaseClient.mjs
CHANGED
|
@@ -6,8 +6,8 @@ export function normalizeClientOptions(options) {
|
|
|
6
6
|
const headers = mergeHeaders({
|
|
7
7
|
"X-Fern-Language": "JavaScript",
|
|
8
8
|
"X-Fern-SDK-Name": "@kard-financial/sdk",
|
|
9
|
-
"X-Fern-SDK-Version": "22.
|
|
10
|
-
"User-Agent": "@kard-financial/sdk/22.
|
|
9
|
+
"X-Fern-SDK-Version": "22.4.0",
|
|
10
|
+
"User-Agent": "@kard-financial/sdk/22.4.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);
|
|
@@ -93,4 +93,29 @@ export declare class AttributionsClient {
|
|
|
93
93
|
*/
|
|
94
94
|
boost(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, offerId: string, request?: KardApi.users.BoostOfferRequest, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.BoostOfferResponse>;
|
|
95
95
|
private __boost;
|
|
96
|
+
/**
|
|
97
|
+
* Record when a user activates a batch-activation placement slot. Writes a slot-level
|
|
98
|
+
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
99
|
+
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
100
|
+
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
101
|
+
* partner can render the batch immediately without an extra `getBatchesByPlacement`
|
|
102
|
+
* round-trip.
|
|
103
|
+
*
|
|
104
|
+
* <b>Required scopes:</b> `attributions:write`
|
|
105
|
+
*
|
|
106
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
107
|
+
* @param {KardApi.UserId} userId
|
|
108
|
+
* @param {string} placementId - Unique identifier of the placement (UUID v7)
|
|
109
|
+
* @param {string} slotId - Stable identifier for the slot within the placement
|
|
110
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
111
|
+
*
|
|
112
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
113
|
+
* @throws {@link KardApi.InternalServerError}
|
|
114
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
115
|
+
*
|
|
116
|
+
* @example
|
|
117
|
+
* await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
|
|
118
|
+
*/
|
|
119
|
+
activatePlacementSlot(organizationId: KardApi.OrganizationId, userId: KardApi.UserId, placementId: string, slotId: string, requestOptions?: AttributionsClient.RequestOptions): core.HttpResponsePromise<KardApi.users.ActivatePlacementSlotResponse>;
|
|
120
|
+
private __activatePlacementSlot;
|
|
96
121
|
}
|
|
@@ -243,4 +243,71 @@ export class AttributionsClient {
|
|
|
243
243
|
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/offers/{offerId}/boost");
|
|
244
244
|
});
|
|
245
245
|
}
|
|
246
|
+
/**
|
|
247
|
+
* Record when a user activates a batch-activation placement slot. Writes a slot-level
|
|
248
|
+
* `placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
249
|
+
* `offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
250
|
+
* strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
251
|
+
* partner can render the batch immediately without an extra `getBatchesByPlacement`
|
|
252
|
+
* round-trip.
|
|
253
|
+
*
|
|
254
|
+
* <b>Required scopes:</b> `attributions:write`
|
|
255
|
+
*
|
|
256
|
+
* @param {KardApi.OrganizationId} organizationId
|
|
257
|
+
* @param {KardApi.UserId} userId
|
|
258
|
+
* @param {string} placementId - Unique identifier of the placement (UUID v7)
|
|
259
|
+
* @param {string} slotId - Stable identifier for the slot within the placement
|
|
260
|
+
* @param {AttributionsClient.RequestOptions} requestOptions - Request-specific configuration.
|
|
261
|
+
*
|
|
262
|
+
* @throws {@link KardApi.UnauthorizedError}
|
|
263
|
+
* @throws {@link KardApi.InternalServerError}
|
|
264
|
+
* @throws {@link KardApi.InvalidRequest}
|
|
265
|
+
*
|
|
266
|
+
* @example
|
|
267
|
+
* await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a")
|
|
268
|
+
*/
|
|
269
|
+
activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
|
|
270
|
+
return core.HttpResponsePromise.fromPromise(this.__activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions));
|
|
271
|
+
}
|
|
272
|
+
__activatePlacementSlot(organizationId, userId, placementId, slotId, requestOptions) {
|
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
275
|
+
const _authRequest = yield this._options.authProvider.getAuthRequest();
|
|
276
|
+
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);
|
|
277
|
+
const _response = yield core.fetcher({
|
|
278
|
+
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)}/slot/${core.url.encodePathParam(slotId)}/activate`),
|
|
279
|
+
method: "POST",
|
|
280
|
+
headers: _headers,
|
|
281
|
+
queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
|
|
282
|
+
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,
|
|
283
|
+
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,
|
|
284
|
+
abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
|
|
285
|
+
fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
|
|
286
|
+
logging: this._options.logging,
|
|
287
|
+
});
|
|
288
|
+
if (_response.ok) {
|
|
289
|
+
return {
|
|
290
|
+
data: _response.body,
|
|
291
|
+
rawResponse: _response.rawResponse,
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
if (_response.error.reason === "status-code") {
|
|
295
|
+
switch (_response.error.statusCode) {
|
|
296
|
+
case 401:
|
|
297
|
+
throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
|
|
298
|
+
case 500:
|
|
299
|
+
throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
|
|
300
|
+
case 400:
|
|
301
|
+
throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
|
|
302
|
+
default:
|
|
303
|
+
throw new errors.KardApiError({
|
|
304
|
+
statusCode: _response.error.statusCode,
|
|
305
|
+
body: _response.error.body,
|
|
306
|
+
rawResponse: _response.rawResponse,
|
|
307
|
+
});
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/users/{userId}/placements/{placementId}/slot/{slotId}/activate");
|
|
311
|
+
});
|
|
312
|
+
}
|
|
246
313
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Ack payload for a slot activation request.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* {
|
|
7
|
+
* data: {
|
|
8
|
+
* type: "placementSlotAttribution",
|
|
9
|
+
* id: "c94a93a7-beb9-4e58-960c-2c812f849398",
|
|
10
|
+
* attributes: {
|
|
11
|
+
* placementId: "018f8d6b-1abc-7def-9012-345678901234",
|
|
12
|
+
* slotId: "slot-a",
|
|
13
|
+
* eventCode: "ACTIVATE",
|
|
14
|
+
* medium: "CTA",
|
|
15
|
+
* eventDate: "2025-01-01T00:00:00Z",
|
|
16
|
+
* offerIds: ["offer-1", "offer-2", "offer-3"]
|
|
17
|
+
* }
|
|
18
|
+
* }
|
|
19
|
+
* }
|
|
20
|
+
*/
|
|
21
|
+
export interface ActivatePlacementSlotResponse {
|
|
22
|
+
data: KardApi.users.ActivatePlacementSlotResponseData;
|
|
23
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface ActivatePlacementSlotResponseAttributes {
|
|
2
|
+
/** Unique identifier of the placement */
|
|
3
|
+
placementId: string;
|
|
4
|
+
/** Stable identifier for the slot within the placement */
|
|
5
|
+
slotId: string;
|
|
6
|
+
eventCode: string;
|
|
7
|
+
medium: string;
|
|
8
|
+
eventDate: string;
|
|
9
|
+
/**
|
|
10
|
+
* All offer IDs that resolved under the slot's content strategy and had
|
|
11
|
+
* per-offer `offerAttribution` ACTIVATE events written. The partner can use
|
|
12
|
+
* this to render the batch immediately without an extra round-trip.
|
|
13
|
+
*/
|
|
14
|
+
offerIds: string[];
|
|
15
|
+
}
|
|
@@ -4,4 +4,8 @@ export interface AttributionState {
|
|
|
4
4
|
rank?: number | undefined;
|
|
5
5
|
/** The active filters when the user saw the offer */
|
|
6
6
|
filters?: KardApi.users.AttributionFilter[] | undefined;
|
|
7
|
+
/** Unique identifier of the placement the attribution event originated from */
|
|
8
|
+
placementId?: string | undefined;
|
|
9
|
+
/** Stable identifier for the slot within the placement */
|
|
10
|
+
slotId?: string | undefined;
|
|
7
11
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
-
export type CreateAttributionRequestUnion = KardApi.users.CreateAttributionRequestUnion.OfferAttribution | KardApi.users.CreateAttributionRequestUnion.NotificationAttribution;
|
|
2
|
+
export type CreateAttributionRequestUnion = KardApi.users.CreateAttributionRequestUnion.OfferAttribution | KardApi.users.CreateAttributionRequestUnion.NotificationAttribution | KardApi.users.CreateAttributionRequestUnion.PlacementSlotAttribution;
|
|
3
3
|
export declare namespace CreateAttributionRequestUnion {
|
|
4
4
|
interface OfferAttribution extends KardApi.users.OfferAttributionRequest {
|
|
5
5
|
type: "offerAttribution";
|
|
@@ -7,4 +7,7 @@ export declare namespace CreateAttributionRequestUnion {
|
|
|
7
7
|
interface NotificationAttribution extends KardApi.users.NotificationAttributionRequest {
|
|
8
8
|
type: "notificationAttribution";
|
|
9
9
|
}
|
|
10
|
+
interface PlacementSlotAttribution extends KardApi.users.PlacementSlotAttributionRequest {
|
|
11
|
+
type: "placementSlotAttribution";
|
|
12
|
+
}
|
|
10
13
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type * as KardApi from "../../../../../index.mjs";
|
|
2
|
+
/**
|
|
3
|
+
* Attributes for a slot-level activation event on a batch-activation placement.
|
|
4
|
+
* A slot activation also writes per-offer `offerAttribution` ACTIVATE events for
|
|
5
|
+
* every offer resolved by the slot's content strategy (see `ActivatePlacementSlot`).
|
|
6
|
+
*/
|
|
7
|
+
export interface PlacementSlotAttributionAttributes {
|
|
8
|
+
/** The slot ID (matches `state.slotId`) */
|
|
9
|
+
entityId: string;
|
|
10
|
+
eventCode: KardApi.users.EventCode;
|
|
11
|
+
medium: KardApi.users.PlacementSlotMedium;
|
|
12
|
+
/**
|
|
13
|
+
* The timestamp of the attribution event.
|
|
14
|
+
* Must be in ISO 8601 format (e.g., "2025-01-01T00:00:00Z").
|
|
15
|
+
*/
|
|
16
|
+
eventDate: string;
|
|
17
|
+
/** Placement context for the attribution event */
|
|
18
|
+
state?: KardApi.users.AttributionState | undefined;
|
|
19
|
+
}
|
|
@@ -3,6 +3,9 @@ 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 "./ActivatePlacementSlotResponse.mjs";
|
|
7
|
+
export * from "./ActivatePlacementSlotResponseAttributes.mjs";
|
|
8
|
+
export * from "./ActivatePlacementSlotResponseData.mjs";
|
|
6
9
|
export * from "./AttributionFilter.mjs";
|
|
7
10
|
export * from "./AttributionState.mjs";
|
|
8
11
|
export * from "./BoostOfferIncluded.mjs";
|
|
@@ -20,3 +23,6 @@ export * from "./NotificationMedium.mjs";
|
|
|
20
23
|
export * from "./OfferAttributionAttributes.mjs";
|
|
21
24
|
export * from "./OfferAttributionRequest.mjs";
|
|
22
25
|
export * from "./OfferMedium.mjs";
|
|
26
|
+
export * from "./PlacementSlotAttributionAttributes.mjs";
|
|
27
|
+
export * from "./PlacementSlotAttributionRequest.mjs";
|
|
28
|
+
export * from "./PlacementSlotMedium.mjs";
|
|
@@ -3,6 +3,9 @@ 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 "./ActivatePlacementSlotResponse.mjs";
|
|
7
|
+
export * from "./ActivatePlacementSlotResponseAttributes.mjs";
|
|
8
|
+
export * from "./ActivatePlacementSlotResponseData.mjs";
|
|
6
9
|
export * from "./AttributionFilter.mjs";
|
|
7
10
|
export * from "./AttributionState.mjs";
|
|
8
11
|
export * from "./BoostOfferIncluded.mjs";
|
|
@@ -20,3 +23,6 @@ export * from "./NotificationMedium.mjs";
|
|
|
20
23
|
export * from "./OfferAttributionAttributes.mjs";
|
|
21
24
|
export * from "./OfferAttributionRequest.mjs";
|
|
22
25
|
export * from "./OfferMedium.mjs";
|
|
26
|
+
export * from "./PlacementSlotAttributionAttributes.mjs";
|
|
27
|
+
export * from "./PlacementSlotAttributionRequest.mjs";
|
|
28
|
+
export * from "./PlacementSlotMedium.mjs";
|
package/dist/esm/version.d.mts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const SDK_VERSION = "22.
|
|
1
|
+
export declare const SDK_VERSION = "22.4.0";
|
package/dist/esm/version.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const SDK_VERSION = "22.
|
|
1
|
+
export const SDK_VERSION = "22.4.0";
|
package/package.json
CHANGED
package/reference.md
CHANGED
|
@@ -2717,6 +2717,100 @@ await client.users.attributions.boost("organization-123", "user-123", "offer-456
|
|
|
2717
2717
|
</dl>
|
|
2718
2718
|
|
|
2719
2719
|
|
|
2720
|
+
</dd>
|
|
2721
|
+
</dl>
|
|
2722
|
+
</details>
|
|
2723
|
+
|
|
2724
|
+
<details><summary><code>client.users.attributions.<a href="/src/api/resources/users/resources/attributions/client/Client.ts">activatePlacementSlot</a>(organizationId, userId, placementId, slotId) -> KardApi.ActivatePlacementSlotResponse</code></summary>
|
|
2725
|
+
<dl>
|
|
2726
|
+
<dd>
|
|
2727
|
+
|
|
2728
|
+
#### 📝 Description
|
|
2729
|
+
|
|
2730
|
+
<dl>
|
|
2731
|
+
<dd>
|
|
2732
|
+
|
|
2733
|
+
<dl>
|
|
2734
|
+
<dd>
|
|
2735
|
+
|
|
2736
|
+
Record when a user activates a batch-activation placement slot. Writes a slot-level
|
|
2737
|
+
`placementSlotAttribution` ACTIVATE event and fans out a per-offer
|
|
2738
|
+
`offerAttribution` ACTIVATE event for every offer resolved by the slot's content
|
|
2739
|
+
strategy. The slot-level event id and the resolved `offerIds` are returned so the
|
|
2740
|
+
partner can render the batch immediately without an extra `getBatchesByPlacement`
|
|
2741
|
+
round-trip.
|
|
2742
|
+
|
|
2743
|
+
<b>Required scopes:</b> `attributions:write`
|
|
2744
|
+
</dd>
|
|
2745
|
+
</dl>
|
|
2746
|
+
</dd>
|
|
2747
|
+
</dl>
|
|
2748
|
+
|
|
2749
|
+
#### 🔌 Usage
|
|
2750
|
+
|
|
2751
|
+
<dl>
|
|
2752
|
+
<dd>
|
|
2753
|
+
|
|
2754
|
+
<dl>
|
|
2755
|
+
<dd>
|
|
2756
|
+
|
|
2757
|
+
```typescript
|
|
2758
|
+
await client.users.attributions.activatePlacementSlot("organization-123", "user-123", "018f8d6b-1abc-7def-9012-345678901234", "slot-a");
|
|
2759
|
+
|
|
2760
|
+
```
|
|
2761
|
+
</dd>
|
|
2762
|
+
</dl>
|
|
2763
|
+
</dd>
|
|
2764
|
+
</dl>
|
|
2765
|
+
|
|
2766
|
+
#### ⚙️ Parameters
|
|
2767
|
+
|
|
2768
|
+
<dl>
|
|
2769
|
+
<dd>
|
|
2770
|
+
|
|
2771
|
+
<dl>
|
|
2772
|
+
<dd>
|
|
2773
|
+
|
|
2774
|
+
**organizationId:** `KardApi.OrganizationId`
|
|
2775
|
+
|
|
2776
|
+
</dd>
|
|
2777
|
+
</dl>
|
|
2778
|
+
|
|
2779
|
+
<dl>
|
|
2780
|
+
<dd>
|
|
2781
|
+
|
|
2782
|
+
**userId:** `KardApi.UserId`
|
|
2783
|
+
|
|
2784
|
+
</dd>
|
|
2785
|
+
</dl>
|
|
2786
|
+
|
|
2787
|
+
<dl>
|
|
2788
|
+
<dd>
|
|
2789
|
+
|
|
2790
|
+
**placementId:** `string` — Unique identifier of the placement (UUID v7)
|
|
2791
|
+
|
|
2792
|
+
</dd>
|
|
2793
|
+
</dl>
|
|
2794
|
+
|
|
2795
|
+
<dl>
|
|
2796
|
+
<dd>
|
|
2797
|
+
|
|
2798
|
+
**slotId:** `string` — Stable identifier for the slot within the placement
|
|
2799
|
+
|
|
2800
|
+
</dd>
|
|
2801
|
+
</dl>
|
|
2802
|
+
|
|
2803
|
+
<dl>
|
|
2804
|
+
<dd>
|
|
2805
|
+
|
|
2806
|
+
**requestOptions:** `AttributionsClient.RequestOptions`
|
|
2807
|
+
|
|
2808
|
+
</dd>
|
|
2809
|
+
</dl>
|
|
2810
|
+
</dd>
|
|
2811
|
+
</dl>
|
|
2812
|
+
|
|
2813
|
+
|
|
2720
2814
|
</dd>
|
|
2721
2815
|
</dl>
|
|
2722
2816
|
</details>
|