httpify

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2024 License: MIT Imports: 12 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrConnectionIssue is an error that is thrown when a very specific error is
	// returned from our http request that usually implies bad connections.
	ErrConnectionIssue = errors.New("DNS problem while connecting to Shopify, this indicates a problem with your internet connection")
	// ErrInvalidProxyURL is returned if a proxy url has been passed but is improperly formatted
	ErrInvalidProxyURL = errors.New("invalid proxy URI")
)

Functions

This section is empty.

Types

type HTTPClient

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

HTTPClient encapsulates an authenticate http client to issue theme requests to Shopify

func NewClient

func NewClient(params Params) (*HTTPClient, error)

NewClient will create a new authenticated http client that will communicate with Shopify

func (*HTTPClient) Delete

func (client *HTTPClient) Delete(path string, headers map[string]string) (*http.Response, error)

Delete will send a delete request to the path provided

func (*HTTPClient) Get

func (client *HTTPClient) Get(path string, headers map[string]string) (*http.Response, error)

Get will send a get request to the path provided

func (*HTTPClient) Post

func (client *HTTPClient) Post(path string, body interface{}, headers map[string]string) (*http.Response, error)

Post will send a Post request to the path provided and set the post body as the object passed

func (*HTTPClient) Put

func (client *HTTPClient) Put(path string, body interface{}, headers map[string]string) (*http.Response, error)

Put will send a Put request to the path provided and set the post body as the object passed

type Params

type Params struct {
	Domain   string
	Password string
	Proxy    string
	Timeout  time.Duration
}

Params allows for a better structured input into NewClient

Jump to

Keyboard shortcuts

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