Documentation ¶
Index ¶
- Variables
- func RemoveZeroValues(slice interface{}) (out []interface{})
- func Slice(slice interface{}) (out []interface{})
- type Client
- func (client *Client) New(gql string, variables ...interface{}) *Request
- func (client *Client) NewRest(method, route string, params ...interface{}) *RestRequest
- func (client *Client) UploadJSONL(jsonl string) (string, error)
- func (client *Client) UploadJSONLWithContext(ctx context.Context, jsonl string) (key string, err error)
- type Error
- type Errors
- type KV
- type Multi
- type MultiItem
- type Oauth2Config
- type Oauth2Endpoint
- type Oauth2Token
- type Oauth2Transport
- type Request
- type RestRequest
- type UserError
- type UserErrors
Constants ¶
This section is empty.
Variables ¶
var ( Oauth2StaticTokenSource = oauth2.StaticTokenSource Oauth2NewClient = oauth2.NewClient )
var (
)Functions ¶
func RemoveZeroValues ¶ added in v1.2.0
func RemoveZeroValues(slice interface{}) (out []interface{})
Remove any zero value in a slice.
Types ¶
type Client ¶
type Client struct { Debug bool // print request and response body if true Shop string // shop name // contains filtered or unexported fields }
func (*Client) New ¶
Prepare a new GraphQL query or mutation. Variables must be provided in key-value pair order.
func (*Client) NewRest ¶ added in v1.1.0
func (client *Client) NewRest(method, route string, params ...interface{}) *RestRequest
Prepare a new restful request given method and route name. First params is request query and second params is request body.
func (*Client) UploadJSONL ¶
UploadJSONL wraps UploadJSONLWithContext using context.Background.
type Error ¶
type Error struct { Message string `json:"message"` Locations []struct { Line int Column int } `json:"locations"` Path []interface{} `json:"path"` }
Error response
type Multi ¶ added in v1.3.0
type Multi struct {
// contains filtered or unexported fields
}
func NewMulti ¶ added in v1.2.0
NewMulti creates a chain to define operations and output destinations, allowing to generate one single GraphQL query to execute multiple GraphQL queries or mutations at the same time.
func (*Multi) Add ¶ added in v1.3.0
Add defines a new operation with its argument types. The operation argument types must be in the format of "name: type".
func (*Multi) Do ¶ added in v1.3.0
Do generates gql, args and targets that can be used in Client.New() and Request.Do().
type MultiItem ¶ added in v1.3.0
type MultiItem struct {
// contains filtered or unexported fields
}
func (*MultiItem) In ¶ added in v1.3.0
In puts input values in the order of the operation argument types to the chain.
func (*MultiItem) Out ¶ added in v1.3.0
Out puts destinations to slices followed by a JSON path to the chain.
type Oauth2Config ¶
type Oauth2Endpoint ¶
type Oauth2Token ¶
type Oauth2Transport ¶
type Request ¶
type Request struct { Query string `json:"query"` Variables map[string]interface{} `json:"variables,omitempty"` // contains filtered or unexported fields }
func (*Request) Do ¶
Execute the GraphQL query or mutation and unmarshal JSON response into the optional dest. Specify JSON path after each dest to efficiently get required info from deep nested structs.
type RestRequest ¶ added in v1.1.0
type RestRequest struct {
// contains filtered or unexported fields
}
func (*RestRequest) Do ¶ added in v1.1.0
func (req *RestRequest) Do(dest ...interface{}) error
Execute the restful request and unmarshal JSON response into the optional dest. Specify JSON path after each dest to efficiently get required info from deep nested structs.
func (*RestRequest) MustDo ¶ added in v1.1.0
func (req *RestRequest) MustDo(dest ...interface{})
MustDo is like Do but panics if operation fails.
func (*RestRequest) WithContext ¶ added in v1.1.0
func (req *RestRequest) WithContext(ctx context.Context) *RestRequest
Set context.
type UserErrors ¶
type UserErrors []UserError
func (UserErrors) Error ¶
func (errs UserErrors) Error() string