requester

package
v0.15.1 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Copyright ©, 2023-present, Lightspark Group, Inc. - All Rights Reserved

Index

Constants

View Source
const DEFAULT_BASE_URL = "https://api.lightspark.com/graphql/server/2023-09-13"

Variables

This section is empty.

Functions

func ValidateBaseUrl added in v0.7.1

func ValidateBaseUrl(baseUrl string) error

Types

type GraphQLError added in v0.12.0

type GraphQLError struct {
	Message string
	Type    string
}

GraphQLError indicates the GraphQL request succeeded, but there's a user error. The request should not be retried, because the error is due to the user's input.

func (GraphQLError) Error added in v0.12.0

func (e GraphQLError) Error() string

type GraphQLInternalError added in v0.12.0

type GraphQLInternalError struct {
	Message string
}

GraphQLInternalError indicates there's a failure in the Lightspark API. It could be due to a bug on Ligthspark's side. The request can be retried, because the error might be transient.

func (GraphQLInternalError) Error added in v0.12.0

func (e GraphQLInternalError) Error() string

type RequestError added in v0.12.0

type RequestError struct {
	Message    string
	StatusCode int
}

RequestError indicates that a request to the Lightspark API failed. It could be due to a service outage or a network error. The request should be retried if RequestError is returned with server errors (500-599).

func (RequestError) Error added in v0.12.0

func (e RequestError) Error() string

type Requester

type Requester struct {
	ApiTokenClientId string

	ApiTokenClientSecret string

	BaseUrl *string

	HTTPClient *http.Client
}

func NewRequester added in v0.7.1

func NewRequester(apiTokenClientId string, apiTokenClientSecret string) *Requester

func NewRequesterWithBaseUrl added in v0.7.1

func NewRequesterWithBaseUrl(apiTokenClientId string, apiTokenClientSecret string, baseUrl *string) *Requester

func (*Requester) ExecuteGraphql

func (r *Requester) ExecuteGraphql(query string, variables map[string]interface{},
	signingKey SigningKey,
) (map[string]interface{}, error)

func (*Requester) ExecuteGraphqlWithContext added in v0.13.0

func (r *Requester) ExecuteGraphqlWithContext(ctx context.Context, query string, variables map[string]interface{},
	signingKey SigningKey,
) (map[string]interface{}, error)

type RsaSigningKey

type RsaSigningKey struct {
	PrivateKey []byte
}

func (*RsaSigningKey) Sign

func (s *RsaSigningKey) Sign(payload []byte) ([]byte, error)

type Secp256k1SigningKey

type Secp256k1SigningKey struct {
	PrivateKey []byte
}

func (*Secp256k1SigningKey) Sign

func (s *Secp256k1SigningKey) Sign(payload []byte) ([]byte, error)

type SigningKey

type SigningKey interface {
	Sign(payload []byte) ([]byte, error)
}

Jump to

Keyboard shortcuts

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