asyncapi

package
v0.0.0-...-f05cc18 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 21, 2024 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package "asyncapi" provides primitives to interact with the AsyncAPI specification.

Code generated by github.com/lerenn/asyncapi-codegen version v0.39.0 DO NOT EDIT.

Package "asyncapi" provides primitives to interact with the AsyncAPI specification.

Code generated by github.com/lerenn/asyncapi-codegen version v0.39.0 DO NOT EDIT.

Package "asyncapi" provides primitives to interact with the AsyncAPI specification.

Code generated by github.com/lerenn/asyncapi-codegen version v0.39.0 DO NOT EDIT.

Index

Constants

View Source
const (
	// AccountsListRequestChannelPath is the constant representing the 'AccountsListRequestChannel' channel path.
	AccountsListRequestChannelPath = "cryptellation.forwardtests.accounts.list"
	// AccountsListResponseChannelPath is the constant representing the 'AccountsListResponseChannel' channel path.
	AccountsListResponseChannelPath = ""
	// CreateRequestChannelPath is the constant representing the 'CreateRequestChannel' channel path.
	CreateRequestChannelPath = "cryptellation.forwardtests.create"
	// CreateResponseChannelPath is the constant representing the 'CreateResponseChannel' channel path.
	CreateResponseChannelPath = ""
	// ListRequestChannelPath is the constant representing the 'ListRequestChannel' channel path.
	ListRequestChannelPath = "cryptellation.forwardtests.list"
	// ListResponseChannelPath is the constant representing the 'ListResponseChannel' channel path.
	ListResponseChannelPath = ""
	// OrdersCreateRequestChannelPath is the constant representing the 'OrdersCreateRequestChannel' channel path.
	OrdersCreateRequestChannelPath = "cryptellation.forwardtests.orders.create"
	// OrdersCreateResponseChannelPath is the constant representing the 'OrdersCreateResponseChannel' channel path.
	OrdersCreateResponseChannelPath = ""
	// ServiceInfoRequestChannelPath is the constant representing the 'ServiceInfoRequestChannel' channel path.
	ServiceInfoRequestChannelPath = "cryptellation.forwardtests.info"
	// ServiceInfoResponseChannelPath is the constant representing the 'ServiceInfoResponseChannel' channel path.
	ServiceInfoResponseChannelPath = ""
	// StatusRequestChannelPath is the constant representing the 'StatusRequestChannel' channel path.
	StatusRequestChannelPath = "cryptellation.forwardtests.status"
	// StatusResponseChannelPath is the constant representing the 'StatusResponseChannel' channel path.
	StatusResponseChannelPath = ""
)
View Source
const AsyncAPIVersion = "1.0.0"

AsyncAPIVersion is the version of the used AsyncAPI document

Variables

ChannelsPaths is an array of all channels paths

Functions

This section is empty.

Types

type AccountSchema

type AccountSchema struct {
	// Description: Account's assets
	Assets []AssetSchema `json:"assets"`

	// Description: Account's name
	Name string `json:"name"`
}

AccountSchema is a schema from the AsyncAPI specification required in messages

type AccountsListRequestMessage

type AccountsListRequestMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromAccountsListRequestMessage

	// Payload will be inserted in the message payload
	Payload AccountsListRequestMessagePayload
}

AccountsListRequestMessage is the message expected for 'AccountsListRequestMessage' channel.

func NewAccountsListRequestMessage

func NewAccountsListRequestMessage() AccountsListRequestMessage

func (AccountsListRequestMessage) CorrelationID

func (msg AccountsListRequestMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*AccountsListRequestMessage) Set

func (msg *AccountsListRequestMessage) Set(forwardTestID uuid.UUID)

func (*AccountsListRequestMessage) SetAsResponseFrom

func (msg *AccountsListRequestMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*AccountsListRequestMessage) SetCorrelationID

func (msg *AccountsListRequestMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

type AccountsListRequestMessagePayload

type AccountsListRequestMessagePayload struct {
	// Description: Targeted forwardtest ID
	Id ForwardTestIDSchema `json:"id"`
}

AccountsListRequestMessagePayload is a schema from the AsyncAPI specification required in messages

type AccountsListResponseMessage

type AccountsListResponseMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromAccountsListResponseMessage

	// Payload will be inserted in the message payload
	Payload AccountsListResponseMessagePayload
}

AccountsListResponseMessage is the message expected for 'AccountsListResponseMessage' channel.

func NewAccountsListResponseMessage

func NewAccountsListResponseMessage() AccountsListResponseMessage

