The shape you pass to cms0<T>() becomes the shape of the client.
src/example.ts
const homePage = await cms.homePage();
const articles = await cms.articles();Accessors are generated from the TypeScript shape that the CLI publishes. If an accessor is missing, republish the schema.
Root content
Root content is a singleton.
src/example.ts
const homePage = await cms.homePage();
await cms.homePage.update({
headline: "A better headline",
});Collections
Array fields become collection accessors.
src/example.ts
const articles = await cms.articles();
const article = await cms.articles.byId("article_id");
await cms.articles.create({
title: "Launch notes",
slug: "launch-notes",
});
await cms.articles.update("article_id", {
title: "Updated title",
});
await cms.articles.delete("article_id");Options
Accessors accept read options:
src/example.ts
const homePage = await cms.homePage({
fields: ["headline", "seo.title"],
exclude: ["seo.jsonLd"],
includeId: true,
locale: "en",
});Use:
fieldsto include specific nested pathsexcludeto remove specific nested pathsincludeIdto include cms0 object IDslocalewhen reading localized contentresponse: "envelope"when you need response metadata
Success check
Accessor calls should match your TypeScript schema. If a field does not exist on the client, publish the schema again and confirm the entry file in cms0.config.ts points at the file that calls cms0<T>().