@corti/sdk 1.2.0-templates-beta.3 → 1.2.0-templates-beta.4

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 (77) hide show
  1. package/dist/cjs/BaseClient.d.ts +2 -2
  2. package/dist/cjs/BaseClient.js +2 -2
  3. package/dist/cjs/api/resources/newSections/client/Client.d.ts +30 -16
  4. package/dist/cjs/api/resources/newSections/client/Client.js +125 -76
  5. package/dist/cjs/api/resources/newSections/client/requests/CreateSectionRequest.d.ts +30 -0
  6. package/dist/cjs/api/resources/newSections/client/requests/CreateSectionRequest.js +3 -0
  7. package/dist/cjs/api/resources/newSections/client/requests/ListNewSectionsRequest.d.ts +12 -0
  8. package/dist/cjs/api/resources/newSections/client/requests/ListNewSectionsRequest.js +3 -0
  9. package/dist/cjs/api/resources/newSections/client/requests/index.d.ts +2 -0
  10. package/dist/cjs/api/resources/newTemplates/client/Client.d.ts +23 -16
  11. package/dist/cjs/api/resources/newTemplates/client/Client.js +118 -76
  12. package/dist/cjs/api/resources/newTemplates/client/requests/CreateTemplateRequest.d.ts +24 -0
  13. package/dist/cjs/api/resources/newTemplates/client/requests/CreateTemplateRequest.js +3 -0
  14. package/dist/cjs/api/resources/newTemplates/client/requests/ListNewTemplatesRequest.d.ts +12 -0
  15. package/dist/cjs/api/resources/newTemplates/client/requests/ListNewTemplatesRequest.js +3 -0
  16. package/dist/cjs/api/resources/newTemplates/client/requests/index.d.ts +2 -0
  17. package/dist/cjs/api/types/Section.d.ts +8 -0
  18. package/dist/cjs/api/types/SectionVersion.d.ts +1 -0
  19. package/dist/cjs/api/types/Template.d.ts +9 -0
  20. package/dist/cjs/api/types/TemplateVersion.d.ts +2 -0
  21. package/dist/cjs/serialization/resources/newSections/client/index.d.ts +1 -0
  22. package/dist/cjs/serialization/resources/newSections/client/index.js +24 -0
  23. package/dist/cjs/serialization/resources/newSections/client/list.d.ts +8 -0
  24. package/dist/cjs/serialization/resources/newSections/client/list.js +40 -0
  25. package/dist/cjs/serialization/resources/newSections/client/requests/CreateSectionRequest.d.ts +16 -0
  26. package/dist/cjs/serialization/resources/newSections/client/requests/CreateSectionRequest.js +48 -0
  27. package/dist/cjs/serialization/resources/newSections/client/requests/index.d.ts +1 -0
  28. package/dist/cjs/serialization/resources/newSections/client/requests/index.js +3 -1
  29. package/dist/cjs/serialization/resources/newTemplates/client/index.d.ts +1 -0
  30. package/dist/cjs/serialization/resources/newTemplates/client/index.js +24 -0
  31. package/dist/cjs/serialization/resources/newTemplates/client/list.d.ts +8 -0
  32. package/dist/cjs/serialization/resources/newTemplates/client/list.js +40 -0
  33. package/dist/cjs/serialization/resources/newTemplates/client/requests/CreateTemplateRequest.d.ts +18 -0
  34. package/dist/cjs/serialization/resources/newTemplates/client/requests/CreateTemplateRequest.js +50 -0
  35. package/dist/cjs/serialization/resources/newTemplates/client/requests/index.d.ts +1 -0
  36. package/dist/cjs/serialization/resources/newTemplates/client/requests/index.js +3 -1
  37. package/dist/cjs/version.d.ts +1 -1
  38. package/dist/cjs/version.js +1 -1
  39. package/dist/esm/BaseClient.d.mts +2 -2
  40. package/dist/esm/BaseClient.mjs +2 -2
  41. package/dist/esm/api/resources/newSections/client/Client.d.mts +30 -16
  42. package/dist/esm/api/resources/newSections/client/Client.mjs +125 -76
  43. package/dist/esm/api/resources/newSections/client/requests/CreateSectionRequest.d.mts +30 -0
  44. package/dist/esm/api/resources/newSections/client/requests/CreateSectionRequest.mjs +2 -0
  45. package/dist/esm/api/resources/newSections/client/requests/ListNewSectionsRequest.d.mts +12 -0
  46. package/dist/esm/api/resources/newSections/client/requests/ListNewSectionsRequest.mjs +2 -0
  47. package/dist/esm/api/resources/newSections/client/requests/index.d.mts +2 -0
  48. package/dist/esm/api/resources/newTemplates/client/Client.d.mts +23 -16
  49. package/dist/esm/api/resources/newTemplates/client/Client.mjs +118 -76
  50. package/dist/esm/api/resources/newTemplates/client/requests/CreateTemplateRequest.d.mts +24 -0
  51. package/dist/esm/api/resources/newTemplates/client/requests/CreateTemplateRequest.mjs +2 -0
  52. package/dist/esm/api/resources/newTemplates/client/requests/ListNewTemplatesRequest.d.mts +12 -0
  53. package/dist/esm/api/resources/newTemplates/client/requests/ListNewTemplatesRequest.mjs +2 -0
  54. package/dist/esm/api/resources/newTemplates/client/requests/index.d.mts +2 -0
  55. package/dist/esm/api/types/Section.d.mts +8 -0
  56. package/dist/esm/api/types/SectionVersion.d.mts +1 -0
  57. package/dist/esm/api/types/Template.d.mts +9 -0
  58. package/dist/esm/api/types/TemplateVersion.d.mts +2 -0
  59. package/dist/esm/serialization/resources/newSections/client/index.d.mts +1 -0
  60. package/dist/esm/serialization/resources/newSections/client/index.mjs +1 -0
  61. package/dist/esm/serialization/resources/newSections/client/list.d.mts +8 -0
  62. package/dist/esm/serialization/resources/newSections/client/list.mjs +4 -0
  63. package/dist/esm/serialization/resources/newSections/client/requests/CreateSectionRequest.d.mts +16 -0
  64. package/dist/esm/serialization/resources/newSections/client/requests/CreateSectionRequest.mjs +12 -0
  65. package/dist/esm/serialization/resources/newSections/client/requests/index.d.mts +1 -0
  66. package/dist/esm/serialization/resources/newSections/client/requests/index.mjs +1 -0
  67. package/dist/esm/serialization/resources/newTemplates/client/index.d.mts +1 -0
  68. package/dist/esm/serialization/resources/newTemplates/client/index.mjs +1 -0
  69. package/dist/esm/serialization/resources/newTemplates/client/list.d.mts +8 -0
  70. package/dist/esm/serialization/resources/newTemplates/client/list.mjs +4 -0
  71. package/dist/esm/serialization/resources/newTemplates/client/requests/CreateTemplateRequest.d.mts +18 -0
  72. package/dist/esm/serialization/resources/newTemplates/client/requests/CreateTemplateRequest.mjs +14 -0
  73. package/dist/esm/serialization/resources/newTemplates/client/requests/index.d.mts +1 -0
  74. package/dist/esm/serialization/resources/newTemplates/client/requests/index.mjs +1 -0
  75. package/dist/esm/version.d.mts +1 -1
  76. package/dist/esm/version.mjs +1 -1
  77. package/package.json +1 -1
