http

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2022 License: LGPL-2.1 Imports: 11 Imported by: 0

Documentation

Overview

Package http provides low-level methods to interact with the Horizon instance through its REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	Transport http.Transport
	// contains filtered or unexported fields
}

func (*Client) BaseUrl

func (c *Client) BaseUrl() url.URL

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(path string) (response *HorizonResponse, err error)

func (*Client) Init

func (c *Client) Init(baseUrl url.URL, apiId string, apiKey string)

Init initializes the instance parameters such as its location, and authentication data.

func (*Client) Post

func (c *Client) Post(path string, body []byte) (response *HorizonResponse, err error)

func (*Client) SetCaBundle

func (c *Client) SetCaBundle(caBundle string)

SetCaBundle sets the client certificate than can be used for authentication.

func (*Client) SetProxy

func (c *Client) SetProxy(proxyUrl url.URL)

func (*Client) SkipTLSVerify

func (c *Client) SkipTLSVerify()

func (*Client) Unmarshal

func (c *Client) Unmarshal(r *http.Response) (*HorizonResponse, error)

type Feature added in v0.0.4

type Feature int
const (
	TrustchainDecoding Feature = iota
)

func (Feature) String added in v0.0.4

func (feature Feature) String() string

type HorizonErrorResponse

type HorizonErrorResponse struct {
	Code    string `json:"error"`
	Message string `json:"message"`
	Detail  string `json:"detail"`
}

func (*HorizonErrorResponse) Error

func (e *HorizonErrorResponse) Error() string

type HorizonResponse

type HorizonResponse struct {
	BaseResponse *http.Response
}

func (*HorizonResponse) HasContentType added in v0.0.4

func (r *HorizonResponse) HasContentType(mimeType string) bool

func (*HorizonResponse) Json

func (r *HorizonResponse) Json() *json.Decoder

type NotImplementedError added in v0.0.4

type NotImplementedError struct {
	Feature       Feature `json:"feature"`
	ImplementedIn string  `json:"implementedIn"`
}

func (*NotImplementedError) Error added in v0.0.4

func (e *NotImplementedError) Error() string

Jump to

Keyboard shortcuts

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