client

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2024 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GraphqlAPI

func GraphqlAPI[T any](ctx context.Context, client *CfClient, query string, variables any) (T, error)

Types

type ApiError

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

func (*ApiError) Error

func (e *ApiError) Error() string

type CfClient

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

func NewCfClient

func NewCfClient(host, token, graphqlPath string, httpClient *http.Client) *CfClient

func (*CfClient) AppProxyClient

func (c *CfClient) AppProxyClient(host string, insecure bool) *CfClient

func (*CfClient) GraphqlAPI

func (c *CfClient) GraphqlAPI(ctx context.Context, query string, variables any, result any) error

func (*CfClient) RestAPI

func (c *CfClient) RestAPI(ctx context.Context, opt *RequestOptions) ([]byte, error)

type ClientOptions

type ClientOptions struct {
	Token       string
	Host        string
	Client      *http.Client
	GraphqlPath string
}

type GraphqlBaseResponse

type GraphqlBaseResponse struct {
	Errors []GraphqlError
}

func (GraphqlBaseResponse) HasErrors

func (e GraphqlBaseResponse) HasErrors() bool

type GraphqlError

type GraphqlError struct {
	Message    string
	Extensions any
}

type GraphqlErrorResponse

type GraphqlErrorResponse struct {
	Errors []GraphqlError
	// contains filtered or unexported fields
}

func (GraphqlErrorResponse) Error

func (e GraphqlErrorResponse) Error() string

type GraphqlResponse

type GraphqlResponse interface {
	HasErrors() bool
}

type GraphqlVoidResponse

type GraphqlVoidResponse struct{}

type RequestOptions

type RequestOptions struct {
	Path   string
	Method string
	Query  map[string]any
	Body   any
}

Jump to

Keyboard shortcuts

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