@@ -6,7 +6,7 @@ export type BaseClientOptions = {
6
6
  /** Specify a custom URL to connect the client to. */
7
7
  baseUrl?: core.Supplier<string>;
8
8
  /** Override the Tenant-Name header */
9
- tenantName?: core.Supplier<string | undefined>;
9
+ tenantName: core.Supplier<string>;
10
10
  /** Additional headers to include in requests. */
11
11
  headers?: Record<string, string | core.Supplier<string | null | undefined> | null | undefined>;
12
12
  /** The default maximum time to wait for a response in seconds. */
@@ -26,7 +26,7 @@ export interface BaseRequestOptions {
26
26
  /** A hook to abort the request. */
27
27
  abortSignal?: AbortSignal;
28
28
  /** Override the Tenant-Name header */
29
- tenantName?: string | undefined;
29
+ tenantName?: string;
30
30
  /** Additional query string parameters to include in the request. */
31
31
  queryParams?: Record<string, unknown>;
32
32
  /** Additional headers to include in the request. */
@@ -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": "@corti/sdk",
46
- "X-Fern-SDK-Version": "1.2.0-templates-beta.3",
47
- "User-Agent": "@corti/sdk/1.2.0-templates-beta.3",
46
+ "X-Fern-SDK-Version": "1.2.0-templates-beta.4",
47
+ "User-Agent": "@corti/sdk/1.2.0-templates-beta.4",
48
48
  "X-Fern-Runtime": core.RUNTIME.type,
49
49
  "X-Fern-Runtime-Version": core.RUNTIME.version,
50
50
  "Tenant-Name": options === null || options === void 0 ? void 0 : options.tenantName,
@@ -10,6 +10,36 @@ export declare namespace NewSectionsClient {
10
10
  export declare class NewSectionsClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<NewSectionsClient.Options>;
12
12
  constructor(options: NewSectionsClient.Options);
13
+ /**
14
+ * @param {Corti.ListNewSectionsRequest} request
15
+ * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
16
+ *
17
+ * @example
18
+ * await client.newSections.list()
19
+ */
20
+ list(request?: Corti.ListNewSectionsRequest, requestOptions?: NewSectionsClient.RequestOptions): core.HttpResponsePromise<Corti.Section[]>;
21
+ private __list;
22
+ /**
23
+ * @param {Corti.CreateSectionRequest} request
24
+ * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Corti.BadRequestError}
27
+ *
28
+ * @example
29
+ * await client.newSections.create({
30
+ * name: "name",
31
+ * language: "language",
32
+ * generation: {
33
+ * title: "title",
34
+ * instructions: {
35
+ * contentPrompt: "contentPrompt",
36
+ * writingStylePrompt: "writingStylePrompt"
37
+ * }
38
+ * }
39
+ * })
40
+ */
41
+ create(request: Corti.CreateSectionRequest, requestOptions?: NewSectionsClient.RequestOptions): core.HttpResponsePromise<Corti.Section>;
42
+ private __create;
13
43
  /**
14
44
  * @param {string} sectionID
15
45
  * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -45,20 +75,4 @@ export declare class NewSectionsClient {
45
75
  */
46
76
  update(sectionID: string, request?: Corti.UpdateSectionRequest, requestOptions?: NewSectionsClient.RequestOptions): core.HttpResponsePromise<Corti.Section>;
47
77
  private __update;
48
- /**
49
- * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
50
- *
51
- * @example
52
- * await client.newSections.list()
53
- */
54
- list(requestOptions?: NewSectionsClient.RequestOptions): core.HttpResponsePromise<void>;
55
- private __list;
56
- /**
57
- * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
58
- *
59
- * @example
60
- * await client.newSections.create()
61
- */
62
- create(requestOptions?: NewSectionsClient.RequestOptions): core.HttpResponsePromise<void>;
63
- private __create;
64
78
  }
@@ -55,6 +55,131 @@ class NewSectionsClient {
55
55
  constructor(options) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
+ /**
59
+ * @param {Corti.ListNewSectionsRequest} request
60
+ * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @example
63
+ * await client.newSections.list()
64
+ */
65
+ list(request = {}, requestOptions) {
66
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
67
+ }
68
+ __list() {
69
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
71
+ const { lang, label, published } = request;
72
+ const _queryParams = {
73
+ lang,
74
+ label,
75
+ published,
76
+ };
77
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
78
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
79
+ const _response = yield core.fetcher({
80
+ url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/sections"),
81
+ method: "GET",
82
+ headers: _headers,
83
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
84
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
85
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
86
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
87
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
88
+ logging: this._options.logging,
89
+ });
90
+ if (_response.ok) {
91
+ return {
92
+ data: serializers.newSections.list.Response.parseOrThrow(_response.body, {
93
+ unrecognizedObjectKeys: "passthrough",
94
+ allowUnrecognizedUnionMembers: true,
95
+ allowUnrecognizedEnumValues: true,
96
+ skipValidation: true,
97
+ breadcrumbsPrefix: ["response"],
98
+ }),
99
+ rawResponse: _response.rawResponse,
100
+ };
101
+ }
102
+ if (_response.error.reason === "status-code") {
103
+ throw new errors.CortiError({
104
+ statusCode: _response.error.statusCode,
105
+ body: _response.error.body,
106
+ rawResponse: _response.rawResponse,
107
+ });
108
+ }
109
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/new/sections");
110
+ });
111
+ }
112
+ /**
113
+ * @param {Corti.CreateSectionRequest} request
114
+ * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
115
+ *
116
+ * @throws {@link Corti.BadRequestError}
117
+ *
118
+ * @example
119
+ * await client.newSections.create({
120
+ * name: "name",
121
+ * language: "language",
122
+ * generation: {
123
+ * title: "title",
124
+ * instructions: {
125
+ * contentPrompt: "contentPrompt",
126
+ * writingStylePrompt: "writingStylePrompt"
127
+ * }
128
+ * }
129
+ * })
130
+ */
131
+ create(request, requestOptions) {
132
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
133
+ }
134
+ __create(request, requestOptions) {
135
+ return __awaiter(this, void 0, void 0, function* () {
136
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
137
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
138
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
139
+ const _response = yield core.fetcher({
140
+ url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/sections"),
141
+ method: "POST",
142
+ headers: _headers,
143
+ contentType: "application/json",
144
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
145
+ requestType: "json",
146
+ body: serializers.CreateSectionRequest.jsonOrThrow(request, {
147
+ unrecognizedObjectKeys: "strip",
148
+ omitUndefined: true,
149
+ }),
150
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
151
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
152
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
153
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
154
+ logging: this._options.logging,
155
+ });
156
+ if (_response.ok) {
157
+ return {
158
+ data: serializers.Section.parseOrThrow(_response.body, {
159
+ unrecognizedObjectKeys: "passthrough",
160
+ allowUnrecognizedUnionMembers: true,
161
+ allowUnrecognizedEnumValues: true,
162
+ skipValidation: true,
163
+ breadcrumbsPrefix: ["response"],
164
+ }),
165
+ rawResponse: _response.rawResponse,
166
+ };
167
+ }
168
+ if (_response.error.reason === "status-code") {
169
+ switch (_response.error.statusCode) {
170
+ case 400:
171
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
172
+ default:
173
+ throw new errors.CortiError({
174
+ statusCode: _response.error.statusCode,
175
+ body: _response.error.body,
176
+ rawResponse: _response.rawResponse,
177
+ });
178
+ }
179
+ }
180
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/new/sections");
181
+ });
182
+ }
58
183
  /**
59
184
  * @param {string} sectionID
60
185
  * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -221,81 +346,5 @@ class NewSectionsClient {
221
346
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/new/sections/{sectionID}");
222
347
  });
223
348
  }
224
- /**
225
- * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
226
- *
227
- * @example
228
- * await client.newSections.list()
229
- */
230
- list(requestOptions) {
231
- return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
232
- }
233
- __list(requestOptions) {
234
- return __awaiter(this, void 0, void 0, function* () {
235
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
236
- const _authRequest = yield this._options.authProvider.getAuthRequest();
237
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
238
- const _response = yield core.fetcher({
239
- url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/sections/"),
240
- method: "GET",
241
- headers: _headers,
242
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
243
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
244
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
245
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
246
- fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
247
- logging: this._options.logging,
248
- });
249
- if (_response.ok) {
250
- return { data: undefined, rawResponse: _response.rawResponse };
251
- }
252
- if (_response.error.reason === "status-code") {
253
- throw new errors.CortiError({
254
- statusCode: _response.error.statusCode,
255
- body: _response.error.body,
256
- rawResponse: _response.rawResponse,
257
- });
258
- }
259
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/new/sections/");
260
- });
261
- }
262
- /**
263
- * @param {NewSectionsClient.RequestOptions} requestOptions - Request-specific configuration.
264
- *
265
- * @example
266
- * await client.newSections.create()
267
- */
268
- create(requestOptions) {
269
- return core.HttpResponsePromise.fromPromise(this.__create(requestOptions));
270
- }
271
- __create(requestOptions) {
272
- return __awaiter(this, void 0, void 0, function* () {
273
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
274
- const _authRequest = yield this._options.authProvider.getAuthRequest();
275
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
276
- const _response = yield core.fetcher({
277
- url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/sections/"),
278
- method: "POST",
279
- headers: _headers,
280
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
281
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
282
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
283
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
284
- fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
285
- logging: this._options.logging,
286
- });
287
- if (_response.ok) {
288
- return { data: undefined, rawResponse: _response.rawResponse };
289
- }
290
- if (_response.error.reason === "status-code") {
291
- throw new errors.CortiError({
292
- statusCode: _response.error.statusCode,
293
- body: _response.error.body,
294
- rawResponse: _response.rawResponse,
295
- });
296
- }
297
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/new/sections/");
298
- });
299
- }
300
349
  }
