models

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const MinDeliveryWindow = 60
View Source
const MinsPerHour = 60

Variables

This section is empty.

Functions

func MMSHeadValidation added in v1.1.0

func MMSHeadValidation(sl validator.StructLevel)

func SetupValidation

func SetupValidation()

SetupValidation configures struct-level validations for all payload models. This method must be called in order for validation to work, and it is invoked automatically when models are imported.

Types

type AudioContent

type AudioContent struct {
	MediaURL string `json:"mediaUrl" validate:"required,url,lte=2048"`
}

type AudioMsg

type AudioMsg struct {
	MsgCommon
	Content AudioContent `json:"content" validate:"required"`
}

func (*AudioMsg) Marshal added in v1.1.0

func (t *AudioMsg) Marshal() (*bytes.Buffer, error)

func (*AudioMsg) Validate

func (t *AudioMsg) Validate() error

type BulkMsgResponse

type BulkMsgResponse struct {
	Messages []MsgResponse `json:"messages"`
	BulkID   string        `json:"bulkId"`
}

type Contact

type Contact struct {
	Addresses []ContactAddress `json:"addresses,omitempty" validate:"omitempty,dive"`
	Birthday  string           `json:"birthday,omitempty"`
	Emails    []ContactEmail   `json:"emails,omitempty" validate:"omitempty,dive"`
	Name      ContactName      `json:"name" validate:"required"`
	Org       ContactOrg       `json:"org,omitempty"`
	Phones    []ContactPhone   `json:"phones,omitempty" validate:"omitempty,dive"`
	Urls      []ContactURL     `json:"urls,omitempty" validate:"omitempty,dive"`
}

type ContactAddress

type ContactAddress struct {
	Street      string `json:"street,omitempty"`
	City        string `json:"city,omitempty"`
	State       string `json:"state,omitempty"`
	Zip         string `json:"zip,omitempty"`
	Country     string `json:"country,omitempty"`
	CountryCode string `json:"countryCode,omitempty"`
	Type        string `json:"type,omitempty" validate:"omitempty,oneof=HOME WORK"`
}

type ContactContent

type ContactContent struct {
	Contacts []Contact `json:"contacts" validate:"required,dive"`
}

type ContactEmail

type ContactEmail struct {
	Email string `json:"email,omitempty" validate:"omitempty,email"`
	Type  string `json:"type,omitempty" validate:"omitempty,oneof=HOME WORK"`
}

type ContactMsg

type ContactMsg struct {
	MsgCommon
	Content ContactContent `json:"content" validate:"required"`
}

func (*ContactMsg) Marshal added in v1.1.0

func (t *ContactMsg) Marshal() (*bytes.Buffer, error)

func (*ContactMsg) Validate

func (t *ContactMsg) Validate() error

type ContactName

type ContactName struct {
	FirstName     string `json:"firstName" validate:"required"`
	LastName      string `json:"lastName,omitempty"`
	MiddleName    string `json:"middleName,omitempty"`
	NameSuffix    string `json:"nameSuffix,omitempty"`
	NamePrefix    string `json:"namePrefix,omitempty"`
	FormattedName string `json:"formattedName" validate:"required"`
}

type ContactOrg

type ContactOrg struct {
	Company    string `json:"company,omitempty"`
	Department string `json:"department,omitempty"`
	Title      string `json:"title,omitempty"`
}

type ContactPhone

type ContactPhone struct {
	Phone string `json:"phone,omitempty"`
	Type  string `json:"type,omitempty" validate:"omitempty,oneof=CELL MAIN IPHONE HOME WORK"`
	WaID  string `json:"waId,omitempty"`
}

type ContactURL

type ContactURL struct {
	URL  string `json:"url,omitempty" validate:"omitempty,url"`
	Type string `json:"type,omitempty" validate:"omitempty,oneof=HOME WORK"`
}

type DeliveryTimeWindow added in v1.1.0

type DeliveryTimeWindow struct {
	Days []string `json:"days" validate:"required,gte=1,dive,oneof=MONDAY TUESDAY WEDNESDAY THURSDAY FRIDAY SATURDAY SUNDAY"` // nolint: lll
	From *MMSTime `json:"from,omitempty"`
	To   *MMSTime `json:"to,omitempty"`
}

