client

package
v0.0.0-...-4ce15e1 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2022 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultHTTPClient = &http.Client{
	Timeout: time.Second * 10,
}
View Source
var WithDefaultHeaders = func(headers map[string][]string) Option {
	return func(c *Client) {
		c.defaultHeaders = headers
	}
}
View Source
var WithHTTPClient = func(client *http.Client) Option {
	return func(c *Client) {
		c.client = client
	}
}
View Source
var WithSession = func(userID uuid.UUID, refreshToken, accessToken string) Option {
	return func(c *Client) {
		c.currentUserID = userID
		c.refreshToken = refreshToken
		c.accessToken = accessToken
	}
}

Functions

This section is empty.

Types

type Client

type Client struct {
	Users   *usersResource
	Entries *entriesResource
	// contains filtered or unexported fields
}

func NewClient

func NewClient(baseURL string, opts ...Option) *Client

type CreateEntryRequest

type CreateEntryRequest struct {
	Name            string    `json:"name"`
	SenderID        uuid.UUID `json:"senderId"`
	SendToEmail     string    `json:"sendToEmail"`
	Value           string    `json:"value"`
	Secret          string    `json:"secret"`
	DurationMinutes int       `json:"duration"`
}

type CreateEntryResponse

type CreateEntryResponse struct {
	Success bool           `json:"success"`
	Errors  []string       `json:"errors"`
	Entry   *sendkey.Entry `json:"entry"`
}

type CreateUserRequest

type CreateUserRequest struct {
	Email     string `json:"email"`
	Password  string `json:"password"`
	FirstName string `json:"firstName"`
	LastName  string `json:"lastName"`
}

type CreateUserResponse

type CreateUserResponse struct {
	Success bool          `json:"success"`
	Errors  []string      `json:"errors"`
	User    *sendkey.User `json:"user"`
}

type Error

type Error struct {
	UserID     uuid.UUID `json:"userId"`
	StatusCode int       `json:"statusCode"`
	Message    string    `json:"message"`
}

type LoginResponseModel

type LoginResponseModel struct {
	Success      bool          `json:"success"`
	Errors       []string      `json:"errors"`
	User         *sendkey.User `json:"user"`
	AccessToken  *Token        `json:"accessToken"`
	RefreshToken *Token        `json:"refreshToken"`
}

type Option

type Option func(c *Client)

type Token

type Token struct {
	Token   string `json:"token"`
	Expires int64  `json:"expires"`
}

Jump to

Keyboard shortcuts

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