ThriweComms

package module
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2022 License: MIT Imports: 12 Imported by: 0

README

ThriweComms

Screenshot

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQueueURL

GetQueueURL gets the URL of an Amazon SQS queue. Inputs:

c is the context of the method call, which includes the AWS Region.
api is the interface that defines the method call.
input defines the input arguments to the service call.

Output:

If success, a GetQueueUrlOutput object containing the result of the service call and nil.
Otherwise, nil and an error from the call to GetQueueUrl.

func SendMsg

SendMsg sends a message to an Amazon SQS queue. Inputs:

c is the context of the method call, which includes the AWS Region.
api is the interface that defines the method call.
input defines the input arguments to the service call.

Output:

If success, a SendMessageOutput object containing the result of the service call and nil.
Otherwise, nil and an error from the call to SendMessage.

Types

type SQSSendMessageAPI

type SQSSendMessageAPI interface {
	GetQueueUrl(ctx context.Context,
		params *sqs.GetQueueUrlInput,
		optFns ...func(*sqs.Options)) (*sqs.GetQueueUrlOutput, error)

	SendMessage(ctx context.Context,
		params *sqs.SendMessageInput,
		optFns ...func(*sqs.Options)) (*sqs.SendMessageOutput, error)
}

SQSSendMessageAPI defines the interface for the GetQueueUrl and SendMessage functions. We use this interface to test the functions using a mocked service.

type ThriweCommsAPI

type ThriweCommsAPI interface {
	SendMail(c echo.Context, recipientEmail, recipientName, emailMessageBody, emailSubject, requestId string) (string, error)
	SendSms(c echo.Context, countryCode, mobileNumber, smsMessageBody, requestId string) (string, error)
}

ThriweCommsAPI defines the interface for the SendMail and SendSms functions.

func NewThriweCommsClient

func NewThriweCommsClient(client *sqs.Client, projectCode, sqsQueueName string) ThriweCommsAPI

NewThriweCommsAPI creates a new object for ThriweCommsAPI just pass-in the aws.config, projectCode()

type TrackerRequestType

type TrackerRequestType struct {
	MessageBody string `json:"messageBody"`
	RequestId   string `json:"requestId"`
	Status      string `json:"status"`
	CommsId     string `json:"commsId"`
	ProjectCode string `json:"projectCode"`
}

type TrackerResponseType

type TrackerResponseType struct {
	ObjectId  string    `json:"objectId"`
	CreatedAt time.Time `json:"createdAt"`
}

Jump to

Keyboard shortcuts

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