messaging

package
v0.0.0-...-57c6170 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// command name.
	CommandName = "messaging"

	// command methods.
	RegisteredServicesCommandMethod         = "Services"
	RegisterMessageServiceCommandMethod     = "RegisterService"
	UnregisterMessageServiceCommandMethod   = "UnregisterService"
	RegisterHTTPMessageServiceCommandMethod = "RegisterHTTPService"
	SendNewMessageCommandMethod             = "Send"
	SendReplyMessageCommandMethod           = "Reply"
)

constants for the Messaging controller.

View Source
const (
	// InvalidRequestErrorCode is typically a code for invalid requests.
	InvalidRequestErrorCode = command.Code(iota + command.Messaging)

	// RegisterMsgSvcError is for failures while registering new message service.
	RegisterMsgSvcError

	// UnregisterMsgSvcError is for failures while unregistering a message service.
	UnregisterMsgSvcError

	// SendMsgError is for failures while sending messages.
	SendMsgError

	// SendMsgReplyError is for failures while sending message replies.
	SendMsgReplyError
)

Error codes.

Variables

This section is empty.

Functions

This section is empty.

Types

type AwaitReply

type AwaitReply struct {
	// ReplyMessageType message type of incoming reply
	ReplyMessageType string `json:"messageType,omitempty"`
	// Timeout (in milliseconds) waiting for reply
	Timeout time.Duration `json:"timeout,omitempty"`
}

AwaitReply contains await for reply parameters.

type Command

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

Command contains basic command operations provided by messaging controller command.

func New

func New(ctx provider, registrar command.MessageHandler, notifier command.Notifier) (*Command, error)

New returns new command instance for messaging controller API.

func (*Command) GetHandlers

func (o *Command) GetHandlers() []command.Handler

GetHandlers returns list of all commands supported by this controller command.

func (*Command) RegisterHTTPService

func (o *Command) RegisterHTTPService(rw io.Writer, req io.Reader) command.Error

RegisterHTTPService registers new http over didcomm service to message handler registrar.

func (*Command) RegisterService

func (o *Command) RegisterService(rw io.Writer, req io.Reader) command.Error

RegisterService registers new message service to message handler registrar.

func (*Command) Reply

func (o *Command) Reply(rw io.Writer, req io.Reader) command.Error

Reply sends reply to existing message.

func (*Command) Send

func (o *Command) Send(rw io.Writer, req io.Reader) command.Error

Send sends new message to destination provided.

func (*Command) Services

func (o *Command) Services(rw io.Writer, req io.Reader) command.Error

Services returns list of registered service names.

func (*Command) UnregisterService

func (o *Command) UnregisterService(rw io.Writer, req io.Reader) command.Error

UnregisterService unregisters given message service handler registrar.

type RegisterHTTPMsgSvcArgs

type RegisterHTTPMsgSvcArgs struct {
	// Name of the HTTP over DIDComm message service
	Name string `json:"name"`

	// Acceptance criteria for http over did comm message service based on message purpose.
	// In case of multiple purposes, operation will follow `A tagging system` purpose field validation from RFC-0351
	// If not provided then all incoming messages of HTTP over DIDComm type will be handled by operation.
	Purpose []string `json:"purpose"`
}

RegisterHTTPMsgSvcArgs contains parameters for registering an HTTP over DIDComm message service to message handler.

type RegisterMsgSvcArgs

type RegisterMsgSvcArgs struct {
	// Name of the message service
	Name string `json:"name"`

	// Acceptance criteria for message service based on message purpose
	// in case of multiple purposes, message will be dispatched if any one of the purpose matches
	// with the purpose of incoming message.
	// Can be provided in conjunction with other acceptance criteria.
	Purpose []string `json:"purpose"`

	// Acceptance criteria for message service based on message type.
	// Can be provided in conjunction with other acceptance criteria.
	Type string `json:"type"`
}

RegisterMsgSvcArgs contains parameters for registering a message service to message handler.

type RegisteredServicesResponse

type RegisteredServicesResponse struct {
	// Registered service names
	Names []string `json:"names"`
}

RegisteredServicesResponse is for returning list of registered service names.

type SendMessageResponse

type SendMessageResponse struct {
	// Response will contain raw message reply content if AwaitReply is used in send message request.
	Response json.RawMessage `json:"response,omitempty"`
}

SendMessageResponse is response for send/reply message feature.

type SendNewMessageArgs

type SendNewMessageArgs struct {

	// Connection ID of the message destination
	// This parameter takes precedence over all the other destination parameters.
	ConnectionID string `json:"connection_ID,omitempty"`

	// DID of the destination.
	// This parameter takes precedence over `ServiceEndpoint` destination parameter.
	TheirDID string `json:"their_did,omitempty"`

	// ServiceEndpointDestination service endpoint destination.
	// This param can be used to send messages outside connection.
	ServiceEndpointDestination *ServiceEndpointDestinationParams `json:"service_endpoint,omitempty"`

	// Message body of the message
	MessageBody json.RawMessage `json:"message_body"`

	// Await reply from receiver of this message
	// If provided, then send message feature will wait response of this type for same thread
	AwaitReply AwaitReply `json:"await_reply"`
}

SendNewMessageArgs contains parameters for sending new message with one of three destination options below,

  1. ConnectionID - ID of the connection between sender and receiver of this message.
  2. TheirDID - TheirDID of the DID exchange connection record between sender and receiver of this message.
  3. ServiceEndpoint (With recipient Keys, endpoint and optional routing keys) - To Send message outside connection.

Note: Precedence logic when multiple destination options are provided are according to above order.

type SendReplyMessageArgs

type SendReplyMessageArgs struct {
	// ID of the message replying to
	MessageID string `json:"message_ID"`

	// Message body of the reply message
	MessageBody json.RawMessage `json:"message_body"`

	// StartNewThread if provided, replies to message by starting a new thread.
	StartNewThread bool `json:"start_new_thread"`

	// Await reply from receiver of this message
	// If provided, then reply message feature will wait response of this type for same thread
	AwaitReply AwaitReply `json:"await_reply"`
}

SendReplyMessageArgs contains parameters for sending message reply.

type ServiceEndpointDestinationParams

type ServiceEndpointDestinationParams struct {
	// Recipient keys of service endpoint
	RecipientKeys []string `json:"recipientKeys,omitempty"`

	// Service endpoint
	ServiceEndpoint string `json:"serviceEndpoint,omitempty"`

	// Routing Keys of service endpoint
	RoutingKeys []string `json:"routingKeys,omitempty"`
}

ServiceEndpointDestinationParams contains service endpoint params.

type UnregisterMsgSvcArgs

type UnregisterMsgSvcArgs struct {
	// Name of the message service to be unregistered
	// required: true
	Name string `json:"name"`
}

UnregisterMsgSvcArgs contains parameters for unregistering a message service from message handler.

Jump to

Keyboard shortcuts

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