stytch

package
v16.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 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 BaseURLType

type BaseURLType string

type Client

type Client interface {
	NewRequest(ctx context.Context, params RequestParams) error
	RawRequest(ctx context.Context, params RequestParams) ([]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,
	params RequestParams,
) error

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

func (*DefaultClient) RawRequest

func (c *DefaultClient) RawRequest(
	ctx context.Context,
	params RequestParams,
) ([]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.

type RequestParams

type RequestParams struct {
	Method      string
	Path        string
	QueryParams map[string]string
	Body        []byte
	V           interface{}
	Headers     map[string][]string
	BaseURLType BaseURLType
}

Jump to

Keyboard shortcuts

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