http

package
v0.0.66 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2024 License: Apache-2.0 Imports: 10 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) (*minderv1.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. It implements helper functions that a provider that uses the `rest` trait can use.

func NewREST

func NewREST(
	config *minderv1.RESTProviderConfig,
	metrics telemetry.HttpClientMetrics,
	credential provifv1.RestCredential,
) (*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

func (h *REST) GetBaseURL() string

GetBaseURL returns the base URL for the REST API.

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