@kard-financial/sdk 17.0.0 → 18.1.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.
Files changed (86) hide show
  1. package/dist/cjs/BaseClient.js +2 -2
  2. package/dist/cjs/api/resources/organizations/client/Client.d.ts +3 -0
  3. package/dist/cjs/api/resources/organizations/client/Client.js +7 -2
  4. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/Client.d.ts +127 -0
  5. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/Client.js +414 -0
  6. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/index.js +17 -0
  8. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/requests/ListContentStrategiesRequest.d.ts +12 -0
  9. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/requests/ListContentStrategiesRequest.js +3 -0
  10. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/requests/index.d.ts +1 -0
  11. package/dist/cjs/api/resources/organizations/resources/contentStrategies/client/requests/index.js +2 -0
  12. package/dist/cjs/api/resources/organizations/resources/contentStrategies/exports.d.ts +2 -0
  13. package/dist/cjs/api/resources/organizations/resources/contentStrategies/exports.js +21 -0
  14. package/dist/cjs/api/resources/organizations/resources/contentStrategies/index.d.ts +2 -0
  15. package/dist/cjs/api/resources/organizations/resources/contentStrategies/index.js +18 -0
  16. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyAttributes.d.ts +22 -0
  17. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyAttributes.js +3 -0
  18. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyFilter.d.ts +8 -0
  19. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyFilter.js +11 -0
  20. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyListResponse.d.ts +11 -0
  21. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyListResponse.js +3 -0
  22. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyResponse.d.ts +26 -0
  23. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/ContentStrategyResponse.js +3 -0
  24. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyAttributes.d.ts +25 -0
  25. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyAttributes.js +3 -0
  26. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestBody.d.ts +22 -0
  27. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestBody.js +3 -0
  28. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestData.d.ts +10 -0
  29. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestData.js +3 -0
  30. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyAttributes.d.ts +25 -0
  31. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyAttributes.js +3 -0
  32. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestBody.d.ts +8 -0
  33. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestBody.js +3 -0
  34. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestData.d.ts +10 -0
  35. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestData.js +3 -0
  36. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/index.d.ts +10 -0
  37. package/dist/cjs/api/resources/organizations/resources/contentStrategies/types/index.js +26 -0
  38. package/dist/cjs/api/resources/organizations/resources/index.d.ts +3 -0
  39. package/dist/cjs/api/resources/organizations/resources/index.js +4 -1
  40. package/dist/cjs/api/resources/users/resources/rewards/types/LocationAttributes.d.ts +2 -2
  41. package/dist/cjs/version.d.ts +1 -1
  42. package/dist/cjs/version.js +1 -1
  43. package/dist/esm/BaseClient.mjs +2 -2
  44. package/dist/esm/api/resources/organizations/client/Client.d.mts +3 -0
  45. package/dist/esm/api/resources/organizations/client/Client.mjs +5 -0
  46. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/Client.d.mts +127 -0
  47. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/Client.mjs +377 -0
  48. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/index.d.mts +1 -0
  49. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/index.mjs +1 -0
  50. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/requests/ListContentStrategiesRequest.d.mts +12 -0
  51. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/requests/ListContentStrategiesRequest.mjs +2 -0
  52. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/requests/index.d.mts +1 -0
  53. package/dist/esm/api/resources/organizations/resources/contentStrategies/client/requests/index.mjs +1 -0
  54. package/dist/esm/api/resources/organizations/resources/contentStrategies/exports.d.mts +2 -0
  55. package/dist/esm/api/resources/organizations/resources/contentStrategies/exports.mjs +3 -0
  56. package/dist/esm/api/resources/organizations/resources/contentStrategies/index.d.mts +2 -0
  57. package/dist/esm/api/resources/organizations/resources/contentStrategies/index.mjs +2 -0
  58. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyAttributes.d.mts +22 -0
  59. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyAttributes.mjs +2 -0
  60. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyFilter.d.mts +8 -0
  61. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyFilter.mjs +8 -0
  62. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyListResponse.d.mts +11 -0
  63. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyListResponse.mjs +2 -0
  64. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyResponse.d.mts +26 -0
  65. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/ContentStrategyResponse.mjs +2 -0
  66. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyAttributes.d.mts +25 -0
  67. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyAttributes.mjs +2 -0
  68. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestBody.d.mts +22 -0
  69. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestBody.mjs +2 -0
  70. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestData.d.mts +10 -0
  71. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/CreateContentStrategyRequestData.mjs +2 -0
  72. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyAttributes.d.mts +25 -0
  73. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyAttributes.mjs +2 -0
  74. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestBody.d.mts +8 -0
  75. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestBody.mjs +2 -0
  76. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestData.d.mts +10 -0
  77. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/UpdateContentStrategyRequestData.mjs +2 -0
  78. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/index.d.mts +10 -0
  79. package/dist/esm/api/resources/organizations/resources/contentStrategies/types/index.mjs +10 -0
  80. package/dist/esm/api/resources/organizations/resources/index.d.mts +3 -0
  81. package/dist/esm/api/resources/organizations/resources/index.mjs +3 -0
  82. package/dist/esm/api/resources/users/resources/rewards/types/LocationAttributes.d.mts +2 -2
  83. package/dist/esm/version.d.mts +1 -1
  84. package/dist/esm/version.mjs +1 -1
  85. package/package.json +12 -1
  86. package/reference.md +386 -0
