rest

package
v0.9.5 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrChatMessageTextEmpty         = errors.New("texto inválido")
	ErrChatMessageNumberEmpty       = errors.New("número inválido")
	ErrChatMessageContactIDEmpty    = errors.New("contactId inválido")
	ErrChatMessageServiceIDEmpty    = errors.New("serviceId inválido")
	ErrChatMessageFileBase64Empty   = errors.New("base64 inválido")
	ErrChatMessageFileMimetypeEmpty = errors.New("mimetype inválido")
	ErrChatMessageFileNameEmpty     = errors.New("name inválido")
	ErrAuthenticationFailed         = errors.New("autenticação falhou")
)

Functions

This section is empty.

Types

type IChat

type IChat interface {
	SendMessage(IChatMessage) error
}

type IChatFile

type IChatFile interface {
	GetBase64() string
	GetMimetype() string
	GetName() string
	SetBase64(string) error
	SetMimetype(string) error
	SetName(string) error
	Validate() error
}

type IChatMessage

type IChatMessage interface {
	GetText() string
	GetNumber() string
	GetContactID() string
	GetServiceID() string
	GetFile() IChatFile
	SetText(string) error
	SetNumber(string) error
	SetContactID(string) error
	SetServiceID(string) error
	SetFile(IChatFile) error
	ToJSON() (string, error)
	Validate() error
}

type IResponse

type IResponse interface {
	GetRaw() string
	GetCode() int
}

type IRest

type IRest interface {
	Post(payload map[string]interface{}, link string) (*Response, error)
	PostWithContext(payload map[string]interface{}, link string, ctx context.Context) (*Response, error)
	Get(payload map[string]interface{}, link string) (*Response, error)
	PostWithHeader(payload map[string]interface{}, link string, header map[string]string) (*Response, error)
	GetWithHeader(payload map[string]interface{}, link string, header map[string]string) (*Response, error)
	SetToken(token IToken) error
	SetConfig(key string, value string)
	GetConfig(key string) string
	GetConfigData() map[string]string
	// contains filtered or unexported methods
}

type ISendMessageResponse

type ISendMessageResponse interface {
	GetID() string
}

type IToken

type IToken interface {
	SetValidity(validity string) error
	GetValidity() string
	IsValid() bool
	GetKey() string
	SetKey(key string)
}

type Response

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

func (*Response) GetCode

func (r *Response) GetCode() int

func (*Response) GetRaw

func (r *Response) GetRaw() string

type Rest

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

func NewRest

func NewRest(config map[string]interface{}) *Rest

func (*Rest) Delete added in v0.9.0

func (b *Rest) Delete(link string) (*Response, error)

func (*Rest) Get

func (b *Rest) Get(payload map[string]interface{}, link string) (*Response, error)

func (*Rest) GetConfig

func (b *Rest) GetConfig(key string) string

func (*Rest) GetConfigData

func (b *Rest) GetConfigData() map[string]interface{}

func (*Rest) GetWithHeader

func (b *Rest) GetWithHeader(payload map[string]interface{}, link string, header map[string]string) (*Response, error)

func (*Rest) GetWithHeaderNoAuth added in v0.5.0

func (b *Rest) GetWithHeaderNoAuth(payload map[string]interface{}, link string, header map[string]string) (*Response, error)

func (*Rest) Post

func (b *Rest) Post(payload map[string]interface{}, link string) (*Response, error)

func (*Rest) PostWithContext

func (b *Rest) PostWithContext(payload map[string]interface{}, link string, ctx context.Context) (*Response, error)

func (*Rest) PostWithHeader

func (b *Rest) PostWithHeader(payload map[string]interface{}, link string, header map[string]string) (*Response, error)

func (*Rest) PostWithHeaderNoAuth

func (b *Rest) PostWithHeaderNoAuth(payload map[string]interface{}, link string, header map[string]string) (*Response, error)

func (*Rest) SetConfig

func (b *Rest) SetConfig(key string, value string)

func (*Rest) SetToken

func (b *Rest) SetToken(token IToken) error

type Token

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

func NewToken

func NewToken() *Token

func (*Token) GetKey

func (t *Token) GetKey() string

func (*Token) GetValidity

func (t *Token) GetValidity() string

func (*Token) IsValid

func (t *Token) IsValid() bool

func (*Token) SetKey

func (t *Token) SetKey(key string)

func (*Token) SetValidity

func (t *Token) SetValidity(validity string) error

Jump to

Keyboard shortcuts

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