core

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 20, 2025 License: Zlib Imports: 13 Imported by: 0

Documentation

Overview

Copyright © 2025 Шелковский Сергей (Shelkovskiy Sergey) <[email protected]>

Copyright © 2025 Шелковский Сергей (Shelkovskiy Sergey) <[email protected]>

Copyright © 2025 Шелковский Сергей (Shelkovskiy Sergey) <[email protected]>

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTPClient

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

HTTPClient provides functionality for executing HTTP requests.

func NewHTTPClient

func NewHTTPClient(connectTimeout, readTimeout time.Duration, autoManageCookies bool) *HTTPClient

NewHTTPClient creates a new HTTPClient with the specified timeouts and cookie management settings.

func (*HTTPClient) Execute

func (hc *HTTPClient) Execute(req *types.Request) (*types.Response, error)

Execute performs an HTTP request and returns the response.

type RequestBuilder

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

RequestBuilder provides a fluent interface for building HTTP requests.

func NewRequestBuilder

func NewRequestBuilder() *RequestBuilder

NewRequestBuilder creates a new RequestBuilder instance.

func (*RequestBuilder) AuthAPIKey

func (b *RequestBuilder) AuthAPIKey(keyName, keyValue, location string) *RequestBuilder

AuthAPIKey sets API key authentication with the specified key name, value, and location.

func (*RequestBuilder) AuthBasic

func (b *RequestBuilder) AuthBasic(username, password string) *RequestBuilder

AuthBasic sets Basic authentication credentials.

func (*RequestBuilder) AuthBearer

func (b *RequestBuilder) AuthBearer(token string) *RequestBuilder

AuthBearer sets Bearer token authentication.

func (*RequestBuilder) BodyBinary

func (b *RequestBuilder) BodyBinary(data []byte, contentType string) *RequestBuilder

BodyBinary sets the request body as binary data with the specified content type.

func (*RequestBuilder) BodyJSON

func (b *RequestBuilder) BodyJSON(data any) *RequestBuilder

BodyJSON sets the request body as JSON.

func (*RequestBuilder) BodyString

func (b *RequestBuilder) BodyString(data string) *RequestBuilder

BodyString sets the request body as string.

func (*RequestBuilder) BodyXML

func (b *RequestBuilder) BodyXML(data string) *RequestBuilder

BodyXML sets the request body as XML.

func (*RequestBuilder) Build

func (b *RequestBuilder) Build() (*types.Request, error)

Build constructs and returns the final Request object.

func (*RequestBuilder) CookiesAutoManage

func (b *RequestBuilder) CookiesAutoManage(autoManage bool) *RequestBuilder

CookiesAutoManage enables or disables automatic cookie management.

func (*RequestBuilder) Header

func (b *RequestBuilder) Header(key, value string) *RequestBuilder

Header adds a single header to the request.

func (*RequestBuilder) Headers

func (b *RequestBuilder) Headers(headers map[string]string) *RequestBuilder

Headers sets multiple headers for the request.

func (*RequestBuilder) Method

func (b *RequestBuilder) Method(method string) *RequestBuilder

Method sets the HTTP method for the request.

func (*RequestBuilder) Timeout

func (b *RequestBuilder) Timeout(connect, read time.Duration) *RequestBuilder

Timeout sets connection and read timeouts for the request.

func (*RequestBuilder) URL

func (b *RequestBuilder) URL(url string) *RequestBuilder

URL sets the request URL.

type VariableResolver

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

VariableResolver resolves variables from global and local environments.

func NewVariableResolver

func NewVariableResolver(global, local *environment.Environment) (*VariableResolver, error)

NewVariableResolver creates a new VariableResolver with global and optional local environment.

func (*VariableResolver) GetGlobal

func (vr *VariableResolver) GetGlobal() *environment.Environment

GetGlobal returns the current global environment.

func (*VariableResolver) GetLocal

func (vr *VariableResolver) GetLocal() *environment.Environment

GetLocal returns the current local environment.

func (*VariableResolver) Resolve

func (vr *VariableResolver) Resolve(template string) (string, error)

Resolve resolves variables in a template string using the current environment.

func (*VariableResolver) ResolveMap

func (vr *VariableResolver) ResolveMap(m map[string]string) (map[string]string, error)

ResolveMap resolves variables in both keys and values of a map.

func (*VariableResolver) SetGlobal

func (vr *VariableResolver) SetGlobal(global *environment.Environment)

SetGlobal sets the global environment for variable resolution.

func (*VariableResolver) SetLocal

func (vr *VariableResolver) SetLocal(local *environment.Environment)

SetLocal sets the local environment for variable resolution.

func (*VariableResolver) ValidateVariables

func (vr *VariableResolver) ValidateVariables(template string) error

ValidateVariables validates that all variables in a template exist in the current environment.

func (*VariableResolver) ValidateVariablesInMap

func (vr *VariableResolver) ValidateVariablesInMap(m map[string]string) error

ValidateVariablesInMap validates variables in both keys and values of a map.

Jump to

Keyboard shortcuts

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