301
350
  exports.NewSectionsClient = NewSectionsClient;
@@ -0,0 +1,30 @@
1
+ import type * as Corti from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * name: "name",
6
+ * language: "language",
7
+ * generation: {
8
+ * title: "title",
9
+ * instructions: {
10
+ * contentPrompt: "contentPrompt",
11
+ * writingStylePrompt: "writingStylePrompt"
12
+ * }
13
+ * }
14
+ * }
15
+ */
16
+ export interface CreateSectionRequest {
17
+ /** A human-readable identifier for this section. Not passed to the LLM. */
18
+ name: string;
19
+ /** The intended language for outputs as BCP 47 tag. Does not strictly have to match outputLanguage in POST /documents request. */
20
+ language: string;
21
+ /** A description for this section. Not passed to the LLM. */
22
+ description?: string;
23
+ /** Labels work as query param filter in the LIST /sections endpoint. */
24
+ labels?: string[];
25
+ /** Reference to the section to inherit generation configuration from. Inherits from published version unless fields are changed or overridden in the POST /documents request. */
26
+ inheritFromId?: string | null;
27
+ generation: Corti.CreateSectionVersionRequest;
28
+ /** Defaults to true when omitted. Set this to false if you do not want the section to automatically show up in LIST /sections. */
29
+ publish?: boolean;
30
+ }
@@ -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,12 @@
1
+ /**
2
+ * @example
3
+ * {}
4
+ */
5
+ export interface ListNewSectionsRequest {
6
+ /** Filter sections by language (BCP 47 tag). Repeatable. */
7
+ lang?: string | string[];
8
+ /** Filter sections by label. Repeatable; matches sections that have any of the given labels. */
9
+ label?: string | string[];
10
+ /** Filter by publish status. Defaults to true when omitted. */
11
+ published?: boolean;
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 });
@@ -1 +1,3 @@
1
+ export type { CreateSectionRequest } from "./CreateSectionRequest.js";
2
+ export type { ListNewSectionsRequest } from "./ListNewSectionsRequest.js";
1
3
  export type { UpdateSectionRequest } from "./UpdateSectionRequest.js";