@@ -0,0 +1,377 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ import { normalizeClientOptionsWithAuth } from "../../../../../../BaseClient.mjs";
12
+ import { mergeHeaders } from "../../../../../../core/headers.mjs";
13
+ import * as core from "../../../../../../core/index.mjs";
14
+ import * as environments from "../../../../../../environments.mjs";
15
+ import { handleNonStatusCodeError } from "../../../../../../errors/handleNonStatusCodeError.mjs";
16
+ import * as errors from "../../../../../../errors/index.mjs";
17
+ import * as KardApi from "../../../../../index.mjs";
18
+ export class ContentStrategiesClient {
19
+ constructor(options = {}) {
20
+ this._options = normalizeClientOptionsWithAuth(options);
21
+ }
22
+ /**
23
+ * Create a content strategy for the organization. The strategy name must be unique within the organization.
24
+ *
25
+ * @param {string} organizationId - Unique identifier of the organization
26
+ * @param {KardApi.organizations.CreateContentStrategyRequestBody} request
27
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
28
+ *
29
+ * @throws {@link KardApi.UnauthorizedError}
30
+ * @throws {@link KardApi.ForbiddenError}
31
+ * @throws {@link KardApi.InvalidRequest}
32
+ * @throws {@link KardApi.ConflictError}
33
+ * @throws {@link KardApi.DoesNotExistError}
34
+ * @throws {@link KardApi.InternalServerError}
35
+ *
36
+ * @example
37
+ * await client.organizations.contentStrategies.create("org-123", {
38
+ * data: {
39
+ * type: "contentStrategy",
40
+ * attributes: {
41
+ * name: "Featured Travel",
42
+ * filters: ["HIGHEST_CASHBACK", "NEWLY_LIVE"],
43
+ * categories: ["Travel"],
44
+ * categoryExclusions: ["Gas"],
45
+ * merchantExclusions: ["merchant-abc"]
46
+ * }
47
+ * }
48
+ * })
49
+ */
50
+ create(organizationId, request, requestOptions) {
51
+ return core.HttpResponsePromise.fromPromise(this.__create(organizationId, request, requestOptions));
52
+ }
53
+ __create(organizationId, request, requestOptions) {
54
+ return __awaiter(this, void 0, void 0, function* () {
55
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
56
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
57
+ 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);
58
+ const _response = yield core.fetcher({
59
+ 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)}/contentStrategies`),
60
+ method: "POST",
61
+ headers: _headers,
62
+ contentType: "application/json",
63
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
64
+ requestType: "json",
65
+ body: request,
66
+ 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,
67
+ 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,
68
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
69
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
70
+ logging: this._options.logging,
71
+ });
72
+ if (_response.ok) {
73
+ return {
74
+ data: _response.body,
75
+ rawResponse: _response.rawResponse,
76
+ };
77
+ }
78
+ if (_response.error.reason === "status-code") {
79
+ switch (_response.error.statusCode) {
80
+ case 401:
81
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
82
+ case 403:
83
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
84
+ case 400:
85
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
86
+ case 409:
87
+ throw new KardApi.ConflictError(_response.error.body, _response.rawResponse);
88
+ case 404:
89
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
90
+ case 500:
91
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
92
+ default:
93
+ throw new errors.KardApiError({
94
+ statusCode: _response.error.statusCode,
95
+ body: _response.error.body,
96
+ rawResponse: _response.rawResponse,
97
+ });
98
+ }
99
+ }
100
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/contentStrategies");
101
+ });
102
+ }
103
+ /**
104
+ * List content strategies belonging to the authenticated organization
105
+ *
106
+ * @param {string} organizationId - Unique identifier of the organization
107
+ * @param {KardApi.organizations.ListContentStrategiesRequest} request
108
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
109
+ *
110
+ * @throws {@link KardApi.UnauthorizedError}
111
+ * @throws {@link KardApi.ForbiddenError}
112
+ * @throws {@link KardApi.InvalidRequest}
113
+ * @throws {@link KardApi.DoesNotExistError}
114
+ * @throws {@link KardApi.InternalServerError}
115
+ *
116
+ * @example
117
+ * await client.organizations.contentStrategies.list("organizationId")
118
+ */
119
+ list(organizationId, request = {}, requestOptions) {
120
+ return core.HttpResponsePromise.fromPromise(this.__list(organizationId, request, requestOptions));
121
+ }
122
+ __list(organizationId_1) {
123
+ return __awaiter(this, arguments, void 0, function* (organizationId, request = {}, requestOptions) {
124
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
125
+ const { "filter[name]": filterName, "page[after]": pageAfter, "page[size]": pageSize } = request;
126
+ const _queryParams = {
127
+ "filter[name]": filterName,
128
+ "page[after]": pageAfter,
129
+ "page[size]": pageSize,
130
+ };
131
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
132
+ 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);
133
+ const _response = yield core.fetcher({
134
+ 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)}/contentStrategies`),
135
+ method: "GET",
136
+ headers: _headers,
137
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
138
+ 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,
139
+ 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,
140
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
141
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
142
+ logging: this._options.logging,
143
+ });
144
+ if (_response.ok) {
145
+ return {
146
+ data: _response.body,
147
+ rawResponse: _response.rawResponse,
148
+ };
149
+ }
150
+ if (_response.error.reason === "status-code") {
151
+ switch (_response.error.statusCode) {
152
+ case 401:
153
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
154
+ case 403:
155
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
156
+ case 400:
157
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
158
+ case 404:
159
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
160
+ case 500:
161
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
162
+ default:
163
+ throw new errors.KardApiError({
164
+ statusCode: _response.error.statusCode,
165
+ body: _response.error.body,
166
+ rawResponse: _response.rawResponse,
167
+ });
168
+ }
169
+ }
170
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/contentStrategies");
171
+ });
172
+ }
173
+ /**
174
+ * Retrieve a specific content strategy
175
+ *
176
+ * @param {string} organizationId - Unique identifier of the organization
177
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
178
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
179
+ *
180
+ * @throws {@link KardApi.UnauthorizedError}
181
+ * @throws {@link KardApi.ForbiddenError}
182
+ * @throws {@link KardApi.DoesNotExistError}
183
+ * @throws {@link KardApi.InternalServerError}
184
+ *
185
+ * @example
186
+ * await client.organizations.contentStrategies.get("organizationId", "contentStrategyId")
187
+ */
188
+ get(organizationId, contentStrategyId, requestOptions) {
189
+ return core.HttpResponsePromise.fromPromise(this.__get(organizationId, contentStrategyId, requestOptions));
190
+ }
191
+ __get(organizationId, contentStrategyId, requestOptions) {
192
+ return __awaiter(this, void 0, void 0, function* () {
193
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
194
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
195
+ 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);
196
+ const _response = yield core.fetcher({
197
+ 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)}/contentStrategies/${core.url.encodePathParam(contentStrategyId)}`),
198
+ method: "GET",
199
+ headers: _headers,
200
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
201
+ 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,
202
+ 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,
203
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
204
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
205
+ logging: this._options.logging,
206
+ });
207
+ if (_response.ok) {
208
+ return {
209
+ data: _response.body,
210
+ rawResponse: _response.rawResponse,
211
+ };
212
+ }
213
+ if (_response.error.reason === "status-code") {
214
+ switch (_response.error.statusCode) {
215
+ case 401:
216
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
217
+ case 403:
218
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
219
+ case 404:
220
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
221
+ case 500:
222
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
223
+ default:
224
+ throw new errors.KardApiError({
225
+ statusCode: _response.error.statusCode,
226
+ body: _response.error.body,
227
+ rawResponse: _response.rawResponse,
228
+ });
229
+ }
230
+ }
231
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/contentStrategies/{contentStrategyId}");
232
+ });
233
+ }
234
+ /**
235
+ * Replace a content strategy. All fields must be provided; any omitted attribute is treated as cleared.
236
+ *
237
+ * @param {string} organizationId - Unique identifier of the organization
238
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
239
+ * @param {KardApi.organizations.UpdateContentStrategyRequestBody} request
240
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
241
+ *
242
+ * @throws {@link KardApi.UnauthorizedError}
243
+ * @throws {@link KardApi.ForbiddenError}
244
+ * @throws {@link KardApi.InvalidRequest}
245
+ * @throws {@link KardApi.ConflictError}
246
+ * @throws {@link KardApi.DoesNotExistError}
247
+ * @throws {@link KardApi.InternalServerError}
248
+ *
249
+ * @example
250
+ * await client.organizations.contentStrategies.update("organizationId", "contentStrategyId", {
251
+ * data: {
252
+ * type: "contentStrategy",
253
+ * attributes: {
254
+ * name: "name",
255
+ * filters: ["NEWLY_LIVE", "NEWLY_LIVE"],
256
+ * categories: ["Arts & Entertainment", "Arts & Entertainment"],
257
+ * categoryExclusions: ["Arts & Entertainment", "Arts & Entertainment"],
258
+ * merchantExclusions: ["merchantExclusions", "merchantExclusions"]
259
+ * }
260
+ * }
261
+ * })
262
+ */
263
+ update(organizationId, contentStrategyId, request, requestOptions) {
264
+ return core.HttpResponsePromise.fromPromise(this.__update(organizationId, contentStrategyId, request, requestOptions));
265
+ }
266
+ __update(organizationId, contentStrategyId, request, requestOptions) {
267
+ return __awaiter(this, void 0, void 0, function* () {
268
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
269
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
270
+ 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);
271
+ const _response = yield core.fetcher({
272
+ 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)}/contentStrategies/${core.url.encodePathParam(contentStrategyId)}`),
273
+ method: "PUT",
274
+ headers: _headers,
275
+ contentType: "application/json",
276
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
277
+ requestType: "json",
278
+ body: request,
279
+ 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,
280
+ 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,
281
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
282
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
283
+ logging: this._options.logging,
284
+ });
285
+ if (_response.ok) {
286
+ return {
287
+ data: _response.body,
288
+ rawResponse: _response.rawResponse,
289
+ };
290
+ }
291
+ if (_response.error.reason === "status-code") {
292
+ switch (_response.error.statusCode) {
293
+ case 401:
294
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
295
+ case 403:
296
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
297
+ case 400:
298
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
299
+ case 409:
300
+ throw new KardApi.ConflictError(_response.error.body, _response.rawResponse);
301
+ case 404:
302
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
303
+ case 500:
304
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
305
+ default:
306
+ throw new errors.KardApiError({
307
+ statusCode: _response.error.statusCode,
308
+ body: _response.error.body,
309
+ rawResponse: _response.rawResponse,
310
+ });
311
+ }
312
+ }
313
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "PUT", "/v2/issuers/{organizationId}/contentStrategies/{contentStrategyId}");
314
+ });
315
+ }
316
+ /**
317
+ * Delete a content strategy. Returns 409 if the strategy is still referenced by another resource.
318
+ *
319
+ * @param {string} organizationId - Unique identifier of the organization
320
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
321
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
322
+ *
323
+ * @throws {@link KardApi.UnauthorizedError}
324
+ * @throws {@link KardApi.ForbiddenError}
325
+ * @throws {@link KardApi.ConflictError}
326
+ * @throws {@link KardApi.DoesNotExistError}
327
+ * @throws {@link KardApi.InternalServerError}
328
+ *
329
+ * @example
330
+ * await client.organizations.contentStrategies.delete("organizationId", "contentStrategyId")
331
+ */
332
+ delete(organizationId, contentStrategyId, requestOptions) {
333
+ return core.HttpResponsePromise.fromPromise(this.__delete(organizationId, contentStrategyId, requestOptions));
334
+ }
335
+ __delete(organizationId, contentStrategyId, requestOptions) {
336
+ return __awaiter(this, void 0, void 0, function* () {
337
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
338
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
339
+ 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);
340
+ const _response = yield core.fetcher({
341
+ 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)}/contentStrategies/${core.url.encodePathParam(contentStrategyId)}`),
342
+ method: "DELETE",
343
+ headers: _headers,
344
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
345
+ 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,
346
+ 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,
347
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
348
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
349
+ logging: this._options.logging,
350
+ });
351
+ if (_response.ok) {
352
+ return { data: _response.body, rawResponse: _response.rawResponse };
353
+ }
354
+ if (_response.error.reason === "status-code") {
355
+ switch (_response.error.statusCode) {
356
+ case 401:
357
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
358
+ case 403:
359
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
360
+ case 409:
361
+ throw new KardApi.ConflictError(_response.error.body, _response.rawResponse);
362
+ case 404:
363
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
364
+ case 500:
365
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
366
+ default:
367
+ throw new errors.KardApiError({
368
+ statusCode: _response.error.statusCode,
369
+ body: _response.error.body,
370
+ rawResponse: _response.rawResponse,
371
+ });
372
+ }
373
+ }
374
+ return handleNonStatusCodeError(_response.error, _response.rawResponse, "DELETE", "/v2/issuers/{organizationId}/contentStrategies/{contentStrategyId}");
375
+ });
376
+ }
377
+ }
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1 @@
1
+ export * from "./requests/index.mjs";
@@ -0,0 +1,12 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListContentStrategiesRequest {
6
+ /** Filter by exact content strategy name (unique within an organization) */
7
+ "filter[name]"?: string;
8
+ /** Cursor value for the next page of results */
9
+ "page[after]"?: string;
10
+ /** Maximum number of records to return [1 - 200] (default = 200) */
11
+ "page[size]"?: number;
12
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1 @@
1
+ export type { ListContentStrategiesRequest } from "./ListContentStrategiesRequest.mjs";
@@ -0,0 +1,2 @@
1
+ export { ContentStrategiesClient } from "./client/Client.mjs";
2
+ export * from "./client/index.mjs";
@@ -0,0 +1,3 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export { ContentStrategiesClient } from "./client/Client.mjs";
3
+ export * from "./client/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,2 @@
1
+ export * from "./client/index.mjs";
2
+ export * from "./types/index.mjs";
@@ -0,0 +1,22 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Attributes for a content strategy
4
+ */
5
+ export interface ContentStrategyAttributes {
6
+ /** Name of the content strategy (unique within an organization) */
7
+ name: string;
8
+ /** ID of the organization this content strategy belongs to */
9
+ organizationId: string;
10
+ /** Filters applied when selecting offers for the strategy */
11
+ filters: KardApi.organizations.ContentStrategyFilter[];
12
+ /** Merchant categories to include */
13
+ categories: KardApi.CategoryOption[];
14
+ /** Merchant categories to exclude */
15
+ categoryExclusions: KardApi.CategoryOption[];
16
+ /** Merchant IDs to exclude */
17
+ merchantExclusions: string[];
18
+ /** When the content strategy was created (ISO 8601 UTC) */
19
+ createdAt: string;
20
+ /** When the content strategy was last modified (ISO 8601 UTC) */
21
+ lastModified: string;
22
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ /** Filter applied to the offers selected by a content strategy. The v1 starter set covers newly-live, expiring-soon, highest-cashback, and personalized selections. */
2
+ export declare const ContentStrategyFilter: {
3
+ readonly NewlyLive: "NEWLY_LIVE";
4
+ readonly ExpiringSoon: "EXPIRING_SOON";
5
+ readonly HighestCashback: "HIGHEST_CASHBACK";
6
+ readonly Personalized: "PERSONALIZED";
7
+ };
8
+ export type ContentStrategyFilter = (typeof ContentStrategyFilter)[keyof typeof ContentStrategyFilter];
@@ -0,0 +1,8 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ /** Filter applied to the offers selected by a content strategy. The v1 starter set covers newly-live, expiring-soon, highest-cashback, and personalized selections. */
3
+ export const ContentStrategyFilter = {
4
+ NewlyLive: "NEWLY_LIVE",
5
+ ExpiringSoon: "EXPIRING_SOON",
6
+ HighestCashback: "HIGHEST_CASHBACK",
7
+ Personalized: "PERSONALIZED",
8
+ };
@@ -0,0 +1,11 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Paginated list of content strategies
4
+ */
5
+ export interface ContentStrategyListResponse {
6
+ /** Array of content strategy resources */
7
+ data: KardApi.organizations.ContentStrategyResponse[];
8
+ links?: KardApi.Links | undefined;
9
+ /** Pagination metadata */
10
+ meta?: KardApi.OrganizationPaginationMetadata | undefined;
11
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,26 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Content strategy resource response
4
+ *
5
+ * @example
6
+ * {
7
+ * type: "contentStrategy",
8
+ * id: "01961e5a-b74c-7d42-8456-d3a1f2c90e71",
9
+ * attributes: {
10
+ * name: "Featured Travel",
11
+ * organizationId: "org-123",
12
+ * filters: [KardApi.organizations.ContentStrategyFilter.HighestCashback, KardApi.organizations.ContentStrategyFilter.NewlyLive],
13
+ * categories: [KardApi.CategoryOption.Travel],
14
+ * categoryExclusions: [KardApi.CategoryOption.Gas],
15
+ * merchantExclusions: ["merchant-abc"],
16
+ * createdAt: "2026-04-15T12:00:00Z",
17
+ * lastModified: "2026-04-15T12:00:00Z"
18
+ * }
19
+ * }
20
+ */
21
+ export interface ContentStrategyResponse {
22
+ type: "contentStrategy";
23
+ /** Unique identifier of the content strategy (UUID v7) */
24
+ id: string;
25
+ attributes: KardApi.organizations.ContentStrategyAttributes;
26
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,25 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Attributes for creating a content strategy
4
+ *
5
+ * @example
6
+ * {
7
+ * name: "Featured Travel",
8
+ * filters: [KardApi.organizations.ContentStrategyFilter.HighestCashback, KardApi.organizations.ContentStrategyFilter.NewlyLive],
9
+ * categories: [KardApi.CategoryOption.Travel],
10
+ * categoryExclusions: [KardApi.CategoryOption.Gas],
11
+ * merchantExclusions: ["merchant-abc"]
12
+ * }
13
+ */
14
+ export interface CreateContentStrategyAttributes {
15
+ /** Name of the content strategy (unique within an organization) */
16
+ name: string;
17
+ /** Filters applied when selecting offers for the strategy */
18
+ filters: KardApi.organizations.ContentStrategyFilter[];
19
+ /** Merchant categories to include */
20
+ categories: KardApi.CategoryOption[];
21
+ /** Merchant categories to exclude */
22
+ categoryExclusions: KardApi.CategoryOption[];
23
+ /** Merchant IDs to exclude */
24
+ merchantExclusions: string[];
25
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,22 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Request body for creating a content strategy
4
+ *
5
+ * @example
6
+ * {
7
+ * data: {
8
+ * type: "contentStrategy",
9
+ * attributes: {
10
+ * name: "Featured Travel",
11
+ * filters: [KardApi.organizations.ContentStrategyFilter.HighestCashback, KardApi.organizations.ContentStrategyFilter.NewlyLive],
12
+ * categories: [KardApi.CategoryOption.Travel],
13
+ * categoryExclusions: [KardApi.CategoryOption.Gas],
14
+ * merchantExclusions: ["merchant-abc"]
15
+ * }
16
+ * }
17
+ * }
18
+ */
19
+ export interface CreateContentStrategyRequestBody {
20
+ /** Content strategy data for creation */
21
+ data: KardApi.organizations.CreateContentStrategyRequestData;
22
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,10 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Content strategy data structure for creation
4
+ */
5
+ export interface CreateContentStrategyRequestData {
6
+ /** Resource type identifier */
7
+ type: "contentStrategy";
8
+ /** Content strategy attributes for creation */
9
+ attributes: KardApi.organizations.CreateContentStrategyAttributes;
10
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,25 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Attributes for updating a content strategy. All fields are required.
4
+ *
5
+ * @example
6
+ * {
7
+ * name: "Updated Travel Strategy",
8
+ * filters: [KardApi.organizations.ContentStrategyFilter.ExpiringSoon, KardApi.organizations.ContentStrategyFilter.Personalized],
9
+ * categories: [KardApi.CategoryOption.Travel, KardApi.CategoryOption.FoodBeverage],
10
+ * categoryExclusions: [],
11
+ * merchantExclusions: ["merchant-xyz"]
12
+ * }
13
+ */
14
+ export interface UpdateContentStrategyAttributes {
15
+ /** Name of the content strategy (unique within an organization) */
16
+ name: string;
17
+ /** Filters applied when selecting offers for the strategy */
18
+ filters: KardApi.organizations.ContentStrategyFilter[];
19
+ /** Merchant categories to include */
20
+ categories: KardApi.CategoryOption[];
21
+ /** Merchant categories to exclude */
22
+ categoryExclusions: KardApi.CategoryOption[];
23
+ /** Merchant IDs to exclude */
24
+ merchantExclusions: string[];
25
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};
@@ -0,0 +1,8 @@
1
+ import type * as KardApi from "../../../../../index.mjs";
2
+ /**
3
+ * Request body for updating a content strategy
4
+ */
5
+ export interface UpdateContentStrategyRequestBody {
6
+ /** Content strategy data for update */
7
+ data: KardApi.organizations.UpdateContentStrategyRequestData;
8
+ }
@@ -0,0 +1,2 @@
1
+ // This file was auto-generated by Fern from our API Definition.
2
+ export {};