client

package
v0.0.2 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const ItemsPerPage = 50

Variables

This section is empty.

Functions

This section is empty.

Types

type ACL

type ACL string

type Account

type Account struct {
	Balance           float64  `json:"balance"`
	PendingCharges    float64  `json:"pending_charges"`
	Name              string   `json:"name"`
	Email             string   `json:"email"`
	ACLs              []string `json:"acls"`
	LastPaymentDate   string   `json:"last_payment_date"`
	LastPaymentAmount float64  `json:"last_payment_amount"`
}

type AccountResponse

type AccountResponse struct {
	Account Account `json:"account"`
}

type PageOptions

type PageOptions struct {
	Next     string
	PageSize int
}

type PaginationMeta

type PaginationMeta struct {
	Total int `json:"total"`
	Links struct {
		Next string `json:"next"`
		Prev string `json:"prev"`
	} `json:"links"`
}

type ReqOpt

type ReqOpt func(reqURL *url.URL)

func WithPageCursor

func WithPageCursor(nextPageToken string) ReqOpt

func WithPageLimit

func WithPageLimit(pageSize int) ReqOpt

func WithQueryParam

func WithQueryParam(key string, value string) ReqOpt

type User

type User struct {
	Id         string   `json:"id"`
	Name       string   `json:"name"`
	Email      string   `json:"email"`
	ApiEnabled bool     `json:"apiEnabled"`
	ACLs       []string `json:"acls"`
}

type UserResponse

type UserResponse struct {
	Meta   *PaginationMeta `json:"meta"`
	Result []User          `json:"users"`
}

type UserSingleResponse

type UserSingleResponse struct {
	Result User `json:"user"`
}

type VultrClient

type VultrClient struct {
	TokenSource oauth2.TokenSource
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, bearerToken string) (*VultrClient, error)

func NewClient

func NewClient(bearerToken string, httpClient ...*uhttp.BaseHttpClient) (*VultrClient, error)

func (*VultrClient) GetUserByID

func (c *VultrClient) GetUserByID(ctx context.Context, userID string) (User, annotations.Annotations, error)

func (*VultrClient) ListAccountACLs

func (c *VultrClient) ListAccountACLs(ctx context.Context) ([]string, annotations.Annotations, error)

func (*VultrClient) ListUsers

func (c *VultrClient) ListUsers(ctx context.Context, options PageOptions) ([]User, string, annotations.Annotations, error)

Jump to

Keyboard shortcuts

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