type DocumentContent

type DocumentContent struct {
	MediaURL string `json:"mediaUrl" validate:"required,url,lte=2048"`
	Caption  string `json:"caption,omitempty" validate:"lte=3000"`
	Filename string `json:"filename,omitempty" validate:"lte=240"`
}

type DocumentMsg

type DocumentMsg struct {
	MsgCommon
	Content DocumentContent `json:"content" validate:"required"`
}

func (*DocumentMsg) Marshal added in v1.1.0

func (t *DocumentMsg) Marshal() (*bytes.Buffer, error)

func (*DocumentMsg) Validate

func (t *DocumentMsg) Validate() error

type EmailDeliveryReportsResponse added in v1.2.0

type EmailDeliveryReportsResponse struct {
	Results []struct {
		BulkID       string `json:"bulkId"`
		MessageID    string `json:"messageId"`
		To           string `json:"to"`
		SentAt       string `json:"sentAt"`
		DoneAt       string `json:"doneAt"`
		MessageCount int    `json:"messageCount"`
		Price        struct {
			PricePerMessage float64 `json:"pricePerMessage"`
			Currency        string  `json:"currency"`
		} `json:"price"`
		Status struct {
			GroupID     int    `json:"groupId"`
			GroupName   string `json:"groupName"`
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
			Action      string `json:"action"`
		} `json:"status"`
		Error struct {
			GroupID     int    `json:"groupId"`
			GroupName   string `json:"groupName"`
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
			Permanent   bool   `json:"permanent"`
		} `json:"error"`
		Channel string `json:"channel"`
	} `json:"results"`
}

type EmailLogsResponse added in v1.2.0

type EmailLogsResponse struct {
	Results []struct {
		MessageID    string `json:"messageId"`
		To           string `json:"to"`
		From         string `json:"from"`
		Text         string `json:"text"`
		SentAt       string `json:"sentAt"`
		DoneAt       string `json:"doneAt"`
		MessageCount int    `json:"messageCount"`
		Price        struct {
			PricePerMessage float64 `json:"pricePerMessage"`
			Currency        string  `json:"currency"`
		} `json:"price"`
		Status struct {
			GroupID     int    `json:"groupId"`
			GroupName   string `json:"groupName"`
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
			Action      string `json:"action"`
		} `json:"status"`
		BulkID  string `json:"bulkId"`
		Channel string `json:"channel"`
	} `json:"results"`
}

type EmailMsg added in v1.2.0

type EmailMsg struct {
	From                    string `validate:"required"`
	To                      string `validate:"required"`
	Cc                      string
	Bcc                     string
	Subject                 string `validate:"required"`
	Text                    string
	BulkID                  string
	MessageID               string
	TemplateID              int
	Attachment              *os.File
	InlineImage             *os.File
	HTML                    string
	ReplyTo                 string
	DefaultPlaceholders     string
	PreserveRecipients      bool
	TrackingURL             string `validate:"omitempty,url"`
	TrackClicks             bool
	TrackOpens              bool
	Track                   bool
	CallbackData            string
	IntermediateReport      bool
	NotifyURL               string `validate:"omitempty,url"`
	NotifyContentType       string
	SendAt                  string
	LandingPagePlaceholders string
	LandingPageID           string
	// contains filtered or unexported fields
}

func GenerateEmailMsg added in v1.2.0

func GenerateEmailMsg() EmailMsg

func (*EmailMsg) GetMultipartBoundary added in v1.2.0

func (e *EmailMsg) GetMultipartBoundary() string

func (*EmailMsg) Marshal added in v1.2.0

func (e *EmailMsg) Marshal() (*bytes.Buffer, error)

func (*EmailMsg) Validate added in v1.2.0

func (e *EmailMsg) Validate() error

type ErrorDetails

type ErrorDetails struct {
	RequestError RequestError `json:"requestError"`
}

type ExternallyHostedMedia added in v1.1.0

type ExternallyHostedMedia struct {
	ContentType string `json:"contentType" validate:"required"`
	ContentID   string `json:"contentId" validate:"required"`
	ContentURL  string `json:"contentUrl" validate:"url,required"`
}

