client

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2026 License: BSD-3-Clause Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTimeout = 3 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GRPCClient

type GRPCClient struct{}

GRPCClient defines the logic for making gRPC requests.

func NewGRPCClient

func NewGRPCClient() *GRPCClient

NewGRPCClient initializes and returns a new GRPCClient instance.

func (*GRPCClient) CheckHealth

func (g *GRPCClient) CheckHealth(serverAddr string) error

CheckHealth attempts to connect to the server and uses the reflection service to verify the server is up.

type GraphQLClient

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

GraphQLClient defines the logic for interacting with GraphQL APIs.

func NewGraphQLClient

func NewGraphQLClient(baseURL string, httpClient *HTTPClient) *GraphQLClient

NewGraphQLClient creates and returns a new GraphQLClient instance.

func (*GraphQLClient) Query

func (c *GraphQLClient) Query(query string, variables map[string]interface{}, result interface{}) error

Query sends a GraphQL query to the API and decodes the response into the result.

type HTTPClient

type HTTPClient struct{}

HTTPClient defines the logic for making HTTP requests.

func NewHTTPClient

func NewHTTPClient() *HTTPClient

NewHTTPClient creates and returns a new HTTPClient instance.

func (*HTTPClient) DownloadAndValidateFile

func (c *HTTPClient) DownloadAndValidateFile(url string, dest string, progress, totalSize *int64, validateFn func(string) error) error

DownloadAndValidateFile does the HTTPClient.DownloadFile but with additional validation

func (*HTTPClient) DownloadFile

func (c *HTTPClient) DownloadFile(url string, dest string, progress, totalSize *int64) error

DownloadFile downloads a file from the specified URL and updates the current progress using the provided progress pointer.

func (*HTTPClient) Get

func (c *HTTPClient) Get(baseURL, additionalPath string, params map[string]string, result interface{}) ([]byte, error)

Get performs an HTTP GET request. It can either unmarshal a JSON response into the provided result or return the raw response data directly.

func (*HTTPClient) Post

func (c *HTTPClient) Post(baseURL, additionalPath string, headers map[string]string, body []byte, result interface{}) ([]byte, error)

Post performs an HTTP POST request. It can either unmarshal a JSON response into the provided result or return the raw response data directly.

Jump to

Keyboard shortcuts

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