Operazioni sulle raccolte
5 operazioni di nome collection.*. Ognuna si esegue in un batch con apply_ops, dry_run_ops, la CLI o l’admin.
| Operation | What it does | Permission | Confirmation |
|---|---|---|---|
| collection.list | List the draft collections of the site, in order, each with its fields and its number of items. | site.read | none |
| collection.read | Read a draft collection: its key, label, fields, title field and slug field. | site.read | none |
| collection.create | Create a collection with its typed fields. | site.edit | none |
| collection.update | Patch the label, fields, title field or slug field of a collection. | site.edit | none |
| collection.delete | Delete a collection and its draft items; published versions keep theirs until a publish. | site.edit | destructive |
collection.list
List the draft collections of the site, in order, each with its fields and its number of items. Collections are versioned with the site: publish copies them with their published items, and the public site serves those.
Esempio di input
{}Input
L’input è un record: vedi lo schema qui sotto.
{
"type": "object",
"properties": {},
"additionalProperties": false
}Output
| Field | Type | Required | Notes |
|---|---|---|---|
| collections | array of object | yes | |
| collections[].collection | object | yes | |
| collections[].itemCount | integer | yes | At least 0. |
I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.
Provala
yarn splash collection.list '{}' --dry-runcollection.read
Read a draft collection: its key, label, fields, title field and slug field. Collections are versioned with the site: publish copies them with their published items, and the public site serves those.
Esempio di input
{
"collectionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| collectionId | string (uuid) | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| collection | object | yes | |
| collection.uid | string (uuid) | yes | |
| collection.key | string | yes | At most 40 characters. |
| collection.label | string | record of string | yes | |
| collection.fields | array of object | object | object | object | object | object | object | object | object | object | object | yes | At least 1 item. At most 40 items. |
| collection.titleField | string | yes | |
| collection.slugField | string | yes | |
| collection.position | integer | yes | At least 0. |
Provala
yarn splash collection.read '{"collectionId":"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"}' --dry-runcollection.create
Create a collection with its typed fields. The key is unique on the site and never changes: blueprints, repeaters and dynamic pages name the collection by it. Collections are versioned with the site: publish copies them with their published items, and the public site serves those.
Esempio di input
{
"collection": {
"key": "events",
"label": {
"it": "Eventi",
"en": "Events"
},
"titleField": "title",
"slugField": "title",
"fields": [
{
"key": "title",
"type": "text",
"label": {
"it": "Titolo",
"en": "Title"
},
"localized": true,
"required": true
},
{
"key": "date",
"type": "date",
"label": {
"it": "Data",
"en": "Date"
},
"required": true
},
{
"key": "venue",
"type": "text",
"label": {
"it": "Luogo",
"en": "Venue"
}
},
{
"key": "poster",
"type": "media",
"label": "Poster"
},
{
"key": "photos",
"type": "mediaList",
"label": {
"it": "Foto",
"en": "Photos"
}
},
{
"key": "programme",
"type": "file",
"label": {
"it": "Programma (PDF)",
"en": "Programme (PDF)"
},
"localized": true
},
{
"key": "speakers",
"type": "reference",
"label": {
"it": "Relatori",
"en": "Speakers"
},
"collection": "team",
"multiple": true
},
{
"key": "kind",
"type": "select",
"label": {
"it": "Tipo",
"en": "Kind"
},
"options": [
{
"value": "talk",
"label": {
"it": "Incontro",
"en": "Talk"
}
},
{
"value": "screening",
"label": {
"it": "Proiezione",
"en": "Screening"
}
}
]
},
{
"key": "chapters",
"type": "list",
"label": {
"it": "Capitoli",
"en": "Chapters"
},
"fields": [
{
"key": "time",
"type": "number",
"label": "Seconds"
},
{
"key": "title",
"type": "text",
"label": "Title",
"localized": true
}
]
}
]
}
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| collection | object | yes | |
| collection.key | string | yes | At most 40 characters. |
| collection.label | string | record of string | yes | |
| collection.fields | array of object | object | object | object | object | object | object | object | object | object | object | yes | At least 1 item. At most 40 items. |
| collection.titleField | string | yes | |
| collection.slugField | string | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| collection | object | yes | |
| collection.uid | string (uuid) | yes | |
| collection.key | string | yes | At most 40 characters. |
| collection.label | string | record of string | yes | |
| collection.fields | array of object | object | object | object | object | object | object | object | object | object | object | yes | At least 1 item. At most 40 items. |
| collection.titleField | string | yes | |
| collection.slugField | string | yes | |
| collection.position | integer | yes | At least 0. |
Provala
yarn splash collection.create '{"collection":{"key":"events","label":{"it":"Eventi","en":"Events"},"titleField":"title","slugField":"title","fields":[{"key":"title","type":"text","label":{"it":"Titolo","en":"Title"},"localized":true,"required":true},{"key":"date","type":"date","label":{"it":"Data","en":"Date"},"required":true},{"key":"venue","type":"text","label":{"it":"Luogo","en":"Venue"}},{"key":"poster","type":"media","label":"Poster"},{"key":"photos","type":"mediaList","label":{"it":"Foto","en":"Photos"}},{"key":"programme","type":"file","label":{"it":"Programma (PDF)","en":"Programme (PDF)"},"localized":true},{"key":"speakers","type":"reference","label":{"it":"Relatori","en":"Speakers"},"collection":"team","multiple":true},{"key":"kind","type":"select","label":{"it":"Tipo","en":"Kind"},"options":[{"value":"talk","label":{"it":"Incontro","en":"Talk"}},{"value":"screening","label":{"it":"Proiezione","en":"Screening"}}]},{"key":"chapters","type":"list","label":{"it":"Capitoli","en":"Chapters"},"fields":[{"key":"time","type":"number","label":"Seconds"},{"key":"title","type":"text","label":"Title","localized":true}]}]}}' --dry-runcollection.update
Patch the label, fields, title field or slug field of a collection. A field removed or retyped is refused while an item holds a value for it. Collections are versioned with the site: publish copies them with their published items, and the public site serves those.
Esempio di input
{
"collectionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"patch": {
"label": {
"it": "Eventi e incontri",
"en": "Events and talks"
}
}
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| collectionId | string (uuid) | yes | |
| patch | object | yes | |
| patch.label | string | record of string | no | |
| patch.fields | array of object | object | object | object | object | object | object | object | object | object | object | no | At least 1 item. At most 40 items. |
| patch.titleField | string | no | |
| patch.slugField | string | no |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| collection | object | yes | |
| collection.uid | string (uuid) | yes | |
| collection.key | string | yes | At most 40 characters. |
| collection.label | string | record of string | yes | |
| collection.fields | array of object | object | object | object | object | object | object | object | object | object | object | yes | At least 1 item. At most 40 items. |
| collection.titleField | string | yes | |
| collection.slugField | string | yes | |
| collection.position | integer | yes | At least 0. |
Provala
yarn splash collection.update '{"collectionId":"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d","patch":{"label":{"it":"Eventi e incontri","en":"Events and talks"}}}' --dry-runcollection.delete
Delete a collection and its draft items; published versions keep theirs until a publish. Collections are versioned with the site: publish copies them with their published items, and the public site serves those.
Esempio di input
{
"collectionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}Input
| Field | Type | Required | Notes |
|---|---|---|---|
| collectionId | string (uuid) | yes |
Output
| Field | Type | Required | Notes |
|---|---|---|---|
| success | true | yes |
Vuole confirmed: ["destructive"] sul batch, che la forma della CLI per una sola operazione non imposta: mettila in un file di batch ed esegui yarn splash apply <file> --dry-run.
Generato dal registro delle operazioni e dal catalogo degli strumenti MCP (sorgente 61d7cdac4e4d9a70).
Qualcosa non va in questa pagina? Scrivi a docs@librettocms.com.