stytch

package
v10.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2023 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{}) error
	RawRequest(ctx context.Context, method string, path string, queryParams map[string]string, body []byte) ([]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 added in v10.1.0

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{},
) 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,
) ([]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