@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
@@ -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": "17.0.0",
47
- "User-Agent": "@kard-financial/sdk/17.0.0",
46
+ "X-Fern-SDK-Version": "18.1.0",
47
+ "User-Agent": "@kard-financial/sdk/18.1.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);
@@ -3,6 +3,7 @@ import { type NormalizedClientOptionsWithAuth } from "../../../../BaseClient.js"
3
3
  import * as core from "../../../../core/index.js";
4
4
  import * as KardApi from "../../../index.js";
5
5
  import { ChildrenClient } from "../resources/children/client/Client.js";
6
+ import { ContentStrategiesClient } from "../resources/contentStrategies/client/Client.js";
6
7
  import { PlacementsClient } from "../resources/placements/client/Client.js";
7
8
  export declare namespace OrganizationsClient {
8
9
  type Options = BaseClientOptions;
@@ -12,9 +13,11 @@ export declare namespace OrganizationsClient {
12
13
  export declare class OrganizationsClient {
13
14
  protected readonly _options: NormalizedClientOptionsWithAuth<OrganizationsClient.Options>;
14
15
  protected _children: ChildrenClient | undefined;
16
+ protected _contentStrategies: ContentStrategiesClient | undefined;
15
17
  protected _placements: PlacementsClient | undefined;
16
18
  constructor(options?: OrganizationsClient.Options);
17
19
  get children(): ChildrenClient;
20
+ get contentStrategies(): ContentStrategiesClient;
18
21
  get placements(): PlacementsClient;
19
22
  /**
20
23
  * Retrieve organization details for the authenticated issuer
@@ -52,7 +52,8 @@ const handleNonStatusCodeError_js_1 = require("../../../../errors/handleNonStatu
52
52
  const errors = __importStar(require("../../../../errors/index.js"));
53
53
  const KardApi = __importStar(require("../../../index.js"));
54
54
  const Client_js_1 = require("../resources/children/client/Client.js");
55
- const Client_js_2 = require("../resources/placements/client/Client.js");
55
+ const Client_js_2 = require("../resources/contentStrategies/client/Client.js");
56
+ const Client_js_3 = require("../resources/placements/client/Client.js");
56
57
  class OrganizationsClient {
57
58
  constructor(options = {}) {
58
59
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
@@ -61,9 +62,13 @@ class OrganizationsClient {
61
62
  var _a;
62
63
  return ((_a = this._children) !== null && _a !== void 0 ? _a : (this._children = new Client_js_1.ChildrenClient(this._options)));
63
64
  }
65
+ get contentStrategies() {
66
+ var _a;
67
+ return ((_a = this._contentStrategies) !== null && _a !== void 0 ? _a : (this._contentStrategies = new Client_js_2.ContentStrategiesClient(this._options)));
68
+ }
64
69
  get placements() {
65
70
  var _a;
66
- return ((_a = this._placements) !== null && _a !== void 0 ? _a : (this._placements = new Client_js_2.PlacementsClient(this._options)));
71
+ return ((_a = this._placements) !== null && _a !== void 0 ? _a : (this._placements = new Client_js_3.PlacementsClient(this._options)));
67
72
  }
68
73
  /**
69
74
  * Retrieve organization details for the authenticated issuer
@@ -0,0 +1,127 @@
1
+ import type { BaseClientOptions, BaseRequestOptions } from "../../../../../../BaseClient.js";
2
+ import { type NormalizedClientOptionsWithAuth } from "../../../../../../BaseClient.js";
3
+ import * as core from "../../../../../../core/index.js";
4
+ import * as KardApi from "../../../../../index.js";
5
+ export declare namespace ContentStrategiesClient {
6
+ type Options = BaseClientOptions;
7
+ interface RequestOptions extends BaseRequestOptions {
8
+ }
9
+ }
10
+ export declare class ContentStrategiesClient {
11
+ protected readonly _options: NormalizedClientOptionsWithAuth<ContentStrategiesClient.Options>;
12
+ constructor(options?: ContentStrategiesClient.Options);
13
+ /**
14
+ * Create a content strategy for the organization. The strategy name must be unique within the organization.
15
+ *
16
+ * @param {string} organizationId - Unique identifier of the organization
17
+ * @param {KardApi.organizations.CreateContentStrategyRequestBody} request
18
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
19
+ *
20
+ * @throws {@link KardApi.UnauthorizedError}
21
+ * @throws {@link KardApi.ForbiddenError}
22
+ * @throws {@link KardApi.InvalidRequest}
23
+ * @throws {@link KardApi.ConflictError}
24
+ * @throws {@link KardApi.DoesNotExistError}
25
+ * @throws {@link KardApi.InternalServerError}
26
+ *
27
+ * @example
28
+ * await client.organizations.contentStrategies.create("org-123", {
29
+ * data: {
30
+ * type: "contentStrategy",
31
+ * attributes: {
32
+ * name: "Featured Travel",
33
+ * filters: ["HIGHEST_CASHBACK", "NEWLY_LIVE"],
34
+ * categories: ["Travel"],
35
+ * categoryExclusions: ["Gas"],
36
+ * merchantExclusions: ["merchant-abc"]
37
+ * }
38
+ * }
39
+ * })
40
+ */
41
+ create(organizationId: string, request: KardApi.organizations.CreateContentStrategyRequestBody, requestOptions?: ContentStrategiesClient.RequestOptions): core.HttpResponsePromise<KardApi.organizations.ContentStrategyResponse>;
42
+ private __create;
43
+ /**
44
+ * List content strategies belonging to the authenticated organization
45
+ *
46
+ * @param {string} organizationId - Unique identifier of the organization
47
+ * @param {KardApi.organizations.ListContentStrategiesRequest} request
48
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
49
+ *
50
+ * @throws {@link KardApi.UnauthorizedError}
51
+ * @throws {@link KardApi.ForbiddenError}
52
+ * @throws {@link KardApi.InvalidRequest}
53
+ * @throws {@link KardApi.DoesNotExistError}
54
+ * @throws {@link KardApi.InternalServerError}
55
+ *
56
+ * @example
57
+ * await client.organizations.contentStrategies.list("organizationId")
58
+ */
59
+ list(organizationId: string, request?: KardApi.organizations.ListContentStrategiesRequest, requestOptions?: ContentStrategiesClient.RequestOptions): core.HttpResponsePromise<KardApi.organizations.ContentStrategyListResponse>;
60
+ private __list;
61
+ /**
62
+ * Retrieve a specific content strategy
63
+ *
64
+ * @param {string} organizationId - Unique identifier of the organization
65
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
66
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
67
+ *
68
+ * @throws {@link KardApi.UnauthorizedError}
69
+ * @throws {@link KardApi.ForbiddenError}
70
+ * @throws {@link KardApi.DoesNotExistError}
71
+ * @throws {@link KardApi.InternalServerError}
72
+ *
73
+ * @example
74
+ * await client.organizations.contentStrategies.get("organizationId", "contentStrategyId")
75
+ */
76
+ get(organizationId: string, contentStrategyId: string, requestOptions?: ContentStrategiesClient.RequestOptions): core.HttpResponsePromise<KardApi.organizations.ContentStrategyResponse>;
77
+ private __get;
78
+ /**
79
+ * Replace a content strategy. All fields must be provided; any omitted attribute is treated as cleared.
80
+ *
81
+ * @param {string} organizationId - Unique identifier of the organization
82
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
83
+ * @param {KardApi.organizations.UpdateContentStrategyRequestBody} request
84
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
85
+ *
86
+ * @throws {@link KardApi.UnauthorizedError}
87
+ * @throws {@link KardApi.ForbiddenError}
88
+ * @throws {@link KardApi.InvalidRequest}
89
+ * @throws {@link KardApi.ConflictError}
90
+ * @throws {@link KardApi.DoesNotExistError}
91
+ * @throws {@link KardApi.InternalServerError}
92
+ *
93
+ * @example
94
+ * await client.organizations.contentStrategies.update("organizationId", "contentStrategyId", {
95
+ * data: {
96
+ * type: "contentStrategy",
97
+ * attributes: {
98
+ * name: "name",
99
+ * filters: ["NEWLY_LIVE", "NEWLY_LIVE"],
100
+ * categories: ["Arts & Entertainment", "Arts & Entertainment"],
101
+ * categoryExclusions: ["Arts & Entertainment", "Arts & Entertainment"],
102
+ * merchantExclusions: ["merchantExclusions", "merchantExclusions"]
103
+ * }
104
+ * }
105
+ * })
106
+ */
107
+ update(organizationId: string, contentStrategyId: string, request: KardApi.organizations.UpdateContentStrategyRequestBody, requestOptions?: ContentStrategiesClient.RequestOptions): core.HttpResponsePromise<KardApi.organizations.ContentStrategyResponse>;
108
+ private __update;
109
+ /**
110
+ * Delete a content strategy. Returns 409 if the strategy is still referenced by another resource.
111
+ *
112
+ * @param {string} organizationId - Unique identifier of the organization
113
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
114
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
115
+ *
116
+ * @throws {@link KardApi.UnauthorizedError}
117
+ * @throws {@link KardApi.ForbiddenError}
118
+ * @throws {@link KardApi.ConflictError}
119
+ * @throws {@link KardApi.DoesNotExistError}
120
+ * @throws {@link KardApi.InternalServerError}
121
+ *
122
+ * @example
123
+ * await client.organizations.contentStrategies.delete("organizationId", "contentStrategyId")
124
+ */
125
+ delete(organizationId: string, contentStrategyId: string, requestOptions?: ContentStrategiesClient.RequestOptions): core.HttpResponsePromise<KardApi.DeleteResourceResponse>;
126
+ private __delete;
127
+ }
@@ -0,0 +1,414 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
38
+ return new (P || (P = Promise))(function (resolve, reject) {
39
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
40
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
42
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
43
+ });
44
+ };
45
+ Object.defineProperty(exports, "__esModule", { value: true });
46
+ exports.ContentStrategiesClient = void 0;
47
+ const BaseClient_js_1 = require("../../../../../../BaseClient.js");
48
+ const headers_js_1 = require("../../../../../../core/headers.js");
49
+ const core = __importStar(require("../../../../../../core/index.js"));
50
+ const environments = __importStar(require("../../../../../../environments.js"));
51
+ const handleNonStatusCodeError_js_1 = require("../../../../../../errors/handleNonStatusCodeError.js");
52
+ const errors = __importStar(require("../../../../../../errors/index.js"));
53
+ const KardApi = __importStar(require("../../../../../index.js"));
54
+ class ContentStrategiesClient {
55
+ constructor(options = {}) {
56
+ this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
+ }
58
+ /**
59
+ * Create a content strategy for the organization. The strategy name must be unique within the organization.
60
+ *
61
+ * @param {string} organizationId - Unique identifier of the organization
62
+ * @param {KardApi.organizations.CreateContentStrategyRequestBody} request
63
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
64
+ *
65
+ * @throws {@link KardApi.UnauthorizedError}
66
+ * @throws {@link KardApi.ForbiddenError}
67
+ * @throws {@link KardApi.InvalidRequest}
68
+ * @throws {@link KardApi.ConflictError}
69
+ * @throws {@link KardApi.DoesNotExistError}
70
+ * @throws {@link KardApi.InternalServerError}
71
+ *
72
+ * @example
73
+ * await client.organizations.contentStrategies.create("org-123", {
74
+ * data: {
75
+ * type: "contentStrategy",
76
+ * attributes: {
77
+ * name: "Featured Travel",
78
+ * filters: ["HIGHEST_CASHBACK", "NEWLY_LIVE"],
79
+ * categories: ["Travel"],
80
+ * categoryExclusions: ["Gas"],
81
+ * merchantExclusions: ["merchant-abc"]
82
+ * }
83
+ * }
84
+ * })
85
+ */
86
+ create(organizationId, request, requestOptions) {
87
+ return core.HttpResponsePromise.fromPromise(this.__create(organizationId, request, requestOptions));
88
+ }
89
+ __create(organizationId, request, requestOptions) {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
92
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
93
+ 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);
94
+ const _response = yield core.fetcher({
95
+ 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`),
96
+ method: "POST",
97
+ headers: _headers,
98
+ contentType: "application/json",
99
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
100
+ requestType: "json",
101
+ body: request,
102
+ 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,
103
+ 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,
104
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
105
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
106
+ logging: this._options.logging,
107
+ });
108
+ if (_response.ok) {
109
+ return {
110
+ data: _response.body,
111
+ rawResponse: _response.rawResponse,
112
+ };
113
+ }
114
+ if (_response.error.reason === "status-code") {
115
+ switch (_response.error.statusCode) {
116
+ case 401:
117
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
118
+ case 403:
119
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
120
+ case 400:
121
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
122
+ case 409:
123
+ throw new KardApi.ConflictError(_response.error.body, _response.rawResponse);
124
+ case 404:
125
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
126
+ case 500:
127
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
128
+ default:
129
+ throw new errors.KardApiError({
130
+ statusCode: _response.error.statusCode,
131
+ body: _response.error.body,
132
+ rawResponse: _response.rawResponse,
133
+ });
134
+ }
135
+ }
136
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/v2/issuers/{organizationId}/contentStrategies");
137
+ });
138
+ }
139
+ /**
140
+ * List content strategies belonging to the authenticated organization
141
+ *
142
+ * @param {string} organizationId - Unique identifier of the organization
143
+ * @param {KardApi.organizations.ListContentStrategiesRequest} request
144
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
145
+ *
146
+ * @throws {@link KardApi.UnauthorizedError}
147
+ * @throws {@link KardApi.ForbiddenError}
148
+ * @throws {@link KardApi.InvalidRequest}
149
+ * @throws {@link KardApi.DoesNotExistError}
150
+ * @throws {@link KardApi.InternalServerError}
151
+ *
152
+ * @example
153
+ * await client.organizations.contentStrategies.list("organizationId")
154
+ */
155
+ list(organizationId, request = {}, requestOptions) {
156
+ return core.HttpResponsePromise.fromPromise(this.__list(organizationId, request, requestOptions));
157
+ }
158
+ __list(organizationId_1) {
159
+ return __awaiter(this, arguments, void 0, function* (organizationId, request = {}, requestOptions) {
160
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
161
+ const { "filter[name]": filterName, "page[after]": pageAfter, "page[size]": pageSize } = request;
162
+ const _queryParams = {
163
+ "filter[name]": filterName,
164
+ "page[after]": pageAfter,
165
+ "page[size]": pageSize,
166
+ };
167
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
168
+ 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);
169
+ const _response = yield core.fetcher({
170
+ 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`),
171
+ method: "GET",
172
+ headers: _headers,
173
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
174
+ 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,
175
+ 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,
176
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
177
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
178
+ logging: this._options.logging,
179
+ });
180
+ if (_response.ok) {
181
+ return {
182
+ data: _response.body,
183
+ rawResponse: _response.rawResponse,
184
+ };
185
+ }
186
+ if (_response.error.reason === "status-code") {
187
+ switch (_response.error.statusCode) {
188
+ case 401:
189
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
190
+ case 403:
191
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
192
+ case 400:
193
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
194
+ case 404:
195
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
196
+ case 500:
197
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
198
+ default:
199
+ throw new errors.KardApiError({
200
+ statusCode: _response.error.statusCode,
201
+ body: _response.error.body,
202
+ rawResponse: _response.rawResponse,
203
+ });
204
+ }
205
+ }
206
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/contentStrategies");
207
+ });
208
+ }
209
+ /**
210
+ * Retrieve a specific content strategy
211
+ *
212
+ * @param {string} organizationId - Unique identifier of the organization
213
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
214
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
215
+ *
216
+ * @throws {@link KardApi.UnauthorizedError}
217
+ * @throws {@link KardApi.ForbiddenError}
218
+ * @throws {@link KardApi.DoesNotExistError}
219
+ * @throws {@link KardApi.InternalServerError}
220
+ *
221
+ * @example
222
+ * await client.organizations.contentStrategies.get("organizationId", "contentStrategyId")
223
+ */
224
+ get(organizationId, contentStrategyId, requestOptions) {
225
+ return core.HttpResponsePromise.fromPromise(this.__get(organizationId, contentStrategyId, requestOptions));
226
+ }
227
+ __get(organizationId, contentStrategyId, requestOptions) {
228
+ return __awaiter(this, void 0, void 0, function* () {
229
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
230
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
231
+ 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);
232
+ const _response = yield core.fetcher({
233
+ 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)}`),
234
+ method: "GET",
235
+ headers: _headers,
236
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
237
+ 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,
238
+ 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,
239
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
240
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
241
+ logging: this._options.logging,
242
+ });
243
+ if (_response.ok) {
244
+ return {
245
+ data: _response.body,
246
+ rawResponse: _response.rawResponse,
247
+ };
248
+ }
249
+ if (_response.error.reason === "status-code") {
250
+ switch (_response.error.statusCode) {
251
+ case 401:
252
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
253
+ case 403:
254
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
255
+ case 404:
256
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
257
+ case 500:
258
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
259
+ default:
260
+ throw new errors.KardApiError({
261
+ statusCode: _response.error.statusCode,
262
+ body: _response.error.body,
263
+ rawResponse: _response.rawResponse,
264
+ });
265
+ }
266
+ }
267
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/v2/issuers/{organizationId}/contentStrategies/{contentStrategyId}");
268
+ });
269
+ }
270
+ /**
271
+ * Replace a content strategy. All fields must be provided; any omitted attribute is treated as cleared.
272
+ *
273
+ * @param {string} organizationId - Unique identifier of the organization
274
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
275
+ * @param {KardApi.organizations.UpdateContentStrategyRequestBody} request
276
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
277
+ *
278
+ * @throws {@link KardApi.UnauthorizedError}
279
+ * @throws {@link KardApi.ForbiddenError}
280
+ * @throws {@link KardApi.InvalidRequest}
281
+ * @throws {@link KardApi.ConflictError}
282
+ * @throws {@link KardApi.DoesNotExistError}
283
+ * @throws {@link KardApi.InternalServerError}
284
+ *
285
+ * @example
286
+ * await client.organizations.contentStrategies.update("organizationId", "contentStrategyId", {
287
+ * data: {
288
+ * type: "contentStrategy",
289
+ * attributes: {
290
+ * name: "name",
291
+ * filters: ["NEWLY_LIVE", "NEWLY_LIVE"],
292
+ * categories: ["Arts & Entertainment", "Arts & Entertainment"],
293
+ * categoryExclusions: ["Arts & Entertainment", "Arts & Entertainment"],
294
+ * merchantExclusions: ["merchantExclusions", "merchantExclusions"]
295
+ * }
296
+ * }
297
+ * })
298
+ */
299
+ update(organizationId, contentStrategyId, request, requestOptions) {
300
+ return core.HttpResponsePromise.fromPromise(this.__update(organizationId, contentStrategyId, request, requestOptions));
301
+ }
302
+ __update(organizationId, contentStrategyId, request, requestOptions) {
303
+ return __awaiter(this, void 0, void 0, function* () {
304
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
305
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
306
+ 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);
307
+ const _response = yield core.fetcher({
308
+ 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)}`),
309
+ method: "PUT",
310
+ headers: _headers,
311
+ contentType: "application/json",
312
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
313
+ requestType: "json",
314
+ body: request,
315
+ 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,
316
+ 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,
317
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
318
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
319
+ logging: this._options.logging,
320
+ });
321
+ if (_response.ok) {
322
+ return {
323
+ data: _response.body,
324
+ rawResponse: _response.rawResponse,
325
+ };
326
+ }
327
+ if (_response.error.reason === "status-code") {
328
+ switch (_response.error.statusCode) {
329
+ case 401:
330
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
331
+ case 403:
332
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
333
+ case 400:
334
+ throw new KardApi.InvalidRequest(_response.error.body, _response.rawResponse);
335
+ case 409:
336
+ throw new KardApi.ConflictError(_response.error.body, _response.rawResponse);
337
+ case 404:
338
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
339
+ case 500:
340
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
341
+ default:
342
+ throw new errors.KardApiError({
343
+ statusCode: _response.error.statusCode,
344
+ body: _response.error.body,
345
+ rawResponse: _response.rawResponse,
346
+ });
347
+ }
348
+ }
349
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PUT", "/v2/issuers/{organizationId}/contentStrategies/{contentStrategyId}");
350
+ });
351
+ }
352
+ /**
353
+ * Delete a content strategy. Returns 409 if the strategy is still referenced by another resource.
354
+ *
355
+ * @param {string} organizationId - Unique identifier of the organization
356
+ * @param {string} contentStrategyId - Unique identifier of the content strategy (UUID v7)
357
+ * @param {ContentStrategiesClient.RequestOptions} requestOptions - Request-specific configuration.
358
+ *
359
+ * @throws {@link KardApi.UnauthorizedError}
360
+ * @throws {@link KardApi.ForbiddenError}
361
+ * @throws {@link KardApi.ConflictError}
362
+ * @throws {@link KardApi.DoesNotExistError}
363
+ * @throws {@link KardApi.InternalServerError}
364
+ *
365
+ * @example
366
+ * await client.organizations.contentStrategies.delete("organizationId", "contentStrategyId")
367
+ */
368
+ delete(organizationId, contentStrategyId, requestOptions) {
369
+ return core.HttpResponsePromise.fromPromise(this.__delete(organizationId, contentStrategyId, requestOptions));
370
+ }
371
+ __delete(organizationId, contentStrategyId, requestOptions) {
372
+ return __awaiter(this, void 0, void 0, function* () {
373
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
374
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
375
+ 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);
376
+ const _response = yield core.fetcher({
377
+ 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)}`),
378
+ method: "DELETE",
379
+ headers: _headers,
380
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
381
+ 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,
382
+ 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,
383
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
384
+ fetchFn: (_j = this._options) === null || _j === void 0 ? void 0 : _j.fetch,
385
+ logging: this._options.logging,
386
+ });
387
+ if (_response.ok) {
388
+ return { data: _response.body, rawResponse: _response.rawResponse };
389
+ }
390
+ if (_response.error.reason === "status-code") {
391
+ switch (_response.error.statusCode) {
392
+ case 401:
393
+ throw new KardApi.UnauthorizedError(_response.error.body, _response.rawResponse);
394
+ case 403:
395
+ throw new KardApi.ForbiddenError(_response.error.body, _response.rawResponse);
396
+ case 409:
397
+ throw new KardApi.ConflictError(_response.error.body, _response.rawResponse);
398
+ case 404:
399
+ throw new KardApi.DoesNotExistError(_response.error.body, _response.rawResponse);
400
+ case 500:
401
+ throw new KardApi.InternalServerError(_response.error.body, _response.rawResponse);
402
+ default:
403
+ throw new errors.KardApiError({
404
+ statusCode: _response.error.statusCode,
405
+ body: _response.error.body,
406
+ rawResponse: _response.rawResponse,
407
+ });
408
+ }
409
+ }
410
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "DELETE", "/v2/issuers/{organizationId}/contentStrategies/{contentStrategyId}");
411
+ });
412
+ }
413
+ }
414
+ exports.ContentStrategiesClient = ContentStrategiesClient;
@@ -0,0 +1 @@
1
+ export * from "./requests/index.js";
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./requests/index.js"), exports);
@@ -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,3 @@
1
+ "use strict";
2
+ // This file was auto-generated by Fern from our API Definition.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1 @@
1
+ export type { ListContentStrategiesRequest } from "./ListContentStrategiesRequest.js";
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,2 @@
1
+ export { ContentStrategiesClient } from "./client/Client.js";
2
+ export * from "./client/index.js";