Documentation ¶
Index ¶
Constants ¶
const Kind = "order"
Kind is the value used within a message's metadata.kind
Variables ¶
This section is empty.
Functions ¶
Types ¶
type CreateOption ¶
type CreateOption func(*createOptions)
CreateOption defines a type for functions that can modify the createOptions struct.
func CreatedAt ¶
func CreatedAt(t time.Time) CreateOption
CreatedAt can be passed to Create to provide a custom created at time.
func ExternalID ¶
func ExternalID(externalID string) CreateOption
ExternalID can be passed to Create to provide a external id.
type Data ¶
type Data struct{}
Data represents the data field of an order message. Note that this is intentionally left empty as per the spec
type Order ¶
type Order struct { Metadata message.Metadata `json:"metadata,omitempty"` Data Data `json:"data,omitempty"` Signature string `json:"signature,omitempty"` }
Order represents a tbdex order message.
func Create ¶
Create creates a new order message. The following are generated by default unless custom values are provided:
- created at time is set to the current time
- protocol is set to "1.0"
- id is autogenerated
func (Order) GetMetadata ¶ added in v0.13.0
GetMetadata returns the metadata of the message
func (Order) GetValidNext ¶ added in v0.13.0
GetValidNext returns the valid message kinds that can follow an order.
func (*Order) UnmarshalJSON ¶
UnmarshalJSON validates and unmarshals the input data into an Order.