rest

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2023 License: CC0-1.0 Imports: 6 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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

gets a Rest struct with the given config if InsecureSkipVerify is set to true, the client will skip the verification of the server's certificate chain and host name

func (*Rest) Delete

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

deletes request to the given link, using the defined token

func (*Rest) Get

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

gets request to the given link, using the defined token

func (*Rest) GetConfig

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

gets variables used in the requests

func (*Rest) GetConfigData

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

sets variables used in the requests

func (*Rest) GetWithHeader

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

gets request to the given link, using the defined token and specific header

func (*Rest) GetWithHeaderNoAuth

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

gets request to the given link, without token and specific header

func (*Rest) Post

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

posts request to the given link, using the defined token

func (*Rest) PostWithContext

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

posts request to the given link, using the defined token and context

func (*Rest) PostWithHeader

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

posts request to the given link, using the defined token and specific header

func (*Rest) PostWithHeaderNoAuth

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

posts request to the given link, without token and specific header

func (*Rest) SetConfig

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

sets variables used in the requests

func (*Rest) SetToken

func (r *Rest) SetToken(token *Token) error

defines a token to be used in the requests

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