web

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 7, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckResponseForErrors

func CheckResponseForErrors(body []byte) error

* CheckResponseForErrors takes the request and determines if an "errors" field is present. This is * done because as long as the graphql request receives a properly formed request, it will return a * 200OK, even if the request is "bad". For example the, attempting to access resources using an * orgID that is not accessible via the token will still return a 200OK, but will contain an error * message in the body. This function will parse that error message and return to user to provide * better information about the request and better error handling.

func DoQuery added in v0.2.0

func DoQuery(httpClient HTTPClient,
	endpoint string,
	authClient auth.AuthClient,
	requestTemplate string,
	vars interface{},
	funcs template.FuncMap,
	result interface{}) error

DoQuery makes the graphql query request and returns the result

Types

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient manages HTTP requests

type SatConClient

type SatConClient struct {
	Endpoint   string
	HTTPClient HTTPClient
	AuthClient auth.AuthClient
}

SatConClient struct to create HTTPClient and IAMClient interfaces

func (*SatConClient) DoQuery

func (s *SatConClient) DoQuery(requestTemplate string, vars interface{}, funcs template.FuncMap, result interface{}) error

DoQuery makes the graphql query request and returns the result

Directories

Path Synopsis
Code generated by counterfeiter.
Code generated by counterfeiter.

Jump to

Keyboard shortcuts

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