func (AccountsListResponseMessage) CorrelationID

func (msg AccountsListResponseMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*AccountsListResponseMessage) Set

func (msg *AccountsListResponseMessage) Set(accounts map[string]account.Account)

func (*AccountsListResponseMessage) SetAsResponseFrom

func (msg *AccountsListResponseMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*AccountsListResponseMessage) SetCorrelationID

func (msg *AccountsListResponseMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

func (*AccountsListResponseMessage) ToModel

type AccountsListResponseMessagePayload

type AccountsListResponseMessagePayload struct {
	Accounts []AccountSchema `json:"accounts"`

	// Description: Response to a failed call
	Error *ErrorSchema `json:"error"`
}

AccountsListResponseMessagePayload is a schema from the AsyncAPI specification required in messages

type AppController

type AppController struct {
	// contains filtered or unexported fields
}

AppController is the structure that provides sending capabilities to the developer and and connect the broker with the App

func NewAppController

func NewAppController(bc extensions.BrokerController, options ...ControllerOption) (*AppController, error)

NewAppController links the App to the broker

func (*AppController) Close

func (c *AppController) Close(ctx context.Context)

Close will clean up any existing resources on the controller

func (*AppController) ReplyToAccountsListOperation

func (c *AppController) ReplyToAccountsListOperation(ctx context.Context, recvMsg AccountsListRequestMessage, fn func(replyMsg *AccountsListResponseMessage)) error

ReplyToAccountsListOperation is a helper function to reply to a AccountsListRequest message with a AccountsListResponse message on AccountsListResponse channel.

func (*AppController) ReplyToCreateOperation

func (c *AppController) ReplyToCreateOperation(ctx context.Context, recvMsg CreateRequestMessage, fn func(replyMsg *CreateResponseMessage)) error

ReplyToCreateOperation is a helper function to reply to a CreateRequest message with a CreateResponse message on CreateResponse channel.

func (*AppController) ReplyToGetStatusOperation

func (c *AppController) ReplyToGetStatusOperation(ctx context.Context, recvMsg StatusRequestMessage, fn func(replyMsg *StatusResponseMessage)) error

ReplyToGetStatusOperation is a helper function to reply to a StatusRequest message with a StatusResponse message on StatusResponse channel.

func (*AppController) ReplyToListOperation

func (c *AppController) ReplyToListOperation(ctx context.Context, recvMsg ListRequestMessage, fn func(replyMsg *ListResponseMessage)) error

ReplyToListOperation is a helper function to reply to a ListRequest message with a ListResponse message on ListResponse channel.

func (*AppController) ReplyToOrdersCreateOperation

func (c *AppController) ReplyToOrdersCreateOperation(ctx context.Context, recvMsg OrdersCreateRequestMessage, fn func(replyMsg *OrdersCreateResponseMessage)) error

ReplyToOrdersCreateOperation is a helper function to reply to a OrdersCreateRequest message with a OrdersCreateResponse message on OrdersCreateResponse channel.

func (*AppController) ReplyToServiceInfoOperation

func (c *AppController) ReplyToServiceInfoOperation(ctx context.Context, recvMsg ServiceInfoRequestMessage, fn func(replyMsg *ServiceInfoResponseMessage)) error

ReplyToServiceInfoOperation is a helper function to reply to a ServiceInfoRequest message with a ServiceInfoResponse message on ServiceInfoResponse channel.

func (*AppController) SendAsReplyToAccountsListOperation

func (c *AppController) SendAsReplyToAccountsListOperation(
	ctx context.Context,
	chanAddr string,
	msg AccountsListResponseMessage,
) error

SendAsReplyToAccountsListOperation will send a AccountsListResponse message on AccountsListResponse channel.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SendAsReplyToCreateOperation

func (c *AppController) SendAsReplyToCreateOperation(
	ctx context.Context,
	chanAddr string,
	msg CreateResponseMessage,
) error

SendAsReplyToCreateOperation will send a CreateResponse message on CreateResponse channel.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SendAsReplyToGetStatusOperation

func (c *AppController) SendAsReplyToGetStatusOperation(
	ctx context.Context,
	chanAddr string,
	msg StatusResponseMessage,
) error

SendAsReplyToGetStatusOperation will send a StatusResponse message on StatusResponse channel.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SendAsReplyToListOperation

func (c *AppController) SendAsReplyToListOperation(
	ctx context.Context,
	chanAddr string,
	msg ListResponseMessage,
) error

SendAsReplyToListOperation will send a ListResponse message on ListResponse channel.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SendAsReplyToOrdersCreateOperation

func (c *AppController) SendAsReplyToOrdersCreateOperation(
	ctx context.Context,
	chanAddr string,
	msg OrdersCreateResponseMessage,
) error

SendAsReplyToOrdersCreateOperation will send a OrdersCreateResponse message on OrdersCreateResponse channel.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SendAsReplyToServiceInfoOperation

func (c *AppController) SendAsReplyToServiceInfoOperation(
	ctx context.Context,
	chanAddr string,
	msg ServiceInfoResponseMessage,
) error

SendAsReplyToServiceInfoOperation will send a ServiceInfoResponse message on ServiceInfoResponse channel.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SubscribeToAccountsListOperation

func (c *AppController) SubscribeToAccountsListOperation(
	ctx context.Context,
	fn func(ctx context.Context, msg AccountsListRequestMessage) error,
) error

SubscribeToAccountsListOperation will receive AccountsListRequest messages from AccountsListRequest channel.

Callback function 'fn' will be called each time a new message is received.

NOTE: for now, this only support the first message from AsyncAPI list.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SubscribeToAllChannels

func (c *AppController) SubscribeToAllChannels(ctx context.Context, as AppSubscriber) error

SubscribeToAllChannels will receive messages from channels where channel has no parameter on which the app is expecting messages. For channels with parameters, they should be subscribed independently.

func (*AppController) SubscribeToCreateOperation

func (c *AppController) SubscribeToCreateOperation(
	ctx context.Context,
	fn func(ctx context.Context, msg CreateRequestMessage) error,
) error

Callback function 'fn' will be called each time a new message is received.

NOTE: for now, this only support the first message from AsyncAPI list.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SubscribeToGetStatusOperation

func (c *AppController) SubscribeToGetStatusOperation(
	ctx context.Context,
	fn func(ctx context.Context, msg StatusRequestMessage) error,
) error

Callback function 'fn' will be called each time a new message is received.

NOTE: for now, this only support the first message from AsyncAPI list.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SubscribeToListOperation

func (c *AppController) SubscribeToListOperation(
	ctx context.Context,
	fn func(ctx context.Context, msg ListRequestMessage) error,
) error

Callback function 'fn' will be called each time a new message is received.

NOTE: for now, this only support the first message from AsyncAPI list.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SubscribeToOrdersCreateOperation

func (c *AppController) SubscribeToOrdersCreateOperation(
	ctx context.Context,
	fn func(ctx context.Context, msg OrdersCreateRequestMessage) error,
) error

Callback function 'fn' will be called each time a new message is received.

NOTE: for now, this only support the first message from AsyncAPI list.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) SubscribeToServiceInfoOperation