type GetDeliveryReportsOpts added in v1.2.0

type GetDeliveryReportsOpts struct {
	BulkID    string
	MessageID string
	Limit     string
}

func (*GetDeliveryReportsOpts) Validate added in v1.2.0

func (o *GetDeliveryReportsOpts) Validate() error

type GetLogsOpts added in v1.2.0

type GetLogsOpts struct {
	MessageID     string
	From          string
	To            string
	BulkID        string
	GeneralStatus string
	SentSince     string
	SentUntil     string
	Limit         string
}

func (*GetLogsOpts) Validate added in v1.2.0

func (o *GetLogsOpts) Validate() error

type GetSentBulksOpts added in v1.2.0

type GetSentBulksOpts struct {
	BulkID string `validate:"required"`
}

func (*GetSentBulksOpts) Validate added in v1.2.0

func (o *GetSentBulksOpts) Validate() error

type GetSentBulksStatusOpts added in v1.2.0

type GetSentBulksStatusOpts struct {
	BulkID string `validate:"required"`
}

func (*GetSentBulksStatusOpts) Validate added in v1.2.0

func (o *GetSentBulksStatusOpts) Validate() error

type ImageContent

type ImageContent struct {
	MediaURL string `json:"mediaUrl" validate:"required,url,lte=2048"`
	Caption  string `json:"caption,omitempty" validate:"lte=3000"`
}

type ImageMsg

type ImageMsg struct {
	MsgCommon
	Content ImageContent `json:"content" validate:"required"`
}

func (*ImageMsg) Marshal added in v1.1.0

func (t *ImageMsg) Marshal() (*bytes.Buffer, error)

func (*ImageMsg) Validate

func (t *ImageMsg) Validate() error

type InboundMMSOpts added in v1.1.0

type InboundMMSOpts struct {
	Limit string
}

type InboundMMSResponse added in v1.1.0

type InboundMMSResponse struct {
	Results []InboundMMSResult `json:"results"`
}

type InboundMMSResult added in v1.1.0

type InboundMMSResult struct {
	MessageID    string   `json:"messageId"`
	To           string   `json:"to"`
	From         string   `json:"from"`
	Message      string   `json:"message"`
	ReceivedAt   string   `json:"receivedAt"`
	MMSCount     int32    `json:"mmsCount"`
	CallbackData string   `json:"callbackData"`
	Price        MMSPrice `json:"price"`
}

type InteractiveButton

type InteractiveButton struct {
	Type  string `json:"type" validate:"required,oneof=REPLY"`
	ID    string `json:"id" validate:"required,lte=256"`
	Title string `json:"title" validate:"required,lte=20"`
}

type InteractiveButtons

type InteractiveButtons struct {
	Buttons []InteractiveButton `json:"buttons" validate:"required,min=1,max=3,dive"`
}

type InteractiveButtonsBody

type InteractiveButtonsBody struct {
	Text string `json:"text" validate:"required,lte=1024"`
}

type InteractiveButtonsContent

type InteractiveButtonsContent struct {
	Body   InteractiveButtonsBody    `json:"body" validate:"required"`
	Action InteractiveButtons        `json:"action" validate:"required"`
	Header *InteractiveButtonsHeader `json:"header,omitempty" validate:"omitempty"`
	Footer *InteractiveButtonsFooter `json:"footer,omitempty"`
}

type InteractiveButtonsFooter

type InteractiveButtonsFooter struct {
	Text string `json:"text" validate:"required,lte=60"`
}

type InteractiveButtonsHeader

type InteractiveButtonsHeader struct {
	Type     string `json:"type" validate:"required,oneof=TEXT VIDEO IMAGE DOCUMENT"`
	Text     string `json:"text,omitempty" validate:"lte=60"`
	MediaURL string `json:"mediaUrl,omitempty" validate:"omitempty,url,lte=2048"`
	Filename string `json:"filename,omitempty" validate:"lte=240"`
}

type InteractiveButtonsMsg

type InteractiveButtonsMsg struct {
	MsgCommon
	Content InteractiveButtonsContent `json:"content" validate:"required"`
}

