apiclient

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2025 License: Apache-2.0, Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateRequestBody

func CreateRequestBody(requestType string, url string) (*http.Request, error)

func SetAuthHeaders

func SetAuthHeaders(req *http.Request, authType string, args map[string]interface{}) error

func SetHeaders

func SetHeaders(req *http.Request, args map[string]interface{})

Types

type APIClient

type APIClient struct {
	BaseURL            string
	HTTP               HTTP
	AuthType           string
	AuthHeaders        map[string]interface{}
	MaxRetries         int
	InitialBackoffTime time.Duration
}

func (*APIClient) CallAPI

func (c *APIClient) CallAPI(reqParams RequestParams) (interface{}, error)

func (*APIClient) GetURL

func (c *APIClient) GetURL(endpoint string, queryParams url.Values) string

type HTTP

type HTTP interface {
	Do(req *http.Request) (resp *http.Response, err error)
	Get(url string) (resp *http.Response, err error)
	PostForm(url string, data url.Values) (resp *http.Response, err error)
}

type RequestParams

type RequestParams struct {
	RequestType string
	Endpoint    string
	QueryParams url.Values
	Headers     map[string]interface{}
}

Jump to

Keyboard shortcuts

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