stytch

package
v15.10.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EnvTest = config.EnvTest
	EnvLive = config.EnvLive
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	NewRequest(ctx context.Context, method string, path string, queryParams map[string]string, body []byte, v interface{}, headers map[string][]string) error
	RawRequest(ctx context.Context, method string, path string, queryParams map[string]string, body []byte, headers map[string][]string) ([]byte, error)
	GetConfig() *config.Config
	GetHTTPClient() *http.Client
}

type DefaultClient

type DefaultClient struct {
	Config     *config.Config
	HTTPClient *http.Client
}

func New

func New(projectID string, secret string) *DefaultClient

func (*DefaultClient) GetConfig

func (c *DefaultClient) GetConfig() *config.Config

func (*DefaultClient) GetHTTPClient

func (c *DefaultClient) GetHTTPClient() *http.Client

func (*DefaultClient) NewRequest

func (c *DefaultClient) NewRequest(
	ctx context.Context,
	method string,
	path string,
	queryParams map[string]string,
	body []byte,
	v interface{},
	headers map[string][]string,
) error

newRequest is used by Call to generate and Do a http.Request

func (*DefaultClient) RawRequest

func (c *DefaultClient) RawRequest(
	ctx context.Context,
	method string,
	path string,
	queryParams map[string]string,
	body []byte,
	headers map[string][]string,
) ([]byte, error)

RawRequest sends the request and returns the successful response body as bytes. If the response is an error, the response body will be parsed and returned as (nil, stytcherror.Error).

Prefer using NewRequest (which unmarshals the response JSON) unless you need the actual bytes.

Jump to

Keyboard shortcuts

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