gql

package module
v0.0.0-...-eed75d4 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: MIT Imports: 8 Imported by: 0

README

GraphQL API Client for Go

Overview

MIT-GQL is a simple client for GraphQL APIs.

Installation

$ go get github.com/manifest-it/mit-gql-client/...

Contributing

Features, Issues, and Pull Requests are always welcome.

To contribute:

  1. Fork it ( http://github.com/manifest-it/mit-gql-client/fork )
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapMutation

func WrapMutation(gql string, wrap bool) string

func WrapQuery

func WrapQuery(gql string, wrap bool) string

Types

type Client

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

func NewClient

func NewClient(endpoint, token string, headers map[string]string) Client

func (*Client) DoGraphQL

func (c *Client) DoGraphQL(gql GraphQLOperation) (*http.Response, error)

func (*Client) DoGraphQLString

func (c *Client) DoGraphQLString(gql string) (*http.Response, error)

func (*Client) DoJSON

func (c *Client) DoJSON(data []byte) (*http.Response, error)

type GraphQLOperation

type GraphQLOperation interface {
	String() string
}

type Mutation

type Mutation struct {
	Name   string
	Input  Where
	Select Queries
	Wrap   bool
}

func (Mutation) String

func (m Mutation) String() string

type Queries

type Queries []Query

type Query

type Query struct {
	Object string
	Where  Where
	Select Queries
	Wrap   bool
}

func (Query) String

func (q Query) String() string

type QueryRequest

type QueryRequest struct {
	Query string `json:"query"`
}

type Where

type Where map[string]any

func (Where) String

func (w Where) String() string

todo: refactor so that we don't need to hardcode specific fields for each provider

Jump to

Keyboard shortcuts

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