diff --git a/operator-and-conversation/go/seats/operatorchannel/contract.go b/operator-and-conversation/go/seats/operatorchannel/contract.go index 8fb2a22..3e36498 100644 --- a/operator-and-conversation/go/seats/operatorchannel/contract.go +++ b/operator-and-conversation/go/seats/operatorchannel/contract.go @@ -427,10 +427,33 @@ type TellAnswer = map[string]any // AsksInput is what asks takes. type AsksInput struct { + // the most bytes of the asks in the answer; said when it cuts the answer short + Bound int64 `json:"bound,omitempty"` + // one ask, by its key (.); none for the open asks + Key string `json:"key,omitempty"` + // only the asks opened at or after this time, RFC 3339 + Since string `json:"since,omitempty"` + // open (open and held), ended or all; none is open when no key or since is given, else all + State string `json:"state,omitempty"` +} + +// AsksAnswerAsksItem is a type of the contract. +type AsksAnswerAsksItem struct { + // . + Key string `json:"key"` + // how the ask stands: open, held, or how it ended (answered, expired, cancelled) + State string `json:"state"` } // AsksAnswer is what asks answers. -type AsksAnswer = map[string]any +type AsksAnswer struct { + // each ask the router holds, as its state asks holds it + Asks []AsksAnswerAsksItem `json:"asks"` + // what the bound cut, and how to ask for more; empty when nothing was cut + Cut string `json:"cut,omitempty"` + // how many asks the arguments matched + Matched int64 `json:"matched,omitempty"` +} // AskAccept is the body of ask. type AskAccept = Ask diff --git a/operator-and-conversation/seats/operator-channel/seat.json b/operator-and-conversation/seats/operator-channel/seat.json index 3f33532..2043c1d 100644 --- a/operator-and-conversation/seats/operator-channel/seat.json +++ b/operator-and-conversation/seats/operator-channel/seat.json @@ -116,15 +116,65 @@ }, { "name": "asks", - "description": "The asks the router holds: open first, then the last month's, each with how it ended.", + "description": "The asks the router holds: open first, then the last month's, each with how it ended. With no argument only the open asks, within its default bound; key for one ask, state, since and bound narrow or widen it, and the answer says what it cut.", "input": { "type": "object", - "properties": {}, - "description": "no arguments" + "properties": { + "key": { + "type": "string", + "description": "one ask, by its key (.); none for the open asks" + }, + "state": { + "type": "string", + "description": "open (open and held), ended or all; none is open when no key or since is given, else all" + }, + "since": { + "type": "string", + "description": "only the asks opened at or after this time, RFC 3339" + }, + "bound": { + "type": "integer", + "description": "the most bytes of the asks in the answer; said when it cuts the answer short" + } + } }, "answer": { "type": "object", - "description": "the asks" + "description": "the asks, open first", + "properties": { + "asks": { + "type": "array", + "description": "each ask the router holds, as its state asks holds it", + "items": { + "type": "object", + "properties": { + "key": { + "type": "string", + "description": "." + }, + "state": { + "type": "string", + "description": "how the ask stands: open, held, or how it ended (answered, expired, cancelled)" + } + }, + "required": [ + "key", + "state" + ] + } + }, + "cut": { + "type": "string", + "description": "what the bound cut, and how to ask for more; empty when nothing was cut" + }, + "matched": { + "type": "integer", + "description": "how many asks the arguments matched" + } + }, + "required": [ + "asks" + ] } } ], diff --git a/operator-and-conversation/ts/seats/operatorchannel/src/index.ts b/operator-and-conversation/ts/seats/operatorchannel/src/index.ts index 1331987..ea709f8 100644 --- a/operator-and-conversation/ts/seats/operatorchannel/src/index.ts +++ b/operator-and-conversation/ts/seats/operatorchannel/src/index.ts @@ -364,10 +364,32 @@ export type TellAnswer = Record; /** is what asks takes. */ export interface AsksInput { + /** the most bytes of the asks in the answer; said when it cuts the answer short */ + "bound"?: number; + /** one ask, by its key (.); none for the open asks */ + "key"?: string; + /** only the asks opened at or after this time, RFC 3339 */ + "since"?: string; + /** open (open and held), ended or all; none is open when no key or since is given, else all */ + "state"?: string; +} + +export interface AsksAnswerAsksItem { + /** . */ + "key": string; + /** how the ask stands: open, held, or how it ended (answered, expired, cancelled) */ + "state": string; } /** is what asks answers. */ -export type AsksAnswer = Record; +export interface AsksAnswer { + /** each ask the router holds, as its state asks holds it */ + "asks": AsksAnswerAsksItem[]; + /** what the bound cut, and how to ask for more; empty when nothing was cut */ + "cut"?: string; + /** how many asks the arguments matched */ + "matched"?: number; +} /** is the body of ask. */ export type AskAccept = Ask;