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 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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
⌂ 换网址