func (c *AppController) SubscribeToServiceInfoOperation(
	ctx context.Context,
	fn func(ctx context.Context, msg ServiceInfoRequestMessage) error,
) error

Callback function 'fn' will be called each time a new message is received.

NOTE: for now, this only support the first message from AsyncAPI list.

NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*AppController) UnsubscribeFromAccountsListOperation

func (c *AppController) UnsubscribeFromAccountsListOperation(
	ctx context.Context,
)

UnsubscribeFromAccountsListOperation will stop the reception of AccountsListRequest messages from AccountsListRequest channel. A timeout can be set in context to avoid blocking operation, if needed.

func (*AppController) UnsubscribeFromAllChannels

func (c *AppController) UnsubscribeFromAllChannels(ctx context.Context)

UnsubscribeFromAllChannels will stop the subscription of all remaining subscribed channels

func (*AppController) UnsubscribeFromCreateOperation

func (c *AppController) UnsubscribeFromCreateOperation(
	ctx context.Context,
)

UnsubscribeFromCreateOperation will stop the reception of CreateRequest messages from CreateRequest channel. A timeout can be set in context to avoid blocking operation, if needed.

func (*AppController) UnsubscribeFromGetStatusOperation

func (c *AppController) UnsubscribeFromGetStatusOperation(
	ctx context.Context,
)

UnsubscribeFromGetStatusOperation will stop the reception of StatusRequest messages from StatusRequest channel. A timeout can be set in context to avoid blocking operation, if needed.

func (*AppController) UnsubscribeFromListOperation

func (c *AppController) UnsubscribeFromListOperation(
	ctx context.Context,
)

UnsubscribeFromListOperation will stop the reception of ListRequest messages from ListRequest channel. A timeout can be set in context to avoid blocking operation, if needed.

func (*AppController) UnsubscribeFromOrdersCreateOperation

