briq

package
v0.0.0-...-72d9b95 Latest Latest
Warning

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

Go to latest
Published: Jun 29, 2022 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const (
	UrlMe           = "https://api.givebriq.com/v1/me"
	UrlTransactions = "https://api.givebriq.com/v1/me/transactions"
	UrlUsers        = "https://api.givebriq.com/v1/users"
)
View Source
const (
	AppGive = "give"
)

Variables

View Source
var (
	ErrNotFound error = errors.New("not found")
)

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a Briq API client

func NewClient

func NewClient(token string) (*Client, error)

NewClient creates a new API client. A token is used for authentication.

func (*Client) CreateTransaction

func (client *Client) CreateTransaction(ctx context.Context, req *CreateTransactionRequest) (*CreateTransactionResponse, error)

CreateTransaction creates a transaction, which is the way to give briqs.

func (*Client) GetMe

func (client *Client) GetMe(ctx context.Context, req *GetMeRequest) (*GetMeResponse, error)

func (*Client) GetUser

func (client *Client) GetUser(ctx context.Context, req *GetUserRequest) (*User, error)

func (*Client) ListUsers

func (client *Client) ListUsers(ctx context.Context, req *ListUsersRequest) (*ListUsersResponse, error)

type CreateTransactionRequest

type CreateTransactionRequest struct {
	App     string    `json:"app,omitempty"`
	Comment string    `json:"comment,omitempty"`
	To      uuid.UUID `json:"to,omitempty"`
}

type CreateTransactionResponse

type CreateTransactionResponse struct {
	Amount      int        `json:"amount,omitempty"`
	App         string     `json:"app,omitempty"`
	CreatedAt   *time.Time `json:"created_at,omitempty"`
	From        string     `json:"from,omitempty"`
	Id          uuid.UUID  `json:"id,omitempty"`
	IsAnonymous bool       `json:"isAnonymous,omitempty"`
	ReactedAt   *time.Time `json:"reactedAt,omitempty"`
	Reaction    *string    `json:"reaction,omitempty"`
	To          string     `json:"to,omitempty"`
	UserFromId  *uuid.UUID `json:"user_from_id,omitempty"`
	UserToId    *uuid.UUID `json:"user_to_id,omitempty"`
}

type GetMeRequest

type GetMeRequest struct {
}

type GetMeResponse

type GetMeResponse struct {
	Id              uuid.UUID `json:"id,omitempty"`
	Username        string    `json:"username,omitempty"`
	DisplayName     string    `json:"displayName,omitempty"`
	Email           string    `json:"email,omitempty"`
	FirstName       string    `json:"firstName,omitempty"`
	LastName        string    `json:"lastName,omitempty"`
	ExternalRef     string    `json:"externalRef,omitempty"`
	Image           string    `json:"image,omitempty"`
	Role            string    `json:"role,omitempty"`
	ActiveBalance   int       `json:"activeBalance,omitempty"`
	InactiveBalance int       `json:"inactiveBalance,omitempty"`
}

type GetUserRequest

type GetUserRequest struct {
	Username string `json:"username,omitempty"`
}

type ListUsersRequest

type ListUsersRequest struct {
}

type ListUsersResponse

type ListUsersResponse struct {
	Users []User `json:"users,omitempty"`
}

type User

type User struct {
	Id              uuid.UUID  `json:"id,omitempty"`
	Username        string     `json:"username,omitempty"`
	DisplayName     string     `json:"displayName,omitempty"`
	Email           string     `json:"email,omitempty"`
	ActiveBalance   int        `json:"activeBalance,omitempty"`
	InactiveBalance int        `json:"inactiveBalance,omitempty"`
	CreatedAt       *time.Time `json:"created_at,omitempty"`
	Suspended       bool       `json:"suspended,omitempty"`
	Role            string     `json:"role,omitempty"`
	Points          int        `json:"points,omitempty"`
}

Jump to

Keyboard shortcuts

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