跳转到内容
EN

Read one template

Code Mode: praxis.studio.templates.retrieve

HTTP: GET /studio/v1/templates/{template}

Read one template: its genre, the writing guidance it carries and the unit outline it seeds, with each unit’s intent. Address a saved template by its identifier and a built-in one by its key, alone or with its genre prefix such as novel_long:three_act when two genres share a key. Read it before creating a draft from it, because the template decides the structure the draft starts with.

签名

praxis.studio.templates.retrieve(args:{path:{/** e.g. "novel_long:three_act" */ template:string}}):Promise<{/** Template id for a saved template, or the built-in key when builtin is true. e.g. "three-act" */ id?:string;/** Genre key whose drafts this template may seed; a template of another genre is refused. e.g. "novel_long" */ genre?:string;/** Display name of the template, shown where a draft chooses its starting structure. e.g. "三幕式" */ name?:string;/** Writing guidance the template adds to the first context pack of the draft it seeded. e.g. "第一幕建立人物与目标,第二幕升级阻碍,第三幕兑现冲突。" */ guide?:string;/** Starting node tree in draft order, each node naming the unit kind and intent it creates. */ outline?:Array<{/** Unit kind key from the genre, which must be allowed at that position of the tree. e.g. "chapter" */ kind?:string;/** Structure name for the created unit, used for management rather than as a rendition heading. e.g. "第一幕 · 建立" */ name?:string;/** Starting synopsis of the unit intent, describing what this part has to accomplish. e.g. "主角的日常被打破,目标浮出水面。" */ synopsis?:string;/** Starting intent points for the unit, called beats, arguments or selling points depending on the genre. */ points?:Array<string>;/** Nested nodes created beneath this unit, in the order they appear in the draft. */ children?:Array<unknown>}>;/** Whether this template ships with the genre instead of being saved from a work; built-in ones cannot be deleted. */ builtin?:boolean}>;

参数

名称位置类型必填说明
templatepathstring是Template being addressed: a saved one by its tmpl_ identifier, or a built-in one by its key, optionally prefixed with its genre as in novel_long:three_act when several genres share the key.

响应

状态码内容类型说明
200application/jsonThe template with its genre, guidance and unit outline.
400application/jsonINVALID_PARAMS means a field is missing, malformed or not allowed for this resource; correct the named field and repeat the call.
401application/jsonThe API key is missing, invalid or carries no organization; send a valid organization key in the Authorization header.
404application/jsonTEMPLATE_NOT_FOUND means no saved template has that identifier and no built-in template has that key; read the template list for the genre and use a value it returns.
500application/jsonINTERNAL means the request could not complete; re-read the resource before retrying a write, because the write may already have landed.