graphql

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2023 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// The graphql can contains a list of server where
	// make the request.
	BaseUrl []string
	// Token to autenticate to the server
	Token     *string
	Client    *http.Client
	WithProxy bool
}

func New

func New(baseUrl []string) *Client

Builder method to make a new client

func NewWithProxy

func NewWithProxy(baseUrl []string, hostProxy string, portProxy uint64) (*Client, error)

func (*Client) GetMetricOneByNodeID

func (instance *Client) GetMetricOneByNodeID(nodeID string, startPeriod int, endPeriod int) error

GetMetricOneByNodeID Utils function that call the GraphQL server to get the metrics about the channel

func (*Client) GetNodeMetadata

func (instance *Client) GetNodeMetadata(nodeID string, network string) error

GetNodeMetadata Utils function to the the node information from the repository

func (*Client) InitMetric

func (instance *Client) InitMetric(nodeID string, body *string, signature string) error

func (*Client) MakeQuery

func (instance *Client) MakeQuery(payload string) map[string]string

MakeQuery TODO: adding variables to give more flexibility

func (*Client) MakeRequest

func (instance *Client) MakeRequest(query map[string]string) ([]*GraphQLResponse, error)

MakeRequest Make Request is the method to make the http request

func (*Client) UploadMetric

func (instance *Client) UploadMetric(nodeID string, body *string, signature string) error

UploadMetric Utils Function to update the with the last data the metrics on server..

type GraphQLError

type GraphQLError struct {
	Message string `json:"message"`
}

GraphQLError Partial Wrapper around graphql error response FIXME: adding support for the path filed

type GraphQLResponse

type GraphQLResponse struct {
	Data   *map[string]any `json:"data"`
	Errors []*GraphQLError `json:"errors"`
}

GraphQLResponse GraphQL Response wrapper

Jump to

Keyboard shortcuts

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