client

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(opts ...ClientOption) *http.Client

NewHTTPClient creates a new authenticated http.Client.

func ResetClient

func ResetClient()

ResetClient resets the shared client instance. This is primarily for testing. Warning: This function is not thread-safe and should only be used in test cleanup.

func Run

func Run(ctx context.Context, req *Request, resp any) error

Run executes a GraphQL request.

Types

type Client

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

Client is a GraphQL client.

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient creates a new GraphQL client.

func (*Client) Run

func (c *Client) Run(ctx context.Context, req *Request, resp any) error

type ClientOption

type ClientOption interface {
	// contains filtered or unexported methods
}

func WithApiKey

func WithApiKey(apiKey string) ClientOption

func WithEndpoint

func WithEndpoint(endpoint string) ClientOption

func WithUsername

func WithUsername(username string) ClientOption

type GraphQLError

type GraphQLError struct {
	Message    string          `json:"message"`
	Extensions json.RawMessage `json:"extensions"`
}

type GraphQLErrors

type GraphQLErrors []GraphQLError

func (GraphQLErrors) Error

func (e GraphQLErrors) Error() string

type Request

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

Request is a GraphQL request.

func NewRequest

func NewRequest(q string) *Request

NewRequest creates a new GraphQL request.

func (*Request) Header

func (r *Request) Header(key, value string)

Header sets a header.

func (*Request) Var

func (r *Request) Var(key string, value interface{})

Var sets a variable.

Jump to

Keyboard shortcuts

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