func (*InteractiveButtonsMsg) Marshal added in v1.1.0

func (t *InteractiveButtonsMsg) Marshal() (*bytes.Buffer, error)

func (*InteractiveButtonsMsg) Validate

func (t *InteractiveButtonsMsg) Validate() error

type InteractiveListAction

type InteractiveListAction struct {
	Title    string                   `json:"title" validate:"required,lte=20"`
	Sections []InteractiveListSection `json:"sections" validate:"required,min=1,max=10,dive"`
}

type InteractiveListBody

type InteractiveListBody struct {
	Text string `json:"text" validate:"required,lte=1024"`
}

type InteractiveListContent

type InteractiveListContent struct {
	Body   InteractiveListBody    `json:"body" validate:"required"`
	Action InteractiveListAction  `json:"action" validate:"required"`
	Header *InteractiveListHeader `json:"header,omitempty" validate:"omitempty"`
	Footer *InteractiveListFooter `json:"footer,omitempty"`
}

type InteractiveListFooter

type InteractiveListFooter struct {
	Text string `json:"text" validate:"required,lte=60"`
}

type InteractiveListHeader

type InteractiveListHeader struct {
	Type string `json:"type" validate:"required,oneof=TEXT"`
	Text string `json:"text" validate:"required,lte=60"`
}

type InteractiveListMsg

type InteractiveListMsg struct {
	MsgCommon
	Content InteractiveListContent `json:"content" validate:"required"`
}

func (*InteractiveListMsg) Marshal added in v1.1.0

func (t *InteractiveListMsg) Marshal() (*bytes.Buffer, error)

func (*InteractiveListMsg) Validate

func (t *InteractiveListMsg) Validate() error

type InteractiveListSection

type InteractiveListSection struct {
	Title string       `json:"title,omitempty" validate:"lte=24"`
	Rows  []SectionRow `json:"rows" validate:"required,min=1,max=10,dive"`
}

type InteractiveMultiproductAction

type InteractiveMultiproductAction struct {
	CatalogID string                           `json:"catalogId" validate:"required"`
	Sections  []InteractiveMultiproductSection `json:"sections" validate:"required,min=1,max=10,dive"`
}

type InteractiveMultiproductBody

type InteractiveMultiproductBody struct {
	Text string `json:"text" validate:"required,lte=1024"`
}

type InteractiveMultiproductContent

type InteractiveMultiproductContent struct {
	Header InteractiveMultiproductHeader  `json:"header" validate:"required"`
	Body   InteractiveMultiproductBody    `json:"body" validate:"required"`
	Action InteractiveMultiproductAction  `json:"action" validate:"required"`
	Footer *InteractiveMultiproductFooter `json:"footer,omitempty"`
}

type InteractiveMultiproductFooter

type InteractiveMultiproductFooter struct {
	Text string `json:"text" validate:"required,lte=60"`
}

type InteractiveMultiproductHeader

type InteractiveMultiproductHeader struct {
	Type string `json:"type" validate:"required,oneof=TEXT"`
	Text string `json:"text" validate:"required,lte=60"`
}

type InteractiveMultiproductMsg

type InteractiveMultiproductMsg struct {
	MsgCommon
	Content InteractiveMultiproductContent `json:"content" validate:"required"`
}

func (*InteractiveMultiproductMsg) Marshal added in v1.1.0

func (t *InteractiveMultiproductMsg) Marshal() (*bytes.Buffer, error)

func (*InteractiveMultiproductMsg) Validate

func (t *InteractiveMultiproductMsg) Validate() error

type InteractiveMultiproductSection

type InteractiveMultiproductSection struct {
	Title              string   `json:"title,omitempty" validate:"lte=24"`
	ProductRetailerIDs []string `json:"productRetailerIds" validate:"required,min=1"`
}

type InteractiveProductAction

type InteractiveProductAction struct {
	CatalogID         string `json:"catalogId" validate:"required"`
	ProductRetailerID string `json:"productRetailerId" validate:"required"`
}

type InteractiveProductBody

type InteractiveProductBody struct {
	Text string `json:"text" validate:"required,lte=1024"`
}

type InteractiveProductContent

