http

package
v0.0.19 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2025 License: Apache-2.0 Imports: 11 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.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiDecoratorService

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

ApiDecoratorService is a singleton service for managing and applying decorators

func GetInstance

func GetInstance() *ApiDecoratorService

GetInstance returns the singleton instance of ApiDecoratorService

func (*ApiDecoratorService) Apply

func (service *ApiDecoratorService) Apply(api interface{}) interface{}

Apply applies decorators to all methods of an API

func (*ApiDecoratorService) ApplyToMethod

func (service *ApiDecoratorService) ApplyToMethod(method func(args ...interface{}) (interface{}, error)) func(args ...interface{}) (interface{}, error)

ApplyToMethod applies decorators to a single method

func (*ApiDecoratorService) SetDecorators

func (service *ApiDecoratorService) SetDecorators(decorators []decorator.IDecorator)

SetDecorators sets the decorators for the service

type AuthMethod

type AuthMethod string
const (
	HapiKey     AuthMethod = "hapikey"
	AccessToken AuthMethod = "accessToken"
)

type AuthType

type AuthType string
const (
	APIKey          AuthType = AuthType(HapiKey)
	AccessTokenKey  AuthType = AuthType(AccessToken)
	DeveloperAPIKey AuthType = AuthType(HapiKey)
)

type Client

type Client struct{}

Client struct for HTTP client

func NewHttpClient

func NewHttpClient() *Client

NewHttpClient initializes and returns a new Client instance

func (*Client) Send

func (h *Client) Send(request *Request) (*Response, error)

Send executes the request and returns the response body or an error

func (*Client) SendAdapter

func (h *Client) SendAdapter(args ...interface{}) (interface{}, error)

SendAdapter wraps Send to match the generalized IDecorator signature

type Headers

type Headers map[string]string

Headers type for headers map

type IAPIType

type IAPIType interface {
	GetPage(limit int, after string, properties []string, propertiesWithHistory []string, associations []string, archived bool) (ICollectionType, error)
}

IAPIType defines an interface for API interactions

type ICollectionType

type ICollectionType struct {
	Results []interface{}
	Paging  *IForwardPaging
}

ICollectionType represents a collection type with results and paging

type IForwardPaging

type IForwardPaging struct {
	Next *INextPage
}

IForwardPaging represents forward paging information

type INextPage

type INextPage struct {
	After string
}

INextPage represents the next page in pagination

type IRequestContext

type IRequestContext interface {
	SetHeaderParam(key, value string)
	SetAgent(agent *http.Transport)
}

IRequestContext defines the interface for setting header parameters and agents

type MockAPI

type MockAPI struct{}

func (*MockAPI) GetPage

func (api *MockAPI) GetPage(limit int, after string, properties []string, propertiesWithHistory []string, associations []string, archived bool) (ICollectionType, error)

type Options

type Options struct {
	Method      string
	Path        string
	OverlapUrl  string
	QS          map[string]string
	Headers     Headers
	Body        interface{}
	DefaultJSON bool
}

Options IHttpOptions struct for HTTP options

type Request

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

Request struct for HTTP request

func NewHttpRequest

func NewHttpRequest(config configuration.Configuration, opts Options) (*Request, error)

NewHttpRequest NewRequest initializes a new request

func (*Request) GetSendData

func (r *Request) GetSendData() (*http.Request, error)

GetSendData prepares the data to be sent in the request

type RequestContext

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

RequestContext implements the IRequestContext interface

func NewRequestContext

func NewRequestContext() *RequestContext

NewRequestContext creates a new instance of RequestContext

type Response

type Response struct {
	Body       []byte
	StatusCode int
	Headers    http.Header
}

Response HttpResponse struct to encapsulate the response details

Jump to

Keyboard shortcuts

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