util

package
v3.6.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2025 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	EncodingConfig params.EncodingConfig
	Cdc            codec.Codec
)

Functions

func CopyFile

func CopyFile(src, dst string) (int64, error)

func UnmarshalResponse added in v3.6.0

func UnmarshalResponse(resp *APIResponse, v interface{}) error

UnmarshalResponse unmarshals the response body into the given interface

func WritePublicFile

func WritePublicFile(path string, body []byte) error

Types

type APIClient added in v3.6.0

type APIClient struct {
	BaseURL    string
	HTTPClient *http.Client
}

APIClient provides methods for making API requests

func NewAPIClient added in v3.6.0

func NewAPIClient(baseURL string) *APIClient

NewAPIClient creates a new API client with the given base URL

func (*APIClient) GetWithHeaders added in v3.6.0

func (c *APIClient) GetWithHeaders(endpoint string, headers map[string]string) (*APIResponse, error)

GetWithHeaders sends a GET request and returns the response, allowing custom headers

func (*APIClient) PostJSON added in v3.6.0

func (c *APIClient) PostJSON(endpoint string, body []byte) (*APIResponse, error)

PostJSON sends a POST request with JSON body and returns the response

func (*APIClient) WaitForAPI added in v3.6.0

func (c *APIClient) WaitForAPI(maxAttempts int, interval time.Duration) error

WaitForAPI waits for the API to become available

type APIResponse added in v3.6.0

type APIResponse struct {
	StatusCode int
	Body       []byte
	Error      error
}

APIResponse wraps the standard HTTP response for API calls

Jump to

Keyboard shortcuts

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