d360

package
v0.10.9 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MISSING_RESPONSE_DATA = "faltam dados para o envio da mensagem: "
)
View Source
const (
	TOKEN_VALIDITY_MINUTES = 60 * 3
)

Variables

This section is empty.

Functions

func FormatPhonenumber

func FormatPhonenumber(phoneNumber string) string

func NewChatD360TemplateTextMessage added in v0.6.6

func NewChatD360TemplateTextMessage(data map[string]interface{}) map[string]interface{}

Types

type D360

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

func NewChatD360

func NewChatD360(rest *rest.Rest) *D360

func (*D360) Autenticate

func (d *D360) Autenticate() (rest.IToken, error)

func (*D360) GetTemplateInteractive

func (d *D360) GetTemplateInteractive() (*D360_TemplateInteractiveResponse, error)

func (*D360) SendMessage

func (d *D360) SendMessage(data map[string]interface{}) ([]rest.ISendMessageResponse, error)

func (*D360) SendMessageInteractive

func (d *D360) SendMessageInteractive(data map[string]interface{}) ([]rest.ISendMessageResponse, error)

func (*D360) SendMessageTemplate

func (d *D360) SendMessageTemplate(data map[string]interface{}) ([]rest.ISendMessageResponse, error)

type D360_Action

type D360_Action struct {
	Buttons []D360_Button `json:"buttons"`
}

type D360_Body

type D360_Body struct {
	Text string `json:"text,omitempty"`
}

type D360_Button

type D360_Button struct {
	Type  string     `json:"type"` // "reply" "text"
	Text  string     `json:"text,omitempty"`
	Reply D360_Reply `json:"reply,omitempty"`
}

type D360_Contact

type D360_Contact struct {
	Input string `json:"input"`
	WaID  string `json:"wa_id"`
}

type D360_Document

type D360_Document struct {
	Filename string        `json:"filename,omitempty"`
	ID       string        `json:"id,omitempty"`
	Link     string        `json:"link,omitempty"`
	Provider D360_Provider `json:"provider,omitempty"`
}
type D360_Footer struct {
	Text string `json:"text,omitempty"`
}

type D360_Header

type D360_Header struct {
	Type     string        `json:"type"` // "text" | "image" | "video" | "document"
	Text     string        `json:"text,omitempty"`
	Document D360_Document `json:"document,omitempty"`
	Video    D360_Video    `json:"video,omitempty"`
	Image    D360_Image    `json:"image,omitempty"`
}

type D360_Image

type D360_Image struct {
	ID   string `json:"id,omitempty"`
	Link string `json:"link,omitempty"`
	Text string `json:"caption,omitempty"`
}

type D360_Interacrive

type D360_Interacrive struct {
	Type   string      `json:"type"` // "button"
	Header D360_Header `json:"header,omitempty"`
	Body   D360_Body   `json:"body,omitempty"`
	Footer D360_Footer `json:"footer,omitempty"`
	Action D360_Action `json:"action,omitempty"`
}

type D360_Language

type D360_Language struct {
	Policy string `json:"policy,omitempty"`
	Code   string `json:"code,omitempty"`
}

type D360_Message

type D360_Message struct {
	ID string `json:"id"`
}

func (*D360_Message) GetID

func (d *D360_Message) GetID() string

type D360_MessageInteractiveRequest

type D360_MessageInteractiveRequest struct {
	RecipientType string           `json:"recipient_type,omitempty"`
	To            string           `json:"to"`
	Type          string           `json:"type"`
	Interactive   D360_Interacrive `json:"interactive,omitempty"`
}

type D360_MessageRequest

type D360_MessageRequest struct {
	To            string                 `json:"to"`
	Type          string                 `json:"type"`
	RecipientType string                 `json:"recipient_type,omitempty"`
	Text          D360_Text              `json:"text,omitempty"`
	Template      D360_TemplateToMessage `json:"template,omitempty"`
}

type D360_MessageResponse

type D360_MessageResponse struct {
	Messages []D360_Message `json:"messages"`
	Contacts []D360_Contact `json:"contacts"`
	Meta     D360_Meta      `json:"meta"`
}

type D360_MessageTemplateRequest

type D360_MessageTemplateRequest struct {
	RecipientType string                 `json:"recipient_type,omitempty"`
	To            string                 `json:"to"`
	Type          string                 `json:"type"`
	Template      D360_TemplateToMessage `json:"template,omitempty"`
}

type D360_Meta

type D360_Meta struct {
	APIStatus string `json:"api_status"`
	Version   string `json:"version"`
}

type D360_Parser

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

func NewD360Parser

func NewD360Parser(data map[string]interface{}) *D360_Parser

func (*D360_Parser) SendInteractiveMessageResquest

func (d *D360_Parser) SendInteractiveMessageResquest() (*D360_MessageInteractiveRequest, error)

func (*D360_Parser) SendTemplateMessage

func (d *D360_Parser) SendTemplateMessage() (*D360_MessageTemplateRequest, error)

type D360_Provider

type D360_Provider struct {
	Name string `json:"name"`
}

type D360_Reply

type D360_Reply struct {
	ID    string `json:"id"`
	Title string `json:"title"`
}

type D360_Template

type D360_Template struct {
	Category       string                   `json:"category"`
	Components     []D360_TemplateComponent `json:"components"`
	Language       string                   `json:"language"`
	Name           string                   `json:"name"`
	Namespace      string                   `json:"namespace"`
	RejectedReason string                   `json:"rejected_reason"`
	Status         string                   `json:"status"`
}

type D360_TemplateComponent

type D360_TemplateComponent struct {
	Format     string                   `json:"format,omitempty"`
	Text       string                   `json:"text,omitempty"`
	Type       string                   `json:"type"`
	Buttons    []D360_Button            `json:"buttons,omitempty"`
	Parameters []D360_TemplateParameter `json:"parameters,omitempty"`
}

type D360_TemplateInteractiveResponse

type D360_TemplateInteractiveResponse struct {
	Count   int `json:"count"`
	Filters struct {
	} `json:"filters"`
	Limit         int             `json:"limit"`
	Offset        int             `json:"offset"`
	Sort          []string        `json:"sort"`
	Total         int             `json:"total"`
	WabaTemplates []D360_Template `json:"waba_templates"`
}

type D360_TemplateParameter

type D360_TemplateParameter struct {
	Type  string     `json:"type,omitempty"`
	Image D360_Image `json:"image,omitempty"`
	Text  string     `json:"text,omitempty"`
}

type D360_TemplateToMessage

type D360_TemplateToMessage struct {
	Components []D360_TemplateComponent `json:"components"`
	Language   D360_Language            `json:"language"`
	Name       string                   `json:"name"`
	Namespace  string                   `json:"namespace"`
}

type D360_Text

type D360_Text struct {
	Body string `json:"body"`
}

type D360_Video

type D360_Video struct {
	ID       string        `json:"id,omitempty"`
	Link     string        `json:"link,omitempty"`
	Provider D360_Provider `json:"provider,omitempty"`
}

Jump to

Keyboard shortcuts

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