Documentation
¶
Index ¶
- Constants
- type GRPCClient
- type GraphQLClient
- type HTTPClient
- func (c *HTTPClient) DownloadAndValidateFile(url string, dest string, progress, totalSize *int64, ...) error
- func (c *HTTPClient) DownloadFile(url string, dest string, progress, totalSize *int64) error
- func (c *HTTPClient) Get(baseURL, additionalPath string, params map[string]string, result interface{}) ([]byte, error)
- func (c *HTTPClient) Post(baseURL, additionalPath string, headers map[string]string, body []byte, ...) ([]byte, error)
Constants ¶
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.
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.