type InteractiveProductContent struct {
	Action InteractiveProductAction  `json:"action" validate:"required"`
	Body   *InteractiveProductBody   `json:"body,omitempty"`
	Footer *InteractiveProductFooter `json:"footer,omitempty"`
}

type InteractiveProductFooter

type InteractiveProductFooter struct {
	Text string `json:"text" validate:"required,lte=60"`
}

type InteractiveProductMsg

type InteractiveProductMsg struct {
	MsgCommon
	Content InteractiveProductContent `json:"content" validate:"required"`
}

func (*InteractiveProductMsg) Marshal added in v1.1.0

func (t *InteractiveProductMsg) Marshal() (*bytes.Buffer, error)

func (*InteractiveProductMsg) Validate

func (t *InteractiveProductMsg) Validate() error

type LocationContent

type LocationContent struct {
	Latitude  *float32 `json:"latitude" validate:"required,latitude"`
	Longitude *float32 `json:"longitude" validate:"required,longitude"`
	Name      string   `json:"name" validate:"lte=1000"`
	Address   string   `json:"address" validate:"lte=1000"`
}

type LocationMsg

type LocationMsg struct {
	MsgCommon
	Content LocationContent `json:"content" validate:"required"`
}

func (*LocationMsg) Marshal added in v1.1.0

func (t *LocationMsg) Marshal() (*bytes.Buffer, error)

func (*LocationMsg) Validate

func (t *LocationMsg) Validate() error

type MMSHead added in v1.1.0

type MMSHead struct {
	From                  string              `json:"from" validate:"required"`
	To                    string              `json:"to" validate:"required"`
	ID                    string              `json:"id,omitempty"`
	Subject               string              `json:"subject,omitempty"`
	ValidityPeriodMinutes int32               `json:"validityPeriodMinutes,omitempty"`
	CallbackData          string              `json:"callbackData,omitempty" validate:"lte=200"`
	NotifyURL             string              `json:"notifyUrl,omitempty" validate:"omitempty,url"`
	SendAt                string              `json:"sendAt,omitempty"`
	IntermediateReport    *bool               `json:"intermediateReport,omitempty"`
	DeliveryTimeWindow    *DeliveryTimeWindow `json:"deliveryTimeWindow,omitempty"`
}

type MMSMsg added in v1.1.0

type MMSMsg struct {
	Head                  MMSHead `validate:"required"`
	Text                  string
	Media                 *os.File
	ExternallyHostedMedia []ExternallyHostedMedia `validate:"dive"`
	SMIL                  string
	// contains filtered or unexported fields
}

func (*MMSMsg) GetMultipartBoundary added in v1.1.0

func (t *MMSMsg) GetMultipartBoundary() string

func (*MMSMsg) Marshal added in v1.1.0

func (t *MMSMsg) Marshal() (*bytes.Buffer, error)

func (*MMSMsg) Validate added in v1.1.0

func (t *MMSMsg) Validate() error

type MMSPrice added in v1.1.0

type MMSPrice struct {
	PricePerMessage int    `json:"pricePerMessage"`
	Currency        string `json:"currency"`
}

type MMSResponse added in v1.1.0

type MMSResponse struct {
	BulkID       string    `json:"bulkId"`
	Messages     []SentMMS `json:"messages"`
	ErrorMessage string    `json:"errorMessage"`
}

type MMSStatus added in v1.1.0

type MMSStatus struct {
	GroupID     int32  `json:"groupId"`
	GroupName   string `json:"groupName"`
	ID          int32  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
}

type MMSTime added in v1.1.0

type MMSTime struct {
	Hour   int32 `json:"hour" validate:"lte=23"`
	Minute int32 `json:"minute" validate:"lte=59"`
}

type MsgCommon

type MsgCommon struct {
	From         string `json:"from" validate:"required,lte=24"`
	To           string `json:"to" validate:"required,lte=24"`
	MessageID    string `json:"messageId,omitempty" validate:"lte=50"`
	CallbackData string `json:"callbackData,omitempty" validate:"lte=4000"`
	NotifyURL    string `json:"notifyUrl,omitempty" validate:"omitempty,url,lte=2048"`
}

func GenerateTestMsgCommon

