跳转到内容
EN

Plant or pay off a foreshadow

Code Mode: praxis.studio.works.drafts.foreshadows.update

HTTP: PUT /studio/v1/works/{work}/drafts/{draft}/foreshadows/{key}

Record a thread under a key of your choice: the unit that plants it and, once written, the unit that pays it off. Call it when you write the setup (payoff left out or null) and again with the same key when a later unit answers it. Both units must belong to this draft. An open foreshadow is reported by the foreshadow_paid check until it has a payoff, and a unit’s context pack does not need to be asked for it.

签名

praxis.studio.works.drafts.foreshadows.update(args:{path:{/** e.g. "wu-gang" */ work:string;/** e.g. "novel" */ draft:string;/** e.g. "改造告示" */ key:string};body:{/** Unit that plants the thread, by number such as 1 or by unt_ identifier; it must belong to this draft. e.g. "1" */ setup:string;/** Unit that pays it off, by number or identifier, in this draft; leave it out or null while it is still open. e.g. "4" */ payoff?:string|null;/** What was planted, in a sentence. e.g. "电线杆上的改造告示,结尾门脸真的退了两米" */ note?:string}}):Promise<{/** Your name for the thread, unique in the work. e.g. "改造告示" */ key:string;/** Unit that plants it, by identifier. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHW" */ setup:string;/** Unit that pays it off, by identifier, or null while the thread is still open. e.g. "unt_01JQ8Z3M9K4V7B2N6C5X0YTRHX" */ payoff:string|null;/** What was planted, in a sentence, so a later session knows what the payoff must answer. e.g. "电线杆上的改造告示,结尾门脸真的退了两米" */ note:string}>;

参数

名称位置类型必填说明
workpathstring是The work being addressed, either its organization-unique slug or its wk_ identifier; a slug case is what a person would say, and a renamed slug still resolves through its old value.
draftpathstring是Draft being addressed, either its in-work key such as novel or its drf_ identifier; a key renamed earlier still resolves through its previous value.
keypathstring是Your name for the thread inside this work, such as 改造告示 or the-photo; the same key updates the same foreshadow.

请求体

必填内容类型说明
是application/jsonWhere the thread is planted, where it is paid off, and what it is.

响应

状态码内容类型说明
200application/jsonThe foreshadow as stored.
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/jsonWORK_NOT_FOUND, DRAFT_NOT_FOUND or UNIT_NOT_FOUND means one address in the path names nothing reachable; use the numbers and keys from the outline rather than a remembered one, since a unit that was deleted never returns.
500application/jsonINTERNAL means the request could not complete; re-read the resource before retrying a write, because the write may already have landed.