http

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package http implements an HTTP client for interacting with an HTTP API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseV1Config

func ParseV1Config(rawCfg json.RawMessage) (*mediatorv1.RESTProviderConfig, error)

ParseV1Config parses the raw config into a HTTPConfig struct

Types

type REST

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

REST is the interface for interacting with an REST API.

func NewREST

func NewREST(config *mediatorv1.RESTProviderConfig, tok string) (*REST, error)

NewREST creates a new RESTful client.

func (*REST) Do

func (h *REST) Do(ctx context.Context, req *http.Request) (*http.Response, error)

Do executes an HTTP request.

func (*REST) GetBaseURL added in v0.0.5

func (h *REST) GetBaseURL() string

GetBaseURL returns the base URL for the REST API.

func (*REST) GetToken

func (h *REST) GetToken() string

GetToken returns the token for the provider

func (*REST) NewRequest

func (h *REST) NewRequest(method, endpoint string, body any) (*http.Request, error)

NewRequest creates an HTTP request.

Jump to

Keyboard shortcuts

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