func GenerateTestMsgCommon() MsgCommon

type MsgResponse

type MsgResponse struct {
	To           string `json:"to"`
	MessageCount int32  `json:"messageCount"`
	MessageID    string `json:"messageId"`
	Status       Status `json:"status"`
}

type MultipartValidatable added in v1.1.0

type MultipartValidatable interface {
	Validatable
	GetMultipartBoundary() string
}

type OutboundMMSDeliveryReportsOpts added in v1.1.0

type OutboundMMSDeliveryReportsOpts struct {
	BulkID    string
	MessageID string
	Limit     string
}

type OutboundMMSDeliveryReportsResponse added in v1.1.0

type OutboundMMSDeliveryReportsResponse struct {
	Results []OutboundMMSDeliveryResult `json:"results"`
}

type OutboundMMSDeliveryResult added in v1.1.0

type OutboundMMSDeliveryResult struct {
	BulkID       string    `json:"bulkId"`
	MessageID    string    `json:"messageId"`
	To           string    `json:"to"`
	From         string    `json:"from"`
	SentAt       string    `json:"sentAt"`
	DoneAt       string    `json:"doneAt"`
	MMSCount     int32     `json:"mmsCount"`
	MCCMNC       string    `json:"mccMnc"`
	CallbackData string    `json:"callbackData"`
	Price        MMSPrice  `json:"price"`
	Status       MMSStatus `json:"status"`
	Error        MMSStatus `json:"error"`
}

type RequestError

type RequestError struct {
	ServiceException ServiceException `json:"serviceException"`
}

type RescheduleMessagesOpts added in v1.2.0

type RescheduleMessagesOpts struct {
	BulkID string `validate:"required"`
}

func (*RescheduleMessagesOpts) Validate added in v1.2.0

func (o *RescheduleMessagesOpts) Validate() error

type RescheduleMessagesRequest added in v1.2.0

type RescheduleMessagesRequest struct {
	SendAt string `json:"sendAt"`
}

func (*RescheduleMessagesRequest) Marshal added in v1.2.0

func (r *RescheduleMessagesRequest) Marshal() (*bytes.Buffer, error)

func (*RescheduleMessagesRequest) Validate added in v1.2.0

func (r *RescheduleMessagesRequest) Validate() error

type RescheduleMessagesResponse added in v1.2.0

type RescheduleMessagesResponse struct {
	BulkID string `json:"bulkId"`
	SendAt int64  `json:"sendAt"`
}

type ResponseDetails

type ResponseDetails struct {
	ErrorResponse ErrorDetails
	HTTPResponse  http.Response
}

type SMSFailover

type SMSFailover struct {
	From string `json:"from" validate:"required,lte=24"`
	Text string `json:"text" validate:"required,lte=4096"`
}

type SectionRow

type SectionRow struct {
	ID          string `json:"id" validate:"required,lte=200"`
	Title       string `json:"title" validate:"required,lte=24"`
	Description string `json:"description,omitempty" validate:"lte=72"`
}

type SendEmailResponse added in v1.2.0

type SendEmailResponse struct {
	BulkID   string `json:"bulkId"`
	Messages []struct {
		To           string `json:"to"`
		MessageCount int    `json:"messageCount"`
		MessageID    string `json:"messageId"`
		Status       struct {
			GroupID     int    `json:"groupId"`
			GroupName   string `json:"groupName"`
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Description string `json:"description"`
		} `json:"status"`
	} `json:"messages"`
}

type SentEmailBulksResponse added in v1.2.0

type SentEmailBulksResponse struct {
	ExternalBulkID string `json:"externalBulkId"`
	Bulks          []struct {
		BulkID string `json:"bulkId"`
		SendAt int64  `json:"sendAt"`
	} `json:"bulks"`
}

type SentEmailBulksStatusResponse added in v1.2.0

type SentEmailBulksStatusResponse struct {
	ExternalBulkID string `json:"externalBulkId"`
	Bulks          []struct {
		BulkID string `json:"bulkId"`
		Status string `json:"status"`
	} `json:"bulks"`
}

type SentMMS added in v1.1.0

