injectionapi

package
Version: v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: MIT Imports: 11 Imported by: 57

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddressResult

type AddressResult struct {

	// The recipient's email address.
	EmailAddress string

	// Whether the recipient was accepted for delivery.
	Accepted bool

	// An error code detailing why the recipient was not accepted.
	ErrorCode string
}

AddressResult The result of a single recipient in the Injection request.

type ISocketlabsClient

type ISocketlabsClient interface {

	// SendBasic sends a basic email message and returns the response from the Injection API.
	SendBasic(message *message.BasicMessage) (SendResponse, error)

	// SendBulk sends a bulk email message and returns the response from the Injection API.
	SendBulk(message *message.BulkMessage) (SendResponse, error)

	// SetEndpointURL sets the API endpoint. Under normal circumstances this should not be used.
	SetEndpointURL(endpointURL string)

	// SetProxyUrl sets the proxy url.
	SetProxyURL(proxyURL string)

	// GetEndpointURL retreives the API endpoint.
	GetEndpointURL() string
}

ISocketlabsClient is used to easily send messages through the Socketlabs Injection API

func CreateClient

func CreateClient(serverID int, apiKey string) ISocketlabsClient

CreateClient instatiates new client using the specified credentials

func CreateClientWithProxy

func CreateClientWithProxy(serverID int, apiKey string, proxyURL string) ISocketlabsClient

CreateClientWithProxy instatiates new client using the specified credentials

type SendResponse

type SendResponse struct {
	Result             SendResult
	TransactionReceipt string
	ResponseMessage    string
	AddressResults     []AddressResult
}

SendResponse The response of an SocketLabsClient send request.

type SendResult

type SendResult int

SendResult SendResult enum

const (
	//SendResultUNKNOWNERROR - An error has occured that was unforeseen
	SendResultUNKNOWNERROR SendResult = iota

	//SendResultTIMEOUT - A timeout occurred sending the message
	SendResultTIMEOUT

	//SendResultSUCCESS - Successful send of message
	SendResultSUCCESS

	//SendResultWARNING - Warnings were found while sending the message
	SendResultWARNING

	//SendResultINTERNALERROR - Internal server error
	SendResultINTERNALERROR

	//SendResultMESSAGETOOLARGE - Message size has exceeded the size limit
	SendResultMESSAGETOOLARGE

	//SendResultTOOMANYRECIPIENTS - Message exceeded maximum recipient count in the message
	SendResultTOOMANYRECIPIENTS

	//SendResultINVALIDDATA - Invalid data was found on the message
	SendResultINVALIDDATA

	//SendResultOVERQUOTA - The account is over the send quota rate limit exceeded
	SendResultOVERQUOTA

	//SendResultTOOMANYERRORS - Too many errors occurred sending the message
	SendResultTOOMANYERRORS

	//SendResultINVALIDAUTHENTICATION - The ServerId/ApiKey combination is invalid
	SendResultINVALIDAUTHENTICATION

	//SendResultACCOUNTDISABLED - The account has been disabled
	SendResultACCOUNTDISABLED

	//SendResultTOOMANYMESSAGES - Too many messages were found in the request
	SendResultTOOMANYMESSAGES

	//SendResultNOVALIDRECIPIENTS - No valid recipients were found in the message
	SendResultNOVALIDRECIPIENTS

	//SendResultINVALIDADDRESS - An invalid recipient were found on the message
	SendResultINVALIDADDRESS

	//SendResultINVALIDATTACHMENT - An invalid attachment were found on the message
	SendResultINVALIDATTACHMENT

	//SendResultNOMESSAGES - No message body was found in the message
	SendResultNOMESSAGES

	//SendResultEMPTYMESSAGE - No message body was found in the message
	SendResultEMPTYMESSAGE

	//SendResultEMPTYSUBJECT - No subject was found in the message
	SendResultEMPTYSUBJECT

	//SendResultINVALIDFROM - An invalid from address was found on the message
	SendResultINVALIDFROM

	//SendResultEMPTYTOADDRESS - No To addresses were found in the message
	SendResultEMPTYTOADDRESS

	//SendResultNOVALIDBODYPARTS - No valid message body was found in the message
	SendResultNOVALIDBODYPARTS

	//SendResultINVALIDTEMPLATEID - An invalid TemplateId was found in the message
	SendResultINVALIDTEMPLATEID

	//SendResultTEMPLATEHASNOCONTENT - The specified TemplateId has no content for the message
	SendResultTEMPLATEHASNOCONTENT

	//SendResultMESSAGEBODYCONFLICT - A conflict occurred on the message body of the message
	SendResultMESSAGEBODYCONFLICT

	//SendResultINVALIDMERGEDATA - Invalid MergeData was found on the message
	SendResultINVALIDMERGEDATA

	//SendResultAUTHENTICATIONVALIDATIONFAILED - Authentication Error Missing or invalid ServerId or ApiKey
	SendResultAUTHENTICATIONVALIDATIONFAILED

	//SendResultEMAILADDRESSVALIDATIONMISSINGFROM - From email address is missing in the message
	SendResultEMAILADDRESSVALIDATIONMISSINGFROM

	//SendResultEMAILADDRESSVALIDATIONINVALIDFROM - From email address in the message in invalid
	SendResultEMAILADDRESSVALIDATIONINVALIDFROM

	//SendResultRECIPIENTVALIDATIONMAXEXCEEDED - Message exceeded maximum recipient count in the message
	SendResultRECIPIENTVALIDATIONMAXEXCEEDED

	//SendResultRECIPIENTVALIDATIONNONEINMESSAGE - No recipients were found in the message
	SendResultRECIPIENTVALIDATIONNONEINMESSAGE

	//SendResultRECIPIENTVALIDATIONMISSINGTO - To addresses are missing in the message
	SendResultRECIPIENTVALIDATIONMISSINGTO

	//SendResultRECIPIENTVALIDATIONINVALIDREPLYTO - Invalid ReplyTo address found
	SendResultRECIPIENTVALIDATIONINVALIDREPLYTO

	//SendResultRECIPIENTVALIDATIONINVALIDRECIPIENTS - Invalid recipients found
	SendResultRECIPIENTVALIDATIONINVALIDRECIPIENTS

	//SendResultMESSAGEVALIDATIONEMPTYSUBJECT - No subject was found in the message
	SendResultMESSAGEVALIDATIONEMPTYSUBJECT

	//SendResultMESSAGEVALIDATIONEMPTYMESSAGE - No message body was found in the message
	SendResultMESSAGEVALIDATIONEMPTYMESSAGE

	//SendResultMESSAGEVALIDATIONINVALIDCUSTOMHEADERS -  Invalid custom headers found
	SendResultMESSAGEVALIDATIONINVALIDCUSTOMHEADERS
)

func (SendResult) Parse

func (sendResult SendResult) Parse(arg string) SendResult

Parse Find the enumvalue of a string

func (SendResult) ToResponseMessage

func (sendResult SendResult) ToResponseMessage() string

ToResponseMessage Get the appropraite descriptive ResponseMessage for a given SendResult

func (SendResult) ToString

func (sendResult SendResult) ToString() string

ToString Get the string version of the enum

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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