rtl

package
v4.0.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiSettings

type ApiSettings struct {
	BaseUrl      string `ini:"base_url"`
	VerifySsl    bool   `ini:"verify_ssl"`
	Timeout      int32  `ini:"timeout"`
	AgentTag     string `ini:"agent_tag"`
	FileName     string `ini:"file_name"`
	ClientId     string `ini:"client_id"`
	ClientSecret string `ini:"client_secret"`
	ApiVersion   string `ini:"api_version"`
}

func NewSettingsFromEnv

func NewSettingsFromEnv() (ApiSettings, error)

func NewSettingsFromFile

func NewSettingsFromFile(file string, section *string) (ApiSettings, error)

type AuthSession

type AuthSession struct {
	Config ApiSettings
	Client http.Client
}

func NewAuthSession

func NewAuthSession(config ApiSettings) *AuthSession

func NewAuthSessionWithTransport

func NewAuthSessionWithTransport(config ApiSettings, transport http.RoundTripper) *AuthSession

The transport parameter may override your VerifySSL setting

func (*AuthSession) Do

func (s *AuthSession) Do(result interface{}, method, ver, path string, reqPars map[string]interface{}, body interface{}, options *ApiSettings) error

type DelimInt64

type DelimInt64 []int64

type alias to in64 slice, this is needed for custom serialization

func (DelimInt64) MarshalJSON

func (i DelimInt64) MarshalJSON() ([]byte, error)

MarshalJSON is custom json marshaling for DelimInt64 type It marshals the DelimInt64 (slice of int64) to comma separated json string value example:

DelimInt64{1,2,3} -> "1,2,3"

func (*DelimInt64) UnmarshalJSON

func (i *DelimInt64) UnmarshalJSON(b []byte) error

UnmarshalJSON is custom json unmarshaling for DelimInt64 type It expects string as input, split the string by comma and convert it to DelimInt64 (slice of int64) example:

"1,2,3" -> DelimInt64{1,2,3}

type DelimString

type DelimString []string

type alias to string slice, this is needed for custom serialization

func (DelimString) MarshalJSON

func (s DelimString) MarshalJSON() ([]byte, error)

MarshalJSON is custome json marshaling for DelimString type It marshals the DelimString (slice of strings) to comma separated json string value example: DelimString{"one","two","three"} -> "one,two,three"

func (*DelimString) UnmarshalJSON

func (s *DelimString) UnmarshalJSON(b []byte) error

UnmarshalJSON is custom json unmarshaling for DelimString type It expects json string as input, and split it by comma to multiple strings. example:

"one,two,three" -> DelimString{"one","two","three"}

Jump to

Keyboard shortcuts

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