api

package
v1.3.6 Latest Latest
Warning

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

Go to latest
Published: Feb 7, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiService

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

func New

func New() *ApiService

New creates a new ApiService instance

func (*ApiService) Delete

func (r *ApiService) Delete(path string, query map[string]any) (*response.Response, error)

func (*ApiService) Get

func (r *ApiService) Get(path string, query map[string]any) (*response.Response, error)

func (*ApiService) Post

func (r *ApiService) Post(path string, data map[string]any) (*response.Response, error)

func (*ApiService) Put

func (r *ApiService) Put(path string, data map[string]any) (*response.Response, error)

func (*ApiService) ToCurl

func (r *ApiService) ToCurl() string

ToCurl returns the curl command representation of the request

func (*ApiService) WithAttachment

func (r *ApiService) WithAttachment(name string, contents []byte, filename string) *ApiService

func (*ApiService) WithHeader

func (r *ApiService) WithHeader(headers map[string]string) *ApiService

func (*ApiService) WithToken

func (r *ApiService) WithToken(token string) *ApiService

type Attachment

type Attachment struct {
	Name     string
	Contents []byte
	Filename string
}

type CdnService

type CdnService struct{}

func (CdnService) Send

func (CdnService) Send(bucket, path, filename string, body io.Reader) (string, error)

type GraphQLError added in v1.3.4

type GraphQLError struct {
	Message string   `json:"message"`
	Path    []string `json:"path"`
}

type GraphQLResponse added in v1.3.4

type GraphQLResponse struct {
	Data   any            `json:"data"`
	Errors []GraphQLError `json:"errors"`
}

type GraphQLService added in v1.3.4

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

func NewGql added in v1.3.4

func NewGql(model any) *GraphQLService

New creates a new GraphQLService instance

func (*GraphQLService) Mutation added in v1.3.4

func (g *GraphQLService) Mutation(mutation string) error

Mutation executes a GraphQL mutation

func (*GraphQLService) Query added in v1.3.4

func (g *GraphQLService) Query(query string) error

Query executes a GraphQL query

func (*GraphQLService) QueryWithContext added in v1.3.4

func (g *GraphQLService) QueryWithContext(ctx context.Context, query string) error

QueryWithContext executes a GraphQL query with context

func (*GraphQLService) Subscribe added in v1.3.4

func (g *GraphQLService) Subscribe(subscription string, callback func(model any)) error

Subscribe creates a WebSocket connection and subscribes to a GraphQL subscription

func (*GraphQLService) Unsubscribe added in v1.3.4

func (g *GraphQLService) Unsubscribe() error

Unsubscribe closes the WebSocket connection

func (*GraphQLService) WithHeader added in v1.3.4

func (g *GraphQLService) WithHeader(headers map[string]string) *GraphQLService

WithHeader adds headers to the request

func (*GraphQLService) WithToken added in v1.3.4

func (g *GraphQLService) WithToken(token string) *GraphQLService

WithToken adds authorization token to headers

func (*GraphQLService) WithVariables added in v1.3.4

func (g *GraphQLService) WithVariables(vars map[string]any) *GraphQLService

WithVariables adds variables to the GraphQL query

Jump to

Keyboard shortcuts

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