func (c *AppController) UnsubscribeFromOrdersCreateOperation(
	ctx context.Context,
)

UnsubscribeFromOrdersCreateOperation will stop the reception of OrdersCreateRequest messages from OrdersCreateRequest channel. A timeout can be set in context to avoid blocking operation, if needed.

func (*AppController) UnsubscribeFromServiceInfoOperation

func (c *AppController) UnsubscribeFromServiceInfoOperation(
	ctx context.Context,
)

UnsubscribeFromServiceInfoOperation will stop the reception of ServiceInfoRequest messages from ServiceInfoRequest channel. A timeout can be set in context to avoid blocking operation, if needed.

type AppSubscriber

type AppSubscriber interface {
	// AccountsListOperationReceived receive all AccountsListRequest messages from AccountsListRequest channel.
	AccountsListOperationReceived(ctx context.Context, msg AccountsListRequestMessage) error

	// CreateOperationReceived receive all CreateRequest messages from CreateRequest channel.
	CreateOperationReceived(ctx context.Context, msg CreateRequestMessage) error

	// GetStatusOperationReceived receive all StatusRequest messages from StatusRequest channel.
	GetStatusOperationReceived(ctx context.Context, msg StatusRequestMessage) error

	// ListOperationReceived receive all ListRequest messages from ListRequest channel.
	ListOperationReceived(ctx context.Context, msg ListRequestMessage) error

	// OrdersCreateOperationReceived receive all OrdersCreateRequest messages from OrdersCreateRequest channel.
	OrdersCreateOperationReceived(ctx context.Context, msg OrdersCreateRequestMessage) error

	// ServiceInfoOperationReceived receive all ServiceInfoRequest messages from ServiceInfoRequest channel.
	ServiceInfoOperationReceived(ctx context.Context, msg ServiceInfoRequestMessage) error
}

AppSubscriber contains all handlers that are listening messages for App

type AssetSchema

type AssetSchema struct {
	Amount float64 `json:"amount"`
	Name   string  `json:"name"`
}

AssetSchema is a schema from the AsyncAPI specification required in messages Description: An asset is a particular commodity with an amount

type ControllerOption

type ControllerOption func(controller *controller)

ControllerOption is the type of the options that can be passed when creating a new Controller

func WithErrorHandler

func WithErrorHandler(handler extensions.ErrorHandler) ControllerOption

WithErrorHandler attaches a errorhandler to handle errors from subscriber functions

func WithLogger

func WithLogger(logger extensions.Logger) ControllerOption

WithLogger attaches a logger to the controller

func WithMiddlewares

func WithMiddlewares(middlewares ...extensions.Middleware) ControllerOption

WithMiddlewares attaches middlewares that will be executed when sending or receiving messages

type CreateRequestMessage

type CreateRequestMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromCreateRequestMessage

	// Payload will be inserted in the message payload
	Payload CreateRequestMessagePayload
}

CreateRequestMessage is the message expected for 'CreateRequestMessage' channel.

func NewCreateRequestMessage

func NewCreateRequestMessage() CreateRequestMessage

func (CreateRequestMessage) CorrelationID

func (msg CreateRequestMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*CreateRequestMessage) Set

func (msg *CreateRequestMessage) Set(payload forwardtest.NewPayload)

func (*CreateRequestMessage) SetAsResponseFrom

func (msg *CreateRequestMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*CreateRequestMessage) SetCorrelationID

func (msg *CreateRequestMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

func (CreateRequestMessage) ToModel

type CreateRequestMessagePayload

type CreateRequestMessagePayload struct {
	Accounts []AccountSchema `json:"accounts"`
}

CreateRequestMessagePayload is a schema from the AsyncAPI specification required in messages

type CreateResponseMessage

type CreateResponseMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromCreateResponseMessage

	// Payload will be inserted in the message payload
	Payload CreateResponseMessagePayload
}

CreateResponseMessage is the message expected for 'CreateResponseMessage' channel.

func NewCreateResponseMessage

func NewCreateResponseMessage() CreateResponseMessage

func (CreateResponseMessage) CorrelationID

func (msg CreateResponseMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*CreateResponseMessage) SetAsResponseFrom

func (msg *CreateResponseMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*CreateResponseMessage) SetCorrelationID