type SentMMS struct {
	To        string    `json:"to"`
	Status    MMSStatus `json:"status"`
	MessageID string    `json:"messageId"`
}

type ServiceException

type ServiceException struct {
	MessageID        string                 `json:"messageId"`
	Text             string                 `json:"text"`
	ValidationErrors map[string]interface{} `json:"validationErrors"`
}

type Status

type Status struct {
	GroupID     int32  `json:"groupId"`
	GroupName   string `json:"groupName"`
	ID          int32  `json:"id"`
	Name        string `json:"name"`
	Description string `json:"description"`
	Action      string `json:"action"`
}

type StickerContent

type StickerContent struct {
	MediaURL string `json:"mediaUrl" validate:"required,url,lte=2048"`
}

type StickerMsg

type StickerMsg struct {
	MsgCommon
	Content StickerContent `json:"content" validate:"required"`
}

func (*StickerMsg) Marshal added in v1.1.0

func (t *StickerMsg) Marshal() (*bytes.Buffer, error)

func (*StickerMsg) Validate

func (t *StickerMsg) Validate() error

type TemplateBody

type TemplateBody struct {
	Placeholders []string `json:"placeholders" validate:"required,dive,gte=1"`
}

type TemplateButton

type TemplateButton struct {
	Type        string `json:"type" validate:"required,oneof=PHONE_NUMBER URL QUICK_REPLY"`
	Text        string `json:"text" validate:"required,lte=200"`
	PhoneNumber string `json:"phoneNumber,omitempty"`
	URL         string `json:"url,omitempty" validate:"omitempty,url"`
}

type TemplateCreate

type TemplateCreate struct {
	Name      string            `json:"name" validate:"required"`
	Language  string            `json:"language" validate:"required"`
	Category  string            `json:"category" validate:"required"`
	Structure TemplateStructure `json:"structure" validate:"required"`
}

func (*TemplateCreate) Marshal added in v1.1.0

func (t *TemplateCreate) Marshal() (*bytes.Buffer, error)

func (*TemplateCreate) Validate

func (t *TemplateCreate) Validate() error

type TemplateData

type TemplateData struct {
	Body    TemplateBody        `json:"body" validate:"required"`
	Header  *TemplateMsgHeader  `json:"header,omitempty"`
	Buttons []TemplateMsgButton `json:"buttons,omitempty" validate:"omitempty,max=3,dive"`
}

type TemplateHeader

type TemplateHeader struct {
	Format string `json:"format,omitempty" validate:"oneof=TEXT IMAGE VIDEO DOCUMENT LOCATION"`
	Text   string `json:"text" validate:"lte=60"`
}

type TemplateMsg

type TemplateMsg struct {
	MsgCommon
	Content     TemplateMsgContent `json:"content" validate:"required"`
	SMSFailover *SMSFailover       `json:"smsFailover,omitempty"`
}

type TemplateMsgButton

type TemplateMsgButton struct {
	Type      string `json:"type" validate:"required,oneof=QUICK_REPLY URL"`
	Parameter string `json:"parameter" validate:"required"`
}

type TemplateMsgContent

type TemplateMsgContent struct {
	TemplateName string       `json:"templateName" validate:"required,lte=512"`
	TemplateData TemplateData `json:"templateData" validate:"required"`
	Language     string       `json:"language" validate:"required"`
}

type TemplateMsgHeader

type TemplateMsgHeader struct {
	Type        string   `json:"type" validate:"required,oneof=TEXT DOCUMENT IMAGE VIDEO LOCATION"`
	Placeholder string   `json:"placeholder,omitempty"`
	MediaURL    string   `json:"mediaUrl,omitempty" validate:"omitempty,url,lte=2048"`
	Filename    string   `json:"filename,omitempty" validate:"lte=240"`
	Latitude    *float32 `json:"latitude,omitempty" validate:"omitempty,latitude"`
	Longitude   *float32 `json:"longitude,omitempty" validate:"omitempty,longitude"`
}

type TemplateMsgs

type TemplateMsgs struct {
	Messages []TemplateMsg `json:"messages" validate:"required,min=1,dive"`
	BulkID   string        `json:"bulkId,omitempty" validate:"lte=100"`
}

