client

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Mar 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	POST           Method = "POST"
	GET            Method = "GET"
	BaseURL               = "https://pro-api.coinmarketcap.com"
	TestnetBaseURL        = "https://sandbox-api.coinmarketcap.com"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(key string, isTestnet bool, httpClient ...*http.Client) *Client

func (*Client) Get

func (c *Client) Get(path string, params Params) (Response, error)

func (*Client) Post

func (c *Client) Post(path string, params Params) (Response, error)

func (*Client) SetIsTestNet

func (c *Client) SetIsTestNet(isTestNet bool)

type Method

type Method string

type Params

type Params map[string]string

type Request

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

type Requester

type Requester interface {
	Get(path string, params Params) (Response, error)
	Post(path string, params Params) (Response, error)
}

type Response

type Response interface {
	Unmarshal(v interface{}) error
	Data() []byte
	Status() string
	StatusCode() int
	Error() error
}

func NewResponse

func NewResponse(response *http.Response) Response

type ResponseImpl

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

func (*ResponseImpl) Data

func (r *ResponseImpl) Data() []byte

func (*ResponseImpl) Error

func (r *ResponseImpl) Error() error

func (*ResponseImpl) Status

func (r *ResponseImpl) Status() string

func (*ResponseImpl) StatusCode

func (r *ResponseImpl) StatusCode() int

func (*ResponseImpl) Unmarshal

func (r *ResponseImpl) Unmarshal(v interface{}) error

Jump to

Keyboard shortcuts

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