@usehercules/sdk 1.14.1 → 1.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -0
- package/README.md +9 -0
- package/client.d.mts +13 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +13 -4
- package/client.d.ts.map +1 -1
- package/client.js +21 -5
- package/client.js.map +1 -1
- package/client.mjs +21 -5
- package/client.mjs.map +1 -1
- package/internal/parse.d.mts.map +1 -1
- package/internal/parse.d.ts.map +1 -1
- package/internal/parse.js +5 -0
- package/internal/parse.js.map +1 -1
- package/internal/parse.mjs +5 -0
- package/internal/parse.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/content/{models/models.d.mts → collections/collections.d.mts} +88 -87
- package/resources/content/collections/collections.d.mts.map +1 -0
- package/resources/content/{models/models.d.ts → collections/collections.d.ts} +88 -87
- package/resources/content/collections/collections.d.ts.map +1 -0
- package/resources/content/collections/collections.js +58 -0
- package/resources/content/collections/collections.js.map +1 -0
- package/resources/content/collections/collections.mjs +53 -0
- package/resources/content/collections/collections.mjs.map +1 -0
- package/resources/content/{models → collections}/fields.d.mts +23 -22
- package/resources/content/collections/fields.d.mts.map +1 -0
- package/resources/content/{models → collections}/fields.d.ts +23 -22
- package/resources/content/collections/fields.d.ts.map +1 -0
- package/resources/content/collections/fields.js +41 -0
- package/resources/content/collections/fields.js.map +1 -0
- package/resources/content/collections/fields.mjs +37 -0
- package/resources/content/collections/fields.mjs.map +1 -0
- package/resources/content/collections/index.d.mts +3 -0
- package/resources/content/collections/index.d.mts.map +1 -0
- package/resources/content/collections/index.d.ts +3 -0
- package/resources/content/collections/index.d.ts.map +1 -0
- package/resources/content/{models → collections}/index.js +3 -3
- package/resources/content/collections/index.js.map +1 -0
- package/resources/content/{models → collections}/index.mjs +1 -1
- package/resources/content/collections/index.mjs.map +1 -0
- package/resources/content/collections.d.mts +2 -0
- package/resources/content/collections.d.mts.map +1 -0
- package/resources/content/collections.d.ts +2 -0
- package/resources/content/collections.d.ts.map +1 -0
- package/resources/content/{models.js → collections.js} +2 -2
- package/resources/content/collections.js.map +1 -0
- package/resources/content/collections.mjs +3 -0
- package/resources/content/collections.mjs.map +1 -0
- package/resources/content/content.d.mts +4 -4
- package/resources/content/content.d.mts.map +1 -1
- package/resources/content/content.d.ts +4 -4
- package/resources/content/content.d.ts.map +1 -1
- package/resources/content/content.js +4 -4
- package/resources/content/content.js.map +1 -1
- package/resources/content/content.mjs +4 -4
- package/resources/content/content.mjs.map +1 -1
- package/resources/content/entries.d.mts +18 -18
- package/resources/content/entries.d.mts.map +1 -1
- package/resources/content/entries.d.ts +18 -18
- package/resources/content/entries.d.ts.map +1 -1
- package/resources/content/entries.js +2 -2
- package/resources/content/entries.mjs +2 -2
- package/resources/content/index.d.mts +1 -1
- package/resources/content/index.d.mts.map +1 -1
- package/resources/content/index.d.ts +1 -1
- package/resources/content/index.d.ts.map +1 -1
- package/resources/content/index.js +3 -3
- package/resources/content/index.js.map +1 -1
- package/resources/content/index.mjs +1 -1
- package/resources/content/index.mjs.map +1 -1
- package/resources/email/email.d.mts +166 -0
- package/resources/email/email.d.mts.map +1 -0
- package/resources/email/email.d.ts +166 -0
- package/resources/email/email.d.ts.map +1 -0
- package/resources/email/email.js +43 -0
- package/resources/email/email.js.map +1 -0
- package/resources/email/email.mjs +38 -0
- package/resources/email/email.mjs.map +1 -0
- package/resources/email/identities.d.mts +107 -0
- package/resources/email/identities.d.mts.map +1 -0
- package/resources/email/identities.d.ts +107 -0
- package/resources/email/identities.d.ts.map +1 -0
- package/resources/email/identities.js +51 -0
- package/resources/email/identities.js.map +1 -0
- package/resources/email/identities.mjs +47 -0
- package/resources/email/identities.mjs.map +1 -0
- package/resources/email/index.d.mts +3 -0
- package/resources/email/index.d.mts.map +1 -0
- package/resources/email/index.d.ts +3 -0
- package/resources/email/index.d.ts.map +1 -0
- package/resources/email/index.js +9 -0
- package/resources/email/index.js.map +1 -0
- package/resources/email/index.mjs +4 -0
- package/resources/email/index.mjs.map +1 -0
- package/resources/email.d.mts +2 -0
- package/resources/email.d.mts.map +1 -0
- package/resources/email.d.ts +2 -0
- package/resources/email.d.ts.map +1 -0
- package/resources/email.js +6 -0
- package/resources/email.js.map +1 -0
- package/resources/{content/models.mjs → email.mjs} +2 -2
- package/resources/email.mjs.map +1 -0
- package/resources/files.d.mts +8 -6
- package/resources/files.d.mts.map +1 -1
- package/resources/files.d.ts +8 -6
- package/resources/files.d.ts.map +1 -1
- package/resources/files.js +3 -2
- package/resources/files.js.map +1 -1
- package/resources/files.mjs +3 -2
- package/resources/files.mjs.map +1 -1
- package/resources/index.d.mts +1 -0
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -0
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +46 -8
- package/src/internal/parse.ts +6 -0
- package/src/resources/content/{models/models.ts → collections/collections.ts} +112 -108
- package/src/resources/content/{models → collections}/fields.ts +39 -27
- package/src/resources/content/{models → collections}/index.ts +8 -8
- package/src/resources/content/collections.ts +3 -0
- package/src/resources/content/content.ts +16 -16
- package/src/resources/content/entries.ts +20 -20
- package/src/resources/content/index.ts +9 -9
- package/src/resources/email/email.ts +229 -0
- package/src/resources/email/identities.ts +151 -0
- package/src/resources/email/index.ts +18 -0
- package/src/resources/{content/models.ts → email.ts} +1 -1
- package/src/resources/files.ts +8 -6
- package/src/resources/index.ts +9 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
- package/resources/content/models/fields.d.mts.map +0 -1
- package/resources/content/models/fields.d.ts.map +0 -1
- package/resources/content/models/fields.js +0 -37
- package/resources/content/models/fields.js.map +0 -1
- package/resources/content/models/fields.mjs +0 -33
- package/resources/content/models/fields.mjs.map +0 -1
- package/resources/content/models/index.d.mts +0 -3
- package/resources/content/models/index.d.mts.map +0 -1
- package/resources/content/models/index.d.ts +0 -3
- package/resources/content/models/index.d.ts.map +0 -1
- package/resources/content/models/index.js.map +0 -1
- package/resources/content/models/index.mjs.map +0 -1
- package/resources/content/models/models.d.mts.map +0 -1
- package/resources/content/models/models.d.ts.map +0 -1
- package/resources/content/models/models.js +0 -54
- package/resources/content/models/models.js.map +0 -1
- package/resources/content/models/models.mjs +0 -49
- package/resources/content/models/models.mjs.map +0 -1
- package/resources/content/models.d.mts +0 -2
- package/resources/content/models.d.mts.map +0 -1
- package/resources/content/models.d.ts +0 -2
- package/resources/content/models.d.ts.map +0 -1
- package/resources/content/models.js.map +0 -1
- package/resources/content/models.mjs.map +0 -1
|
@@ -8,61 +8,116 @@ import { CursorIDPage, type CursorIDPageParams, PagePromise } from '../../../cor
|
|
|
8
8
|
import { RequestOptions } from '../../../internal/request-options';
|
|
9
9
|
import { path } from '../../../internal/utils/path';
|
|
10
10
|
|
|
11
|
-
export class
|
|
11
|
+
export class Collections extends APIResource {
|
|
12
12
|
fields: FieldsAPI.Fields = new FieldsAPI.Fields(this._client);
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
|
-
* Creates a new content
|
|
16
|
-
* the schema for entries. Example
|
|
15
|
+
* Creates a new content collection with optional initial fields. Content
|
|
16
|
+
* collections define the schema for entries. Example collections: 'Blog Post',
|
|
17
|
+
* 'Product', 'Author'.
|
|
17
18
|
*/
|
|
18
|
-
create(body:
|
|
19
|
-
return this._client.post('/v1/content/
|
|
19
|
+
create(body: CollectionCreateParams, options?: RequestOptions): APIPromise<Collection> {
|
|
20
|
+
return this._client.post('/v1/content/collections', { body, ...options });
|
|
20
21
|
}
|
|
21
22
|
|
|
22
23
|
/**
|
|
23
|
-
* Updates an existing content
|
|
24
|
-
* lock status. The api_id cannot be changed after creation.
|
|
24
|
+
* Updates an existing content collection. Use this to modify the name,
|
|
25
|
+
* description, or lock status. The api_id cannot be changed after creation.
|
|
25
26
|
*/
|
|
26
27
|
update(
|
|
27
|
-
|
|
28
|
-
body:
|
|
28
|
+
collectionID: string,
|
|
29
|
+
body: CollectionUpdateParams | null | undefined = {},
|
|
29
30
|
options?: RequestOptions,
|
|
30
|
-
): APIPromise<
|
|
31
|
-
return this._client.patch(path`/v1/content/
|
|
31
|
+
): APIPromise<Collection> {
|
|
32
|
+
return this._client.patch(path`/v1/content/collections/${collectionID}`, { body, ...options });
|
|
32
33
|
}
|
|
33
34
|
|
|
34
35
|
/**
|
|
35
|
-
* Retrieves a paginated list of content
|
|
36
|
-
* schema/structure for content entries.
|
|
36
|
+
* Retrieves a paginated list of content collections. Content collections define
|
|
37
|
+
* the schema/structure for content entries.
|
|
37
38
|
*/
|
|
38
39
|
list(
|
|
39
|
-
query:
|
|
40
|
+
query: CollectionListParams | null | undefined = {},
|
|
40
41
|
options?: RequestOptions,
|
|
41
|
-
): PagePromise<
|
|
42
|
-
return this._client.getAPIList('/v1/content/
|
|
42
|
+
): PagePromise<CollectionsCursorIDPage, Collection> {
|
|
43
|
+
return this._client.getAPIList('/v1/content/collections', CursorIDPage<Collection>, {
|
|
44
|
+
query,
|
|
45
|
+
...options,
|
|
46
|
+
});
|
|
43
47
|
}
|
|
44
48
|
|
|
45
49
|
/**
|
|
46
|
-
* Archives a content
|
|
50
|
+
* Archives a content collection, hiding it from the API. Existing entries are
|
|
47
51
|
* preserved. Use this instead of deletion to maintain data integrity.
|
|
48
52
|
*/
|
|
49
|
-
archive(
|
|
50
|
-
return this._client.delete(path`/v1/content/
|
|
53
|
+
archive(collectionID: string, options?: RequestOptions): APIPromise<Collection> {
|
|
54
|
+
return this._client.delete(path`/v1/content/collections/${collectionID}`, options);
|
|
51
55
|
}
|
|
52
56
|
|
|
53
57
|
/**
|
|
54
|
-
* Retrieves a content
|
|
55
|
-
* definitions.
|
|
58
|
+
* Retrieves a content collection by ID. Returns the collection object including
|
|
59
|
+
* all field definitions.
|
|
56
60
|
*/
|
|
57
|
-
get(
|
|
58
|
-
return this._client.get(path`/v1/content/
|
|
61
|
+
get(collectionID: string, options?: RequestOptions): APIPromise<Collection> {
|
|
62
|
+
return this._client.get(path`/v1/content/collections/${collectionID}`, options);
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
|
|
62
|
-
export type
|
|
66
|
+
export type CollectionsCursorIDPage = CursorIDPage<Collection>;
|
|
63
67
|
|
|
64
68
|
/**
|
|
65
|
-
* A
|
|
69
|
+
* A content collection defines the schema/structure for content entries. Each
|
|
70
|
+
* collection has fields that define what data entries can contain.
|
|
71
|
+
*/
|
|
72
|
+
export interface Collection {
|
|
73
|
+
/**
|
|
74
|
+
* Unique identifier for the content collection
|
|
75
|
+
*/
|
|
76
|
+
id: string;
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* API identifier for the collection (camelCase, e.g., 'blogPost', 'product')
|
|
80
|
+
*/
|
|
81
|
+
api_id: string;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Timestamp when the collection was created
|
|
85
|
+
*/
|
|
86
|
+
created: string;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Whether field modifications are locked (for production safety)
|
|
90
|
+
*/
|
|
91
|
+
locked: boolean;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Display name for the collection
|
|
95
|
+
*/
|
|
96
|
+
name: string;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Timestamp when the collection was last updated
|
|
100
|
+
*/
|
|
101
|
+
updated: string;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Schema version number
|
|
105
|
+
*/
|
|
106
|
+
version: number;
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* Description of the collection
|
|
110
|
+
*/
|
|
111
|
+
description?: string | null;
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* Fields defined in this collection
|
|
115
|
+
*/
|
|
116
|
+
fields?: Array<Field>;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* A field definition within a content collection
|
|
66
121
|
*/
|
|
67
122
|
export interface Field {
|
|
68
123
|
/**
|
|
@@ -107,7 +162,7 @@ export interface Field {
|
|
|
107
162
|
description?: string | null;
|
|
108
163
|
|
|
109
164
|
/**
|
|
110
|
-
* Display order within the
|
|
165
|
+
* Display order within the collection
|
|
111
166
|
*/
|
|
112
167
|
display_order?: number;
|
|
113
168
|
|
|
@@ -128,14 +183,14 @@ export namespace Field {
|
|
|
128
183
|
*/
|
|
129
184
|
export interface Validation {
|
|
130
185
|
/**
|
|
131
|
-
* Allowed
|
|
186
|
+
* Allowed collection apiIds for reference fields
|
|
132
187
|
*/
|
|
133
|
-
|
|
188
|
+
allowed_collections?: Array<string>;
|
|
134
189
|
|
|
135
190
|
/**
|
|
136
|
-
* Allowed
|
|
191
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
137
192
|
*/
|
|
138
|
-
|
|
193
|
+
allowed_mime_types?: Array<string>;
|
|
139
194
|
|
|
140
195
|
/**
|
|
141
196
|
* Allowed values for enum fields
|
|
@@ -190,88 +245,37 @@ export namespace Field {
|
|
|
190
245
|
}
|
|
191
246
|
}
|
|
192
247
|
|
|
193
|
-
|
|
194
|
-
* A content model defines the schema/structure for content entries. Each model has
|
|
195
|
-
* fields that define what data entries can contain.
|
|
196
|
-
*/
|
|
197
|
-
export interface Model {
|
|
198
|
-
/**
|
|
199
|
-
* Unique identifier for the content model
|
|
200
|
-
*/
|
|
201
|
-
id: string;
|
|
202
|
-
|
|
248
|
+
export interface CollectionCreateParams {
|
|
203
249
|
/**
|
|
204
|
-
* API identifier for the
|
|
250
|
+
* API identifier for the collection (camelCase, e.g., 'blogPost')
|
|
205
251
|
*/
|
|
206
252
|
api_id: string;
|
|
207
253
|
|
|
208
254
|
/**
|
|
209
|
-
*
|
|
210
|
-
*/
|
|
211
|
-
created: string;
|
|
212
|
-
|
|
213
|
-
/**
|
|
214
|
-
* Whether field modifications are locked (for production safety)
|
|
215
|
-
*/
|
|
216
|
-
locked: boolean;
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Display name for the model
|
|
255
|
+
* Display name for the collection
|
|
220
256
|
*/
|
|
221
257
|
name: string;
|
|
222
258
|
|
|
223
259
|
/**
|
|
224
|
-
*
|
|
225
|
-
|
|
226
|
-
updated: string;
|
|
227
|
-
|
|
228
|
-
/**
|
|
229
|
-
* Schema version number
|
|
230
|
-
*/
|
|
231
|
-
version: number;
|
|
232
|
-
|
|
233
|
-
/**
|
|
234
|
-
* Description of the model
|
|
235
|
-
*/
|
|
236
|
-
description?: string | null;
|
|
237
|
-
|
|
238
|
-
/**
|
|
239
|
-
* Fields defined in this model
|
|
240
|
-
*/
|
|
241
|
-
fields?: Array<Field>;
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
export interface ModelCreateParams {
|
|
245
|
-
/**
|
|
246
|
-
* API identifier for the model (camelCase, e.g., 'blogPost')
|
|
247
|
-
*/
|
|
248
|
-
api_id: string;
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* Display name for the model
|
|
252
|
-
*/
|
|
253
|
-
name: string;
|
|
254
|
-
|
|
255
|
-
/**
|
|
256
|
-
* Optional custom ID for the model. Must start with 'cm\_'. If not provided, one
|
|
257
|
-
* will be generated.
|
|
260
|
+
* Optional custom ID for the collection. Must start with 'cm\_'. If not provided,
|
|
261
|
+
* one will be generated.
|
|
258
262
|
*/
|
|
259
263
|
id?: string;
|
|
260
264
|
|
|
261
265
|
/**
|
|
262
|
-
* Description of the
|
|
266
|
+
* Description of the collection
|
|
263
267
|
*/
|
|
264
268
|
description?: string;
|
|
265
269
|
|
|
266
270
|
/**
|
|
267
|
-
* Initial fields to create with the
|
|
271
|
+
* Initial fields to create with the collection
|
|
268
272
|
*/
|
|
269
|
-
fields?: Array<
|
|
273
|
+
fields?: Array<CollectionCreateParams.Field>;
|
|
270
274
|
}
|
|
271
275
|
|
|
272
|
-
export namespace
|
|
276
|
+
export namespace CollectionCreateParams {
|
|
273
277
|
/**
|
|
274
|
-
* Request to add a new field to a content
|
|
278
|
+
* Request to add a new field to a content collection
|
|
275
279
|
*/
|
|
276
280
|
export interface Field {
|
|
277
281
|
/**
|
|
@@ -312,7 +316,7 @@ export namespace ModelCreateParams {
|
|
|
312
316
|
description?: string;
|
|
313
317
|
|
|
314
318
|
/**
|
|
315
|
-
* Display order within the
|
|
319
|
+
* Display order within the collection
|
|
316
320
|
*/
|
|
317
321
|
display_order?: number;
|
|
318
322
|
|
|
@@ -333,14 +337,14 @@ export namespace ModelCreateParams {
|
|
|
333
337
|
*/
|
|
334
338
|
export interface Validation {
|
|
335
339
|
/**
|
|
336
|
-
* Allowed
|
|
340
|
+
* Allowed collection apiIds for reference fields
|
|
337
341
|
*/
|
|
338
|
-
|
|
342
|
+
allowed_collections?: Array<string>;
|
|
339
343
|
|
|
340
344
|
/**
|
|
341
|
-
* Allowed
|
|
345
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
342
346
|
*/
|
|
343
|
-
|
|
347
|
+
allowed_mime_types?: Array<string>;
|
|
344
348
|
|
|
345
349
|
/**
|
|
346
350
|
* Allowed values for enum fields
|
|
@@ -396,35 +400,35 @@ export namespace ModelCreateParams {
|
|
|
396
400
|
}
|
|
397
401
|
}
|
|
398
402
|
|
|
399
|
-
export interface
|
|
403
|
+
export interface CollectionUpdateParams {
|
|
400
404
|
/**
|
|
401
|
-
* Description of the
|
|
405
|
+
* Description of the collection
|
|
402
406
|
*/
|
|
403
407
|
description?: string;
|
|
404
408
|
|
|
405
409
|
/**
|
|
406
|
-
* Lock the
|
|
410
|
+
* Lock the collection to prevent field modifications
|
|
407
411
|
*/
|
|
408
412
|
locked?: boolean;
|
|
409
413
|
|
|
410
414
|
/**
|
|
411
|
-
* Display name for the
|
|
415
|
+
* Display name for the collection
|
|
412
416
|
*/
|
|
413
417
|
name?: string;
|
|
414
418
|
}
|
|
415
419
|
|
|
416
|
-
export interface
|
|
420
|
+
export interface CollectionListParams extends CursorIDPageParams {}
|
|
417
421
|
|
|
418
|
-
|
|
422
|
+
Collections.Fields = Fields;
|
|
419
423
|
|
|
420
|
-
export declare namespace
|
|
424
|
+
export declare namespace Collections {
|
|
421
425
|
export {
|
|
426
|
+
type Collection as Collection,
|
|
422
427
|
type Field as Field,
|
|
423
|
-
type
|
|
424
|
-
type
|
|
425
|
-
type
|
|
426
|
-
type
|
|
427
|
-
type ModelListParams as ModelListParams,
|
|
428
|
+
type CollectionsCursorIDPage as CollectionsCursorIDPage,
|
|
429
|
+
type CollectionCreateParams as CollectionCreateParams,
|
|
430
|
+
type CollectionUpdateParams as CollectionUpdateParams,
|
|
431
|
+
type CollectionListParams as CollectionListParams,
|
|
428
432
|
};
|
|
429
433
|
|
|
430
434
|
export {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../../../core/resource';
|
|
4
|
-
import * as
|
|
4
|
+
import * as CollectionsAPI from './collections';
|
|
5
5
|
import { APIPromise } from '../../../core/api-promise';
|
|
6
6
|
import { buildHeaders } from '../../../internal/headers';
|
|
7
7
|
import { RequestOptions } from '../../../internal/request-options';
|
|
@@ -9,29 +9,41 @@ import { path } from '../../../internal/utils/path';
|
|
|
9
9
|
|
|
10
10
|
export class Fields extends APIResource {
|
|
11
11
|
/**
|
|
12
|
-
* Adds a new field to a content
|
|
13
|
-
*
|
|
12
|
+
* Adds a new field to a content collection. Fields define the structure of
|
|
13
|
+
* entries. The collection must not be locked. Adding a field increments the
|
|
14
|
+
* collection version.
|
|
14
15
|
*/
|
|
15
|
-
create(
|
|
16
|
-
|
|
16
|
+
create(
|
|
17
|
+
collectionID: string,
|
|
18
|
+
body: FieldCreateParams,
|
|
19
|
+
options?: RequestOptions,
|
|
20
|
+
): APIPromise<CollectionsAPI.Field> {
|
|
21
|
+
return this._client.post(path`/v1/content/collections/${collectionID}/fields`, { body, ...options });
|
|
17
22
|
}
|
|
18
23
|
|
|
19
24
|
/**
|
|
20
|
-
* Updates an existing field in a content
|
|
21
|
-
* after creation. The
|
|
25
|
+
* Updates an existing field in a content collection. The field type cannot be
|
|
26
|
+
* changed after creation. The collection must not be locked.
|
|
22
27
|
*/
|
|
23
|
-
update(
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
update(
|
|
29
|
+
fieldID: string,
|
|
30
|
+
params: FieldUpdateParams,
|
|
31
|
+
options?: RequestOptions,
|
|
32
|
+
): APIPromise<CollectionsAPI.Field> {
|
|
33
|
+
const { collection_id, ...body } = params;
|
|
34
|
+
return this._client.patch(path`/v1/content/collections/${collection_id}/fields/${fieldID}`, {
|
|
35
|
+
body,
|
|
36
|
+
...options,
|
|
37
|
+
});
|
|
26
38
|
}
|
|
27
39
|
|
|
28
40
|
/**
|
|
29
|
-
* Removes a field from a content
|
|
30
|
-
* preserved but will no longer be validated. The
|
|
41
|
+
* Removes a field from a content collection. Existing entry data for this field is
|
|
42
|
+
* preserved but will no longer be validated. The collection must not be locked.
|
|
31
43
|
*/
|
|
32
44
|
delete(fieldID: string, params: FieldDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
33
|
-
const {
|
|
34
|
-
return this._client.delete(path`/v1/content/
|
|
45
|
+
const { collection_id } = params;
|
|
46
|
+
return this._client.delete(path`/v1/content/collections/${collection_id}/fields/${fieldID}`, {
|
|
35
47
|
...options,
|
|
36
48
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
37
49
|
});
|
|
@@ -77,7 +89,7 @@ export interface FieldCreateParams {
|
|
|
77
89
|
description?: string;
|
|
78
90
|
|
|
79
91
|
/**
|
|
80
|
-
* Display order within the
|
|
92
|
+
* Display order within the collection
|
|
81
93
|
*/
|
|
82
94
|
display_order?: number;
|
|
83
95
|
|
|
@@ -98,14 +110,14 @@ export namespace FieldCreateParams {
|
|
|
98
110
|
*/
|
|
99
111
|
export interface Validation {
|
|
100
112
|
/**
|
|
101
|
-
* Allowed
|
|
113
|
+
* Allowed collection apiIds for reference fields
|
|
102
114
|
*/
|
|
103
|
-
|
|
115
|
+
allowed_collections?: Array<string>;
|
|
104
116
|
|
|
105
117
|
/**
|
|
106
|
-
* Allowed
|
|
118
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
107
119
|
*/
|
|
108
|
-
|
|
120
|
+
allowed_mime_types?: Array<string>;
|
|
109
121
|
|
|
110
122
|
/**
|
|
111
123
|
* Allowed values for enum fields
|
|
@@ -162,9 +174,9 @@ export namespace FieldCreateParams {
|
|
|
162
174
|
|
|
163
175
|
export interface FieldUpdateParams {
|
|
164
176
|
/**
|
|
165
|
-
* Path param: The unique identifier of the content
|
|
177
|
+
* Path param: The unique identifier of the content collection
|
|
166
178
|
*/
|
|
167
|
-
|
|
179
|
+
collection_id: string;
|
|
168
180
|
|
|
169
181
|
/**
|
|
170
182
|
* Body param: Description of the field
|
|
@@ -198,14 +210,14 @@ export namespace FieldUpdateParams {
|
|
|
198
210
|
*/
|
|
199
211
|
export interface Validation {
|
|
200
212
|
/**
|
|
201
|
-
* Allowed
|
|
213
|
+
* Allowed collection apiIds for reference fields
|
|
202
214
|
*/
|
|
203
|
-
|
|
215
|
+
allowed_collections?: Array<string>;
|
|
204
216
|
|
|
205
217
|
/**
|
|
206
|
-
* Allowed
|
|
218
|
+
* Allowed MIME types for asset fields (e.g., 'image/\*', 'application/pdf')
|
|
207
219
|
*/
|
|
208
|
-
|
|
220
|
+
allowed_mime_types?: Array<string>;
|
|
209
221
|
|
|
210
222
|
/**
|
|
211
223
|
* Allowed values for enum fields
|
|
@@ -262,9 +274,9 @@ export namespace FieldUpdateParams {
|
|
|
262
274
|
|
|
263
275
|
export interface FieldDeleteParams {
|
|
264
276
|
/**
|
|
265
|
-
* The unique identifier of the content
|
|
277
|
+
* The unique identifier of the content collection
|
|
266
278
|
*/
|
|
267
|
-
|
|
279
|
+
collection_id: string;
|
|
268
280
|
}
|
|
269
281
|
|
|
270
282
|
export declare namespace Fields {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
2
|
|
|
3
|
-
export { Fields, type FieldCreateParams, type FieldUpdateParams, type FieldDeleteParams } from './fields';
|
|
4
3
|
export {
|
|
5
|
-
|
|
4
|
+
Collections,
|
|
5
|
+
type Collection,
|
|
6
6
|
type Field,
|
|
7
|
-
type
|
|
8
|
-
type
|
|
9
|
-
type
|
|
10
|
-
type
|
|
11
|
-
|
|
12
|
-
} from './
|
|
7
|
+
type CollectionCreateParams,
|
|
8
|
+
type CollectionUpdateParams,
|
|
9
|
+
type CollectionListParams,
|
|
10
|
+
type CollectionsCursorIDPage,
|
|
11
|
+
} from './collections';
|
|
12
|
+
export { Fields, type FieldCreateParams, type FieldUpdateParams, type FieldDeleteParams } from './fields';
|
|
@@ -29,16 +29,16 @@ import {
|
|
|
29
29
|
Locales,
|
|
30
30
|
LocalesCursorIDPage,
|
|
31
31
|
} from './locales';
|
|
32
|
-
import * as
|
|
32
|
+
import * as CollectionsAPI from './collections/collections';
|
|
33
33
|
import {
|
|
34
|
+
Collection,
|
|
35
|
+
CollectionCreateParams,
|
|
36
|
+
CollectionListParams,
|
|
37
|
+
CollectionUpdateParams,
|
|
38
|
+
Collections,
|
|
39
|
+
CollectionsCursorIDPage,
|
|
34
40
|
Field,
|
|
35
|
-
|
|
36
|
-
ModelCreateParams,
|
|
37
|
-
ModelListParams,
|
|
38
|
-
ModelUpdateParams,
|
|
39
|
-
Models,
|
|
40
|
-
ModelsCursorIDPage,
|
|
41
|
-
} from './models/models';
|
|
41
|
+
} from './collections/collections';
|
|
42
42
|
import * as ReleasesAPI from './releases/releases';
|
|
43
43
|
import {
|
|
44
44
|
Release,
|
|
@@ -55,14 +55,14 @@ import {
|
|
|
55
55
|
* Content APIs are currently in beta.
|
|
56
56
|
*/
|
|
57
57
|
export class Content extends APIResource {
|
|
58
|
-
|
|
58
|
+
collections: CollectionsAPI.Collections = new CollectionsAPI.Collections(this._client);
|
|
59
59
|
entries: EntriesAPI.Entries = new EntriesAPI.Entries(this._client);
|
|
60
60
|
assets: AssetsAPI.Assets = new AssetsAPI.Assets(this._client);
|
|
61
61
|
locales: LocalesAPI.Locales = new LocalesAPI.Locales(this._client);
|
|
62
62
|
releases: ReleasesAPI.Releases = new ReleasesAPI.Releases(this._client);
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
Content.
|
|
65
|
+
Content.Collections = Collections;
|
|
66
66
|
Content.Entries = Entries;
|
|
67
67
|
Content.Assets = Assets;
|
|
68
68
|
Content.Locales = Locales;
|
|
@@ -70,13 +70,13 @@ Content.Releases = Releases;
|
|
|
70
70
|
|
|
71
71
|
export declare namespace Content {
|
|
72
72
|
export {
|
|
73
|
-
|
|
73
|
+
Collections as Collections,
|
|
74
|
+
type Collection as Collection,
|
|
74
75
|
type Field as Field,
|
|
75
|
-
type
|
|
76
|
-
type
|
|
77
|
-
type
|
|
78
|
-
type
|
|
79
|
-
type ModelListParams as ModelListParams,
|
|
76
|
+
type CollectionsCursorIDPage as CollectionsCursorIDPage,
|
|
77
|
+
type CollectionCreateParams as CollectionCreateParams,
|
|
78
|
+
type CollectionUpdateParams as CollectionUpdateParams,
|
|
79
|
+
type CollectionListParams as CollectionListParams,
|
|
80
80
|
};
|
|
81
81
|
|
|
82
82
|
export {
|
|
@@ -8,7 +8,7 @@ import { path } from '../../internal/utils/path';
|
|
|
8
8
|
|
|
9
9
|
export class Entries extends APIResource {
|
|
10
10
|
/**
|
|
11
|
-
* Creates a new content entry for a given
|
|
11
|
+
* Creates a new content entry for a given collection. Entries start as drafts by
|
|
12
12
|
* default. Use the publish endpoint to make entries publicly accessible.
|
|
13
13
|
*/
|
|
14
14
|
create(body: EntryCreateParams, options?: RequestOptions): APIPromise<Entry> {
|
|
@@ -29,7 +29,7 @@ export class Entries extends APIResource {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Retrieves a paginated list of content entries. Supports filtering by
|
|
32
|
+
* Retrieves a paginated list of content entries. Supports filtering by collection,
|
|
33
33
|
* status, locale, and custom field queries. Use the 'where' parameter for
|
|
34
34
|
* field-based filtering with operators like $eq, $contains, $gt, etc.
|
|
35
35
|
*/
|
|
@@ -81,8 +81,8 @@ export class Entries extends APIResource {
|
|
|
81
81
|
export type EntriesCursorIDPage = CursorIDPage<Entry>;
|
|
82
82
|
|
|
83
83
|
/**
|
|
84
|
-
* A content entry containing field values based on its
|
|
85
|
-
* be drafts, published, or archived.
|
|
84
|
+
* A content entry containing field values based on its collection schema. Entries
|
|
85
|
+
* can be drafts, published, or archived.
|
|
86
86
|
*/
|
|
87
87
|
export interface Entry {
|
|
88
88
|
/**
|
|
@@ -90,6 +90,11 @@ export interface Entry {
|
|
|
90
90
|
*/
|
|
91
91
|
id: string;
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* ID of the content collection this entry belongs to
|
|
95
|
+
*/
|
|
96
|
+
collection_id: string;
|
|
97
|
+
|
|
93
98
|
/**
|
|
94
99
|
* Timestamp when the entry was created
|
|
95
100
|
*/
|
|
@@ -106,11 +111,6 @@ export interface Entry {
|
|
|
106
111
|
*/
|
|
107
112
|
locale: string;
|
|
108
113
|
|
|
109
|
-
/**
|
|
110
|
-
* ID of the content model this entry belongs to
|
|
111
|
-
*/
|
|
112
|
-
model_id: string;
|
|
113
|
-
|
|
114
114
|
/**
|
|
115
115
|
* Publishing status: draft, published, or archived
|
|
116
116
|
*/
|
|
@@ -127,14 +127,14 @@ export interface Entry {
|
|
|
127
127
|
version: number;
|
|
128
128
|
|
|
129
129
|
/**
|
|
130
|
-
*
|
|
130
|
+
* API ID of the content collection (included when populated)
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
collection_api_id?: string;
|
|
133
133
|
|
|
134
134
|
/**
|
|
135
|
-
*
|
|
135
|
+
* Timestamp when first published
|
|
136
136
|
*/
|
|
137
|
-
|
|
137
|
+
first_published_at?: string | null;
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Timestamp when last published
|
|
@@ -154,9 +154,9 @@ export interface Entry {
|
|
|
154
154
|
|
|
155
155
|
export interface EntryCreateParams {
|
|
156
156
|
/**
|
|
157
|
-
* API ID of the content
|
|
157
|
+
* API ID of the content collection (e.g., 'blogPost')
|
|
158
158
|
*/
|
|
159
|
-
|
|
159
|
+
collection: string;
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Optional custom ID for the entry. Must start with 'ce\_'. If not provided, one
|
|
@@ -200,6 +200,11 @@ export interface EntryUpdateParams {
|
|
|
200
200
|
}
|
|
201
201
|
|
|
202
202
|
export interface EntryListParams extends CursorIDPageParams {
|
|
203
|
+
/**
|
|
204
|
+
* Filter by content collection API ID (e.g., 'blogPost')
|
|
205
|
+
*/
|
|
206
|
+
collection?: string;
|
|
207
|
+
|
|
203
208
|
/**
|
|
204
209
|
* Filter by creation date
|
|
205
210
|
*/
|
|
@@ -215,11 +220,6 @@ export interface EntryListParams extends CursorIDPageParams {
|
|
|
215
220
|
*/
|
|
216
221
|
locale?: string;
|
|
217
222
|
|
|
218
|
-
/**
|
|
219
|
-
* Filter by content model API ID (e.g., 'blogPost')
|
|
220
|
-
*/
|
|
221
|
-
model?: string;
|
|
222
|
-
|
|
223
223
|
/**
|
|
224
224
|
* JSON-encoded sort order. Example: {"field":"publishedAt","direction":"desc"}
|
|
225
225
|
*/
|