rpc

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorEmpty                   = 0
	ErrorFunctionNotCallable     = -100
	ErrorFunctionNotFound        = -101
	ErrorIncompatibleRPCVersion  = -102
	ErrorInvalidArguments        = -200
	ErrorEncode                  = -300
	ErrorDecode                  = -301
	ErrorCouldNotSendCall        = -400
	ErrorNotSuccessfulStatusCode = -401
	ErrorServer                  = -500
	ErrorAuth                    = -600
	ErrorPreCallChecks           = -700
)
View Source
const Version = "2.1"

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthTicket

type AuthTicket struct {
	AccessToken  string `json:"accessToken"`
	RefreshToken string `json:"refreshToken"`
}

func NewAuthTicket

func NewAuthTicket(access, refresh string) AuthTicket

func (*AuthTicket) FromMap

func (a *AuthTicket) FromMap(m map[string]interface{})

type AuthTicketHolder

type AuthTicketHolder interface {
	SetTicket(ticket AuthTicket)
	GetTicket() AuthTicket
}

type Client

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

func NewClient

func NewClient(url string, configuration *Configuration) *Client

func (*Client) Func

func (c *Client) Func(name string) *Function

type CodecProvider

type CodecProvider interface {
	ContentType() string
	Encode(source interface{}) ([]byte, error)
	Decode(data []byte, destination interface{}) error
}

type Configuration

type Configuration struct {
	TransportProvider   TransportProvider
	CodecProvider       CodecProvider
	FunctionUrlProvider FunctionUrlProvider
	AuthTicketHolder    AuthTicketHolder
}

func DefaultConfiguration

func DefaultConfiguration() *Configuration

type DefaultFunctionUrlProvider

type DefaultFunctionUrlProvider struct {
	Prefix string
}

func NewDefaultFunctionUrlProvider

func NewDefaultFunctionUrlProvider() *DefaultFunctionUrlProvider

func (*DefaultFunctionUrlProvider) GetUrl

func (p *DefaultFunctionUrlProvider) GetUrl(functionName string) string

type Error

type Error struct {
	Code int
	// contains filtered or unexported fields
}

func NewError

func NewError(code int, msg ...string) Error

type Function

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

func (*Function) Call

func (f *Function) Call(args ...interface{}) (*FunctionOutput, error)

func (*Function) CallForResult

func (f *Function) CallForResult(result interface{}, args ...interface{}) error

type FunctionCall

type FunctionCall struct {
	Arguments []interface{} `json:"args"`
	Auth      string        `json:"auth"`
}

type FunctionOutput

type FunctionOutput struct {
	Error  int                    `json:"error"`
	Result interface{}            `json:"result"`
	Meta   map[string]interface{} `json:"metaData"`
}

type FunctionUrlProvider

type FunctionUrlProvider interface {
	GetUrl(functionName string) string
}

type HttpTransportProvider

type HttpTransportProvider struct {
	*http.Client
}

func NewHttpTransportProvider

func NewHttpTransportProvider() *HttpTransportProvider

func (*HttpTransportProvider) Send

func (p *HttpTransportProvider) Send(url string, data []byte, contentType string) ([]byte, error)

type JsonCodecProvider

type JsonCodecProvider struct {
}

func NewJsonCodecProvider

func NewJsonCodecProvider() *JsonCodecProvider

func (*JsonCodecProvider) ContentType

func (j *JsonCodecProvider) ContentType() string

func (*JsonCodecProvider) Decode

func (j *JsonCodecProvider) Decode(data []byte, destination interface{}) error

func (*JsonCodecProvider) Encode

func (j *JsonCodecProvider) Encode(source interface{}) ([]byte, error)

type TransientAuthTicketHolder

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

func NewTransientAuthTicketHolder

func NewTransientAuthTicketHolder() *TransientAuthTicketHolder

func (*TransientAuthTicketHolder) GetTicket

func (t *TransientAuthTicketHolder) GetTicket() AuthTicket

func (*TransientAuthTicketHolder) SetTicket

func (t *TransientAuthTicketHolder) SetTicket(ticket AuthTicket)

type TransportProvider

type TransportProvider interface {
	Send(url string, data []byte, contentType string) ([]byte, error)
}

Jump to

Keyboard shortcuts

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