httpbin

package module
v0.0.0-...-8363c13 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2022 License: GPL-3.0 Imports: 15 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

http-bin-org-go-client

An example repository that contains the Go HTTP Client SDK for httpbin.org that will be used as the template for sgen

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Authorization

type Authorization struct {
	// Prefix can override the default Bearer token prefix (Optional)
	Prefix string
	// Contains the authentication token, usually a JWT (Required)
	Token string
}

type Client

type Client struct {

	// Client is the HTTP Client used to communicate with the API.
	// By default this uses http.DefaultClient, so there are no timeouts
	// configured. It's recommended you set your own HTTP client with
	// reasonable timeouts for your application.
	Client HTTPDoer

	// Client options allow the caller to configure various parts of the
	// request.
	Options Opts

	// Services used for talking with different parts of the API
	HTTPMethods HTTPMethodsService
	// contains filtered or unexported fields
}

Client manages communication with the Example API.

func NewClient

func NewClient(opts *Opts) (*Client, error)

NewClient returns a new instance of *Client.

type HTTPBin

type HTTPBin struct {
	Headers `json:"headers"`
	URL     string `json:"url"`
}

HTTPBin is the basic response

type HTTPDoer

type HTTPDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPDoer is used for making HTTP requests. This implementation is generally a *http.Client.

type HTTPMethodsService

type HTTPMethodsService interface {

	// Get retrieves a plan. If the plan does not exist,
	// a nil plan and nil error are returned.
	//
	// https://dev.recurly.com/docs/lookup-plan-details
	Get(ctx context.Context) (*HTTPBin, error)
}

HTTPMethodsService manages the interactions for httpbin http-methods.

type Headers

type Headers struct {
	XAPIVersion    string `json:"x-api-version,omitempty"`
	Authorization  string `json:"authorization,omitempty"`
	Accept         string `json:"accept,omitempty"`
	AcceptEncoding string `json:"accept-encoding,omitempty"`
	AcceptLanguage string `json:"accept-language,omitempty"`
	DNT            string `json:"dnt,omitempty"`
	Host           string `json:"host,omitempty"`
	Referer        string `json:"referer,omitempty"`
	UserAgent      string `json:"user-agent,omitempty"`
}

type Opts

type Opts struct {
	// Host is the base url for requests.
	Host *url.URL
	// Set debug level for logging http calls in the client http sdk. Defaults to false
	Debug bool
	// Version (optional) can be set if a versioned api is preferred, ex: /v1/items vs /v2/items
	Version string
	// Authorization holds the auth token and prefix to build up the header
	Authorization
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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