polyhttp

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package polyhttp contains shared HTTP helpers for Polymarket API clients.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode  int
	Message     string
	Body        []byte
	RequestBody []byte
}

func (*APIError) Error

func (e *APIError) Error() string

func (*APIError) HTTPStatus

func (e *APIError) HTTPStatus() int

type AuthLevel

type AuthLevel int
const (
	AuthNone AuthLevel = iota
	AuthL1
	AuthL2
)

type Client

type Client struct {
	BaseURL    string
	HTTPClient *http.Client
	UserAgent  string
	Headers    HeaderFunc
}

func (*Client) DeleteJSON

func (c *Client) DeleteJSON(ctx context.Context, path string, body any, auth AuthLevel, out any) error

func (*Client) DoJSON

func (c *Client) DoJSON(ctx context.Context, method, path string, query url.Values, body any, auth AuthLevel, nonce *int64, out any) error

func (*Client) GetJSON

func (c *Client) GetJSON(ctx context.Context, path string, query url.Values, auth AuthLevel, out any) error

func (*Client) PostJSON

func (c *Client) PostJSON(ctx context.Context, path string, body any, auth AuthLevel, out any) error

type HeaderFunc

type HeaderFunc func(ctx context.Context, method, path string, body []byte, level AuthLevel, nonce *int64) (map[string]string, error)

Jump to

Keyboard shortcuts

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