func (msg *CreateResponseMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

type CreateResponseMessagePayload

type CreateResponseMessagePayload struct {
	// Description: Response to a failed call
	Error *ErrorSchema `json:"error"`

	// Description: Newly created forwardtest ID
	Id string `json:"id"`
}

CreateResponseMessagePayload is a schema from the AsyncAPI specification required in messages

type DateSchema

type DateSchema time.Time

DateSchema is a schema from the AsyncAPI specification required in messages Description: Date-Time format according to RFC3339

func (DateSchema) MarshalJSON

func (t DateSchema) MarshalJSON() ([]byte, error)

MarshalJSON will override the marshal as this is not a normal 'time.Time' type

func (*DateSchema) UnmarshalJSON

func (t *DateSchema) UnmarshalJSON(data []byte) error

UnmarshalJSON will override the unmarshal as this is not a normal 'time.Time' type

type Error

type Error struct {
	Channel string
	Err     error
}

func (*Error) Error

func (e *Error) Error() string

type ErrorSchema

type ErrorSchema struct {
	// Description: Code to identify the error type, based on HTTP errors
	Code int64 `json:"code"`

	// Description: Main error reason
	Message string `json:"message"`
}

ErrorSchema is a schema from the AsyncAPI specification required in messages Description: Response to a failed call

type ExchangeSchema

type ExchangeSchema string

ExchangeSchema is a schema from the AsyncAPI specification required in messages Description: Exchange name

type ForwardTestIDSchema

type ForwardTestIDSchema string

ForwardTestIDSchema is a schema from the AsyncAPI specification required in messages Description: Targeted forwardtest ID

type ForwardTestSchema

type ForwardTestSchema struct {
	// Description: Targeted forwardtest ID
	Id ForwardTestIDSchema `json:"id"`

	// Description: Date-Time format according to RFC3339
	UpdatedAt DateSchema `json:"updated_at"`
}

ForwardTestSchema is a schema from the AsyncAPI specification required in messages

type ForwardTestStatusSchema

type ForwardTestStatusSchema struct {
	// Description: Current balance of the forwardtest
	Balance float64 `json:"balance"`
}

ForwardTestStatusSchema is a schema from the AsyncAPI specification required in messages Description: Status of a forwardtest

type HeadersFromAccountsListRequestMessage

type HeadersFromAccountsListRequestMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`

	// Description: Channel used to respond to request
	ReplyTo string `json:"replyTo"`
}

HeadersFromAccountsListRequestMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromAccountsListResponseMessage

type HeadersFromAccountsListResponseMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`
}

HeadersFromAccountsListResponseMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromCreateRequestMessage

type HeadersFromCreateRequestMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`

	// Description: Channel used to respond to request
	ReplyTo string `json:"replyTo"`
}

HeadersFromCreateRequestMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromCreateResponseMessage

type HeadersFromCreateResponseMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`
}

HeadersFromCreateResponseMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromListRequestMessage

type HeadersFromListRequestMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`

	// Description: Channel used to respond to request
	ReplyTo string `json:"replyTo"`
}

HeadersFromListRequestMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromListResponseMessage

type HeadersFromListResponseMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`
}

HeadersFromListResponseMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromOrdersCreateRequestMessage

type HeadersFromOrdersCreateRequestMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`

	// Description: Channel used to respond to request
	ReplyTo string `json:"replyTo"`
}

HeadersFromOrdersCreateRequestMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromOrdersCreateResponseMessage

type HeadersFromOrdersCreateResponseMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`
}

HeadersFromOrdersCreateResponseMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromServiceInfoRequestMessage

type HeadersFromServiceInfoRequestMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`

	// Description: Channel used to respond to request
	ReplyTo string `json:"replyTo"`
}

HeadersFromServiceInfoRequestMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromServiceInfoResponseMessage

type HeadersFromServiceInfoResponseMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`
}

HeadersFromServiceInfoResponseMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromStatusRequestMessage

type HeadersFromStatusRequestMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`

	// Description: Channel used to respond to request
	ReplyTo string `json:"replyTo"`
}

HeadersFromStatusRequestMessage is a schema from the AsyncAPI specification required in messages

type HeadersFromStatusResponseMessage

type HeadersFromStatusResponseMessage struct {
	// Description: Correlation ID set by client
	CorrelationId *string `json:"correlationId"`
}

HeadersFromStatusResponseMessage is a schema from the AsyncAPI specification required in messages

type ListRequestMessage

type ListRequestMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromListRequestMessage

	// Payload will be inserted in the message payload
	Payload ListRequestMessagePayload
}

ListRequestMessage is the message expected for 'ListRequestMessage' channel.

func NewListRequestMessage

func NewListRequestMessage() ListRequestMessage

func (ListRequestMessage) CorrelationID

func (msg ListRequestMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*ListRequestMessage) SetAsResponseFrom

func (msg *ListRequestMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*ListRequestMessage) SetCorrelationID

func (msg *ListRequestMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

type ListRequestMessagePayload

type ListRequestMessagePayload struct{}

ListRequestMessagePayload is a schema from the AsyncAPI specification required in messages

type ListResponseMessage

type ListResponseMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromListResponseMessage

	// Payload will be inserted in the message payload
	Payload ListResponseMessagePayload
}

ListResponseMessage is the message expected for 'ListResponseMessage' channel.

func NewListResponseMessage

func NewListResponseMessage() ListResponseMessage

func (ListResponseMessage) CorrelationID

func (msg ListResponseMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*ListResponseMessage) Set

func (msg *ListResponseMessage) Set(payload []forwardtest.ForwardTest)

func (*ListResponseMessage) SetAsResponseFrom

func (msg *ListResponseMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*ListResponseMessage) SetCorrelationID

func (msg *ListResponseMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

func (ListResponseMessage) ToModel

func (msg ListResponseMessage) ToModel() ([]forwardtest.ForwardTest, error)

type ListResponseMessagePayload

type ListResponseMessagePayload struct {
	// Description: Response to a failed call
	Error        *ErrorSchema        `json:"error"`
	Forwardtests []ForwardTestSchema `json:"forwardtests"`
}

ListResponseMessagePayload is a schema from the AsyncAPI specification required in messages

type MessageWithCorrelationID

type MessageWithCorrelationID interface {
	CorrelationID() string
	SetCorrelationID(id string)
}

type OrderSchema

type OrderSchema struct {
	// Description: Exchange name
	Exchange ExchangeSchema `json:"exchange"`

	// Description: Effective time of order execution
	ExecutionTime *DateSchema `json:"execution_time"`

	// Description: Order ID set by the system
	Id *string `json:"id"`

	// Description: Pair symbol
	Pair PairSchema `json:"pair"`

	// Description: Price of the asset that where it should be traded
	Price *float64 `json:"price"`

	// Description: Quantity of the asset that should be traded
	Quantity float64 `json:"quantity"`

	// Description: Side used by an order
	Side OrderSideSchema `json:"side"`

	// Description: Type of an order
	Type OrderTypeSchema `json:"type"`
}

OrderSchema is a schema from the AsyncAPI specification required in messages Description: Order sent to the market

type OrderSideSchema

type OrderSideSchema string

OrderSideSchema is a schema from the AsyncAPI specification required in messages Description: Side used by an order

type OrderTypeSchema

type OrderTypeSchema string

OrderTypeSchema is a schema from the AsyncAPI specification required in messages Description: Type of an order

type OrdersCreateRequestMessage

type OrdersCreateRequestMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromOrdersCreateRequestMessage

	// Payload will be inserted in the message payload
	Payload OrdersCreateRequestMessagePayload
}

OrdersCreateRequestMessage is the message expected for 'OrdersCreateRequestMessage' channel.

func NewOrdersCreateRequestMessage

func NewOrdersCreateRequestMessage() OrdersCreateRequestMessage

func (OrdersCreateRequestMessage) CorrelationID

func (msg OrdersCreateRequestMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*OrdersCreateRequestMessage) Set

func (*OrdersCreateRequestMessage) SetAsResponseFrom

func (msg *OrdersCreateRequestMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*OrdersCreateRequestMessage) SetCorrelationID

func (msg *OrdersCreateRequestMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

func (OrdersCreateRequestMessage) ToModel

func (msg OrdersCreateRequestMessage) ToModel() (order.Order, error)

type OrdersCreateRequestMessagePayload

type OrdersCreateRequestMessagePayload struct {
	// Description: Targeted forwardtest ID
	Id ForwardTestIDSchema `json:"id"`

	// Description: Order sent to the market
	Order OrderSchema `json:"order"`
}

OrdersCreateRequestMessagePayload is a schema from the AsyncAPI specification required in messages

type OrdersCreateResponseMessage

type OrdersCreateResponseMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromOrdersCreateResponseMessage

	// Payload will be inserted in the message payload
	Payload OrdersCreateResponseMessagePayload
}

OrdersCreateResponseMessage is the message expected for 'OrdersCreateResponseMessage' channel.

func NewOrdersCreateResponseMessage

func NewOrdersCreateResponseMessage() OrdersCreateResponseMessage

func (OrdersCreateResponseMessage) CorrelationID

func (msg OrdersCreateResponseMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*OrdersCreateResponseMessage) SetAsResponseFrom

func (msg *OrdersCreateResponseMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*OrdersCreateResponseMessage) SetCorrelationID

func (msg *OrdersCreateResponseMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

type OrdersCreateResponseMessagePayload

type OrdersCreateResponseMessagePayload struct {
	// Description: Response to a failed call
	Error *ErrorSchema `json:"error"`
}

OrdersCreateResponseMessagePayload is a schema from the AsyncAPI specification required in messages

type PairSchema

type PairSchema string

PairSchema is a schema from the AsyncAPI specification required in messages Description: Pair symbol

type PeriodSchema

type PeriodSchema string

PeriodSchema is a schema from the AsyncAPI specification required in messages Description: Period symbol

type ServiceInfoRequestMessage

type ServiceInfoRequestMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromServiceInfoRequestMessage

	// Payload will be inserted in the message payload
	Payload ServiceInfoRequestMessagePayload
}

ServiceInfoRequestMessage is the message expected for 'ServiceInfoRequestMessage' channel.

func NewServiceInfoRequestMessage

func NewServiceInfoRequestMessage() ServiceInfoRequestMessage

func (ServiceInfoRequestMessage) CorrelationID

func (msg ServiceInfoRequestMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*ServiceInfoRequestMessage) SetAsResponseFrom

func (msg *ServiceInfoRequestMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*ServiceInfoRequestMessage) SetCorrelationID

func (msg *ServiceInfoRequestMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

type ServiceInfoRequestMessagePayload

type ServiceInfoRequestMessagePayload struct{}

ServiceInfoRequestMessagePayload is a schema from the AsyncAPI specification required in messages

type ServiceInfoResponseMessage

type ServiceInfoResponseMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromServiceInfoResponseMessage

	// Payload will be inserted in the message payload
	Payload ServiceInfoResponseMessagePayload
}

ServiceInfoResponseMessage is the message expected for 'ServiceInfoResponseMessage' channel.

func NewServiceInfoResponseMessage

func NewServiceInfoResponseMessage() ServiceInfoResponseMessage

func (ServiceInfoResponseMessage) CorrelationID

func (msg ServiceInfoResponseMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*ServiceInfoResponseMessage) SetAsResponseFrom

func (msg *ServiceInfoResponseMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*ServiceInfoResponseMessage) SetCorrelationID

func (msg *ServiceInfoResponseMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

func (ServiceInfoResponseMessage) ToModel

type ServiceInfoResponseMessagePayload

type ServiceInfoResponseMessagePayload struct {
	// Description: Version of the API
	ApiVersion string `json:"apiVersion"`

	// Description: Version of the binary
	BinVersion string `json:"binVersion"`
}

ServiceInfoResponseMessagePayload is a schema from the AsyncAPI specification required in messages

type StatusRequestMessage

type StatusRequestMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromStatusRequestMessage

	// Payload will be inserted in the message payload
	Payload StatusRequestMessagePayload
}

StatusRequestMessage is the message expected for 'StatusRequestMessage' channel.

func NewStatusRequestMessage

func NewStatusRequestMessage() StatusRequestMessage

func (StatusRequestMessage) CorrelationID

func (msg StatusRequestMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*StatusRequestMessage) SetAsResponseFrom

func (msg *StatusRequestMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*StatusRequestMessage) SetCorrelationID

func (msg *StatusRequestMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

type StatusRequestMessagePayload

type StatusRequestMessagePayload struct {
	// Description: Targeted forwardtest ID
	Id ForwardTestIDSchema `json:"id"`
}

StatusRequestMessagePayload is a schema from the AsyncAPI specification required in messages

type StatusResponseMessage

type StatusResponseMessage struct {
	// Headers will be used to fill the message headers
	Headers HeadersFromStatusResponseMessage

	// Payload will be inserted in the message payload
	Payload StatusResponseMessagePayload
}

StatusResponseMessage is the message expected for 'StatusResponseMessage' channel.

func NewStatusResponseMessage

func NewStatusResponseMessage() StatusResponseMessage

func (StatusResponseMessage) CorrelationID

func (msg StatusResponseMessage) CorrelationID() string

CorrelationID will give the correlation ID of the message, based on AsyncAPI spec

func (*StatusResponseMessage) Set

func (msg *StatusResponseMessage) Set(status forwardtest.Status)

func (*StatusResponseMessage) SetAsResponseFrom

func (msg *StatusResponseMessage) SetAsResponseFrom(req MessageWithCorrelationID)

SetAsResponseFrom will correlate the message with the one passed in parameter. It will assign the 'req' message correlation ID to the message correlation ID, both specified in AsyncAPI spec.

func (*StatusResponseMessage) SetCorrelationID

func (msg *StatusResponseMessage) SetCorrelationID(id string)

SetCorrelationID will set the correlation ID of the message, based on AsyncAPI spec

func (StatusResponseMessage) ToModel

type StatusResponseMessagePayload

type StatusResponseMessagePayload struct {
	// Description: Response to a failed call
	Error *ErrorSchema `json:"error"`

	// Description: Status of a forwardtest
	Status *ForwardTestStatusSchema `json:"status"`
}

StatusResponseMessagePayload is a schema from the AsyncAPI specification required in messages

type UserController

type UserController struct {
	// contains filtered or unexported fields
}

UserController is the structure that provides sending capabilities to the developer and and connect the broker with the User

func NewUserController

func NewUserController(bc extensions.BrokerController, options ...ControllerOption) (*UserController, error)

NewUserController links the User to the broker

func (*UserController) Close

func (c *UserController) Close(ctx context.Context)

Close will clean up any existing resources on the controller

func (*UserController) RequestToAccountsListOperation

func (c *UserController) RequestToAccountsListOperation(
	ctx context.Context,
	msg AccountsListRequestMessage,
) (AccountsListResponseMessage, error)

func (*UserController) RequestToCreateOperation

func (c *UserController) RequestToCreateOperation(
	ctx context.Context,
	msg CreateRequestMessage,
) (CreateResponseMessage, error)

func (*UserController) RequestToGetStatusOperation

func (c *UserController) RequestToGetStatusOperation(
	ctx context.Context,
	msg StatusRequestMessage,
) (StatusResponseMessage, error)

func (*UserController) RequestToListOperation

func (c *UserController) RequestToListOperation(
	ctx context.Context,
	msg ListRequestMessage,
) (ListResponseMessage, error)

func (*UserController) RequestToOrdersCreateOperation

func (c *UserController) RequestToOrdersCreateOperation(
	ctx context.Context,
	msg OrdersCreateRequestMessage,
) (OrdersCreateResponseMessage, error)

func (*UserController) RequestToServiceInfoOperation

func (c *UserController) RequestToServiceInfoOperation(
	ctx context.Context,
	msg ServiceInfoRequestMessage,
) (ServiceInfoResponseMessage, error)

func (*UserController) SendToAccountsListOperation

func (c *UserController) SendToAccountsListOperation(
	ctx context.Context,
	msg AccountsListRequestMessage,
) error

SendToAccountsListOperation will send a AccountsListRequest message on AccountsListRequest channel.

NOTE: this won't wait for reply, use the normal version to get the reply or do the catching reply manually. NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*UserController) SendToCreateOperation

func (c *UserController) SendToCreateOperation(
	ctx context.Context,
	msg CreateRequestMessage,
) error

SendToCreateOperation will send a CreateRequest message on CreateRequest channel.

NOTE: this won't wait for reply, use the normal version to get the reply or do the catching reply manually. NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*UserController) SendToGetStatusOperation

func (c *UserController) SendToGetStatusOperation(
	ctx context.Context,
	msg StatusRequestMessage,
) error

SendToGetStatusOperation will send a StatusRequest message on StatusRequest channel.

NOTE: this won't wait for reply, use the normal version to get the reply or do the catching reply manually. NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*UserController) SendToListOperation

func (c *UserController) SendToListOperation(
	ctx context.Context,
	msg ListRequestMessage,
) error

SendToListOperation will send a ListRequest message on ListRequest channel.

NOTE: this won't wait for reply, use the normal version to get the reply or do the catching reply manually. NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*UserController) SendToOrdersCreateOperation

func (c *UserController) SendToOrdersCreateOperation(
	ctx context.Context,
	msg OrdersCreateRequestMessage,
) error

SendToOrdersCreateOperation will send a OrdersCreateRequest message on OrdersCreateRequest channel.

NOTE: this won't wait for reply, use the normal version to get the reply or do the catching reply manually. NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

func (*UserController) SendToServiceInfoOperation

func (c *UserController) SendToServiceInfoOperation(
	ctx context.Context,
	msg ServiceInfoRequestMessage,
) error

SendToServiceInfoOperation will send a ServiceInfoRequest message on ServiceInfoRequest channel.

NOTE: this won't wait for reply, use the normal version to get the reply or do the catching reply manually. NOTE: for now, this only support the first message from AsyncAPI list. If you need support for other messages, please raise an issue.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL