api

package
v0.0.0-...-4bdf62d Latest Latest
Warning

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

Go to latest
Published: Jun 6, 2019 License: GPL-2.0-or-later Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIResponse

type APIResponse struct {
	Status int
	Data   interface{}
}

APIResponse is a data structure encapsulating the return from an api endpoint

type Endpoint

type Endpoint struct {
	URL    string `mapstructure:"url"`
	Method string `mapstructure:"method"`
	Auth   string `mapstructure:"auth"`
	// contains filtered or unexported fields
}

Endpoint is a single API endpoint/resource

func (*Endpoint) Call

func (e *Endpoint) Call(subPath, query, requestBody string) (*APIResponse, error)

Call the Endpoint with the provided query string and requestBody (if applicable)

func (*Endpoint) GetUrl

func (e *Endpoint) GetUrl(subPath, query string) (*url.URL, error)

type EndpointMap

type EndpointMap map[string]*Endpoint

EndpointMap maps keys to api endpoints

func (EndpointMap) Call

func (m EndpointMap) Call(endpoint, subPath, query, requestBody string) (*APIResponse, error)

Call the endpoint from the map with the provided arguments

Jump to

Keyboard shortcuts

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