@@ -10,6 +10,29 @@ export declare namespace NewTemplatesClient {
10
10
  export declare class NewTemplatesClient {
11
11
  protected readonly _options: NormalizedClientOptionsWithAuth<NewTemplatesClient.Options>;
12
12
  constructor(options: NewTemplatesClient.Options);
13
+ /**
14
+ * @param {Corti.ListNewTemplatesRequest} request
15
+ * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
16
+ *
17
+ * @example
18
+ * await client.newTemplates.list()
19
+ */
20
+ list(request?: Corti.ListNewTemplatesRequest, requestOptions?: NewTemplatesClient.RequestOptions): core.HttpResponsePromise<Corti.Template[]>;
21
+ private __list;
22
+ /**
23
+ * @param {Corti.CreateTemplateRequest} request
24
+ * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
25
+ *
26
+ * @throws {@link Corti.BadRequestError}
27
+ *
28
+ * @example
29
+ * await client.newTemplates.create({
30
+ * name: "name",
31
+ * language: "language"
32
+ * })
33
+ */
34
+ create(request: Corti.CreateTemplateRequest, requestOptions?: NewTemplatesClient.RequestOptions): core.HttpResponsePromise<Corti.Template>;
35
+ private __create;
13
36
  /**
14
37
  * @param {string} templateId
15
38
  * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -45,20 +68,4 @@ export declare class NewTemplatesClient {
45
68
  */
46
69
  update(templateId: string, request?: Corti.UpdateTemplateRequest, requestOptions?: NewTemplatesClient.RequestOptions): core.HttpResponsePromise<Corti.Template>;
47
70
  private __update;
48
- /**
49
- * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
50
- *
51
- * @example
52
- * await client.newTemplates.list()
53
- */
54
- list(requestOptions?: NewTemplatesClient.RequestOptions): core.HttpResponsePromise<void>;
55
- private __list;
56
- /**
57
- * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
58
- *
59
- * @example
60
- * await client.newTemplates.create()
61
- */
62
- create(requestOptions?: NewTemplatesClient.RequestOptions): core.HttpResponsePromise<void>;
63
- private __create;
64
71
  }
@@ -55,6 +55,124 @@ class NewTemplatesClient {
55
55
  constructor(options) {
56
56
  this._options = (0, BaseClient_js_1.normalizeClientOptionsWithAuth)(options);
57
57
  }
58
+ /**
59
+ * @param {Corti.ListNewTemplatesRequest} request
60
+ * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
61
+ *
62
+ * @example
63
+ * await client.newTemplates.list()
64
+ */
65
+ list(request = {}, requestOptions) {
66
+ return core.HttpResponsePromise.fromPromise(this.__list(request, requestOptions));
67
+ }
68
+ __list() {
69
+ return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
70
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
71
+ const { lang, label, published } = request;
72
+ const _queryParams = {
73
+ lang,
74
+ label,
75
+ published,
76
+ };
77
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
78
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
79
+ const _response = yield core.fetcher({
80
+ url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/templates"),
81
+ method: "GET",
82
+ headers: _headers,
83
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
84
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
85
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
86
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
87
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
88
+ logging: this._options.logging,
89
+ });
90
+ if (_response.ok) {
91
+ return {
92
+ data: serializers.newTemplates.list.Response.parseOrThrow(_response.body, {
93
+ unrecognizedObjectKeys: "passthrough",
94
+ allowUnrecognizedUnionMembers: true,
95
+ allowUnrecognizedEnumValues: true,
96
+ skipValidation: true,
97
+ breadcrumbsPrefix: ["response"],
98
+ }),
99
+ rawResponse: _response.rawResponse,
100
+ };
101
+ }
102
+ if (_response.error.reason === "status-code") {
103
+ throw new errors.CortiError({
104
+ statusCode: _response.error.statusCode,
105
+ body: _response.error.body,
106
+ rawResponse: _response.rawResponse,
107
+ });
108
+ }
109
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/new/templates");
110
+ });
111
+ }
112
+ /**
113
+ * @param {Corti.CreateTemplateRequest} request
114
+ * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
115
+ *
116
+ * @throws {@link Corti.BadRequestError}
117
+ *
118
+ * @example
119
+ * await client.newTemplates.create({
120
+ * name: "name",
121
+ * language: "language"
122
+ * })
123
+ */
124
+ create(request, requestOptions) {
125
+ return core.HttpResponsePromise.fromPromise(this.__create(request, requestOptions));
126
+ }
127
+ __create(request, requestOptions) {
128
+ return __awaiter(this, void 0, void 0, function* () {
129
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
130
+ const _authRequest = yield this._options.authProvider.getAuthRequest();
131
+ const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
132
+ const _response = yield core.fetcher({
133
+ url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/templates"),
134
+ method: "POST",
135
+ headers: _headers,
136
+ contentType: "application/json",
137
+ queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
138
+ requestType: "json",
139
+ body: serializers.CreateTemplateRequest.jsonOrThrow(request, {
140
+ unrecognizedObjectKeys: "strip",
141
+ omitUndefined: true,
142
+ }),
143
+ timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
144
+ maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
145
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
146
+ fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
147
+ logging: this._options.logging,
148
+ });
149
+ if (_response.ok) {
150
+ return {
151
+ data: serializers.Template.parseOrThrow(_response.body, {
152
+ unrecognizedObjectKeys: "passthrough",
153
+ allowUnrecognizedUnionMembers: true,
154
+ allowUnrecognizedEnumValues: true,
155
+ skipValidation: true,
156
+ breadcrumbsPrefix: ["response"],
157
+ }),
158
+ rawResponse: _response.rawResponse,
159
+ };
160
+ }
161
+ if (_response.error.reason === "status-code") {
162
+ switch (_response.error.statusCode) {
163
+ case 400:
164
+ throw new Corti.BadRequestError(_response.error.body, _response.rawResponse);
165
+ default:
166
+ throw new errors.CortiError({
167
+ statusCode: _response.error.statusCode,
168
+ body: _response.error.body,
169
+ rawResponse: _response.rawResponse,
170
+ });
171
+ }
172
+ }
173
+ return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/new/templates");
174
+ });
175
+ }
58
176
  /**
59
177
  * @param {string} templateId
60
178
  * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
@@ -221,81 +339,5 @@ class NewTemplatesClient {
221
339
  return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "PATCH", "/new/templates/{templateId}");
222
340
  });
223
341
  }
224
- /**
225
- * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
226
- *
227
- * @example
228
- * await client.newTemplates.list()
229
- */
230
- list(requestOptions) {
231
- return core.HttpResponsePromise.fromPromise(this.__list(requestOptions));
232
- }
233
- __list(requestOptions) {
234
- return __awaiter(this, void 0, void 0, function* () {
235
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
236
- const _authRequest = yield this._options.authProvider.getAuthRequest();
237
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
238
- const _response = yield core.fetcher({
239
- url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/templates/"),
240
- method: "GET",
241
- headers: _headers,
242
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
243
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
244
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
245
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
246
- fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
247
- logging: this._options.logging,
248
- });
249
- if (_response.ok) {
250
- return { data: undefined, rawResponse: _response.rawResponse };
251
- }
252
- if (_response.error.reason === "status-code") {
253
- throw new errors.CortiError({
254
- statusCode: _response.error.statusCode,
255
- body: _response.error.body,
256
- rawResponse: _response.rawResponse,
257
- });
258
- }
259
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "GET", "/new/templates/");
260
- });
261
- }
262
- /**
263
- * @param {NewTemplatesClient.RequestOptions} requestOptions - Request-specific configuration.
264
- *
265
- * @example
266
- * await client.newTemplates.create()
267
- */
268
- create(requestOptions) {
269
- return core.HttpResponsePromise.fromPromise(this.__create(requestOptions));
270
- }
271
- __create(requestOptions) {
272
- return __awaiter(this, void 0, void 0, function* () {
273
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
274
- const _authRequest = yield this._options.authProvider.getAuthRequest();
275
- const _headers = (0, headers_js_1.mergeHeaders)(_authRequest.headers, (_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ "Tenant-Name": (_b = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.tenantName) !== null && _b !== void 0 ? _b : (_c = this._options) === null || _c === void 0 ? void 0 : _c.tenantName }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
276
- const _response = yield core.fetcher({
277
- url: core.url.join((_d = (yield core.Supplier.get(this._options.baseUrl))) !== null && _d !== void 0 ? _d : (yield core.Supplier.get(this._options.environment)).base, "new/templates/"),
278
- method: "POST",
279
- headers: _headers,
280
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
281
- timeoutMs: ((_g = (_e = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) !== null && _e !== void 0 ? _e : (_f = this._options) === null || _f === void 0 ? void 0 : _f.timeoutInSeconds) !== null && _g !== void 0 ? _g : 60) * 1000,
282
- maxRetries: (_h = requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries) !== null && _h !== void 0 ? _h : (_j = this._options) === null || _j === void 0 ? void 0 : _j.maxRetries,
283
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
284
- fetchFn: (_k = this._options) === null || _k === void 0 ? void 0 : _k.fetch,
285
- logging: this._options.logging,
286
- });
287
- if (_response.ok) {
288
- return { data: undefined, rawResponse: _response.rawResponse };
289
- }
290
- if (_response.error.reason === "status-code") {
291
- throw new errors.CortiError({
292
- statusCode: _response.error.statusCode,
293
- body: _response.error.body,
294
- rawResponse: _response.rawResponse,
295
- });
296
- }
297
- return (0, handleNonStatusCodeError_js_1.handleNonStatusCodeError)(_response.error, _response.rawResponse, "POST", "/new/templates/");
298
- });
299
- }
300
342
  }
301
343
  exports.NewTemplatesClient = NewTemplatesClient;
@@ -0,0 +1,24 @@
1
+ import type * as Corti from "../../../../index.js";
2
+ /**
3
+ * @example
4
+ * {
5
+ * name: "name",
6
+ * language: "language"
7
+ * }
8
+ */
9
+ export interface CreateTemplateRequest {
10
+ /** The name of this template. Not passed to the LLM. */
11
+ name: string;
12
+ /** A description for this template. Not passed to the LLM. */
13
+ description?: string;
14
+ /** The intended language for outputs as BCP 47 tag. Does not strictly have to match `outputLanguage` in POST /documents request. */
15
+ language: string;
16
+ /** Labels work as query param filter in the LIST /templates endpoint. */
17
+ labels?: string[];
18
+ /** Reference to the template to inherit template instructions and sections from. Inherits from published version unless fields are changed or overridden in the POST /documents request. */
19
+ inheritFromId?: string | null;
20
+ instructions?: Corti.TemplateInstructions;
21
+ sections?: Corti.TemplateVersionSectionRequest[];
22
+ /** Defaults to true when omitted. Set this to false if you do not want the template to automatically show up in LIST templates. */
23
+ publish?: boolean;
24
+ }
@@ -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 });