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.

Aggiornato il
OperationWhat it doesPermissionConfirmation
collection.listList the draft collections of the site, in order, each with its fields and its number of items.site.readnone
collection.readRead a draft collection: its key, label, fields, title field and slug field.site.readnone
collection.createCreate a collection with its typed fields.site.editnone
collection.updatePatch the label, fields, title field or slug field of a collection.site.editnone
collection.deleteDelete a collection and its draft items; published versions keep theirs until a publish.site.editdestructive

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.

permission: site.readreads onlyclass: read

Esempio di input

{}

Input

L’input è un record: vedi lo schema qui sotto.

{
  "type": "object",
  "properties": {},
  "additionalProperties": false
}

Output

FieldTypeRequiredNotes
collectionsarray of objectyes
collections[].collectionobjectyes
collections[].itemCountintegeryesAt least 0.

I campi più annidati sono nello schema di output che risponde discover_operations con outputSchemas: true.

Provala

yarn splash collection.list '{}' --dry-run

collection.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.

permission: site.readreads onlyclass: read

Esempio di input

{
  "collectionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}

Input

FieldTypeRequiredNotes
collectionIdstring (uuid)yes

Output

FieldTypeRequiredNotes
collectionobjectyes
collection.uidstring (uuid)yes
collection.keystringyesAt most 40 characters.
collection.labelstring | record of stringyes
collection.fieldsarray of object | object | object | object | object | object | object | object | object | object | objectyesAt least 1 item. At most 40 items.
collection.titleFieldstringyes
collection.slugFieldstringyes
collection.positionintegeryesAt least 0.

Provala

yarn splash collection.read '{"collectionId":"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"}' --dry-run

collection.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.

permission: site.editwrites: collectionsclass: transactionundo: yes

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

FieldTypeRequiredNotes
collectionobjectyes
collection.keystringyesAt most 40 characters.
collection.labelstring | record of stringyes
collection.fieldsarray of object | object | object | object | object | object | object | object | object | object | objectyesAt least 1 item. At most 40 items.
collection.titleFieldstringyes
collection.slugFieldstringyes

Output

FieldTypeRequiredNotes
collectionobjectyes
collection.uidstring (uuid)yes
collection.keystringyesAt most 40 characters.
collection.labelstring | record of stringyes
collection.fieldsarray of object | object | object | object | object | object | object | object | object | object | objectyesAt least 1 item. At most 40 items.
collection.titleFieldstringyes
collection.slugFieldstringyes
collection.positionintegeryesAt 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-run

collection.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.

permission: site.editwrites: collection:{collectionId}class: transactionundo: yes

Esempio di input

{
  "collectionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
  "patch": {
    "label": {
      "it": "Eventi e incontri",
      "en": "Events and talks"
    }
  }
}

Input

FieldTypeRequiredNotes
collectionIdstring (uuid)yes
patchobjectyes
patch.labelstring | record of stringno
patch.fieldsarray of object | object | object | object | object | object | object | object | object | object | objectnoAt least 1 item. At most 40 items.
patch.titleFieldstringno
patch.slugFieldstringno

Output

FieldTypeRequiredNotes
collectionobjectyes
collection.uidstring (uuid)yes
collection.keystringyesAt most 40 characters.
collection.labelstring | record of stringyes
collection.fieldsarray of object | object | object | object | object | object | object | object | object | object | objectyesAt least 1 item. At most 40 items.
collection.titleFieldstringyes
collection.slugFieldstringyes
collection.positionintegeryesAt least 0.

Provala

yarn splash collection.update '{"collectionId":"a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d","patch":{"label":{"it":"Eventi e incontri","en":"Events and talks"}}}' --dry-run

collection.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.

permission: site.editwrites: collections, collection:{collectionId}class: transactionconfirm: destructiveundo: yes

Esempio di input

{
  "collectionId": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"
}

Input

FieldTypeRequiredNotes
collectionIdstring (uuid)yes

Output

FieldTypeRequiredNotes
successtrueyes

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.

Guida di Libretto

Colophon. Questa guida è un sito Libretto: 70 pagine in due lingue, 21 pagine della guida importate da Markdown e 42 pagine di riferimento generate dal registro delle operazioni. Composta in Softcore, il codice in IBM Plex Mono. La sua struttura:

/it/ Guida di Libretto /it/start Per iniziare /it/start/request-access Richiedere l'accesso /it/start/workspace Il tuo spazio di lavoro /it/start/first-site Il tuo primo sito /it/start/invite-a-client Invitare un cliente /it/start/connect-claude Connettere Claude a Libretto /it/build Costruire /it/build/first-page Costruire una pagina /it/build/layers-and-canvas Livelli e canvas /it/build/site-components Componenti del sito /it/design-system Design system /it/design-system/tokens Colori, spazi e temi /it/design-system/components Componenti e varianti /it/design-system/fonts Tipografia e font /it/motion Movimento /it/motion/scenes Scene e ricette /it/motion/image-sequences Sequenze di immagini /it/motion/reduced-motion Movimento ridotto /it/publish Pubblicazione /it/publish/languages Le lingue del sito /it/publish/versions Pubblicazione e versioni /it/publish/members-and-forms Iscritti e moduli /it/publish/domains Domini /it/publish/redirects Reindirizzamenti /it/handover Consegnare un sito al cliente /it/glossary Glossario /it/agents Agenti e API /it/agents/mcp Server MCP /it/agents/cli CLI /it/agents/batches Batch /it/agents/errors Errori e segnalazioni /it/agents/operations Operazioni /it/search Cerca