chainbase

package
v0.0.0-...-ea2633f Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MPL-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultBaseURL   = "https://api.chainbase.online/"
	DefaultAPIKey    = "demo"
	DefaultUserAgent = "chainbase-grafana"
)
View Source
const (
	CodeOK = 0
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	BaseURL   *url.URL
	UserAgent string
	APIKey    string

	DataWarehouse *DataWarehouseService
	// contains filtered or unexported fields
}

func NewClient

func NewClient(options ...ClientOption) (*Client, error)

func (*Client) Do

func (c *Client) Do(_ context.Context, request *http.Request, value any) (*http.Response, error)

func (*Client) NewRequest

func (c *Client) NewRequest(ctx context.Context, method string, reference string, body any) (*http.Request, error)

type ClientOption

type ClientOption func(*Client) error

func WithAPIKey

func WithAPIKey(apiKey string) ClientOption

type DataWarehouseData

type DataWarehouseData struct {
	TaskID    string                  `json:"task_id"`
	Rows      int                     `json:"rows"`
	RowsRead  int                     `json:"rows_read"`
	BytesRead int                     `json:"bytes_read"`
	Elapsed   float32                 `json:"elapsed"`
	Meta      []DataWarehouseDataMeta `json:"meta"`
	Result    []map[string]any        `json:"result"`
	ErrMsg    string                  `json:"err_msg,omitempty"`
	NextPage  int                     `json:"next_page"`
}

type DataWarehouseDataMeta

type DataWarehouseDataMeta struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type DataWarehouseService

type DataWarehouseService service

func (*DataWarehouseService) Paginate

func (s *DataWarehouseService) Paginate(ctx context.Context, taskID string, page int) (*Response[*DataWarehouseData], *http.Response, error)

func (*DataWarehouseService) Query

type Response

type Response[T any] struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Data    T      `json:"data"`
}

Jump to

Keyboard shortcuts

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