func (*TemplateMsgs) Marshal added in v1.1.0

func (t *TemplateMsgs) Marshal() (*bytes.Buffer, error)

func (*TemplateMsgs) Validate

func (t *TemplateMsgs) Validate() error

type TemplateResponse

type TemplateResponse struct {
	ID                string            `json:"ID"`
	BusinessAccountID int64             `json:"businessAccountID"`
	Name              string            `json:"name"`
	Language          string            `json:"language"`
	Status            string            `json:"status"`
	Category          string            `json:"category"`
	Structure         TemplateStructure `json:"structure"`
}

type TemplateStructure

type TemplateStructure struct {
	Header  *TemplateHeader  `json:"header,omitempty"`
	Body    string           `json:"body" validate:"required"`
	Footer  string           `json:"footer,omitempty" validate:"lte=60"`
	Buttons []TemplateButton `json:"buttons,omitempty" validate:"omitempty,min=1,max=3,dive"`
	Type    string           `json:"type,omitempty" validate:"oneof=TEXT MEDIA UNSUPPORTED"`
}

type TemplatesResponse

type TemplatesResponse struct {
	Templates []TemplateResponse `json:"templates"`
}

type TextContent

type TextContent struct {
	Text       string `json:"text" validate:"required,gte=1,lte=4096"`
	PreviewURL bool   `json:"previewURL,omitempty"`
}

type TextMsg

type TextMsg struct {
	MsgCommon
	Content TextContent `json:"content" validate:"required"`
}

func (*TextMsg) Marshal added in v1.1.0

func (t *TextMsg) Marshal() (*bytes.Buffer, error)

func (*TextMsg) Validate

func (t *TextMsg) Validate() error

type UpdateScheduledMessagesStatusOpts added in v1.2.0

type UpdateScheduledMessagesStatusOpts struct {
	BulkID string `validate:"required"`
}

func (*UpdateScheduledMessagesStatusOpts) Validate added in v1.2.0

type UpdateScheduledMessagesStatusRequest added in v1.2.0

type UpdateScheduledMessagesStatusRequest struct {
	Status string `json:"status" validate:"required,oneof=PENDING PAUSED PROCESSING CANCELED FINISHED FAILED"`
}

func (*UpdateScheduledMessagesStatusRequest) Marshal added in v1.2.0

func (*UpdateScheduledMessagesStatusRequest) Validate added in v1.2.0

type UpdateScheduledMessagesStatusResponse added in v1.2.0

type UpdateScheduledMessagesStatusResponse struct {
	BulkID string `json:"bulkId"`
	Status string `json:"status"`
}

type Validatable

type Validatable interface {
	Validate() error
	Marshal() (*bytes.Buffer, error)
}

Validatable should be implemented by all models which represent request payloads. It will be called before a request is made.

type ValidateAddressesRequest added in v1.2.0

type ValidateAddressesRequest struct {
	To string `json:"to"`
}

func (*ValidateAddressesRequest) Marshal added in v1.2.0

func (v *ValidateAddressesRequest) Marshal() (*bytes.Buffer, error)

func (*ValidateAddressesRequest) Validate added in v1.2.0

func (v *ValidateAddressesRequest) Validate() error

type ValidateAddressesResponse added in v1.2.0

type ValidateAddressesResponse struct {
	To           string `json:"to"`
	ValidMailbox string `json:"validMailbox"`
	ValidSyntax  bool   `json:"validSyntax"`
	CatchAll     bool   `json:"catchAll"`
	Disposable   bool   `json:"disposable"`
	RoleBased    bool   `json:"roleBased"`
}

type VideoContent

type VideoContent struct {
	MediaURL string `json:"mediaUrl" validate:"required,url,lte=2048"`
	Caption  string `json:"caption,omitempty" validate:"lte=3000"`
}

type VideoMsg

type VideoMsg struct {
	MsgCommon
	Content VideoContent `json:"content" validate:"required"`
}

func (*VideoMsg) Marshal added in v1.1.0

func (t *VideoMsg) Marshal() (*bytes.Buffer, error)

func (*VideoMsg) Validate

func (t *VideoMsg) Validate() error

Jump to

Keyboard shortcuts

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