users

package
v0.12.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2024 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// StatusActive is the active value of the `Status` field in `User`
	StatusActive = "active"
	// StatusPending is the pending value of the `Status` field in `User`
	StatusPending = "pending"
	// StatusError is the error value of the `Status` field in `User`
	StatusError = "error"
	// StatusDeleting is the deleting value of the `Status` field in `User`
	StatusDeleting = "deleting"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type API

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

func NewAPI

func NewAPI(client HttpClient, taskWaiter TaskWaiter, logger Log) *API

func (*API) Create

func (a *API) Create(ctx context.Context, user CreateUserRequest) (int, error)

Create will create a new user and return the identifier of the user.

func (*API) Delete

func (a *API) Delete(ctx context.Context, id int) error

Delete will destroy an existing user.

func (*API) Get

func (a *API) Get(ctx context.Context, id int) (*GetUserResponse, error)

Get will retrieve an existing user.

func (*API) List

func (a *API) List(ctx context.Context) ([]*GetUserResponse, error)

List will list all of the current account's users.

func (*API) Update

func (a *API) Update(ctx context.Context, id int, user UpdateUserRequest) error

Update will make changes to an existing user.

type CreateUserRequest

type CreateUserRequest struct {
	Name     *string `json:"name,omitempty"`
	Role     *string `json:"role,omitempty"`
	Password *string `json:"password,omitempty"`
}

func (CreateUserRequest) String

func (o CreateUserRequest) String() string

type GetUserResponse

type GetUserResponse struct {
	ID     *int    `json:"id,omitempty"`
	Name   *string `json:"name,omitempty"`
	Role   *string `json:"role,omitempty"`
	Status *string `json:"status,omitempty"`
}

func (GetUserResponse) String

func (o GetUserResponse) String() string

type HttpClient

type HttpClient interface {
	Get(ctx context.Context, name, path string, responseBody interface{}) error
	Post(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error
	Put(ctx context.Context, name, path string, requestBody interface{}, responseBody interface{}) error
	Delete(ctx context.Context, name, path string, responseBody interface{}) error
}

type ListUsersResponse

type ListUsersResponse struct {
	AccountId *int               `json:"accountId,omitempty"`
	Users     []*GetUserResponse `json:"users,omitempty"`
}

func (ListUsersResponse) String

func (o ListUsersResponse) String() string

type Log

type Log interface {
	Printf(format string, args ...interface{})
}

type NotFound added in v0.5.1

type NotFound struct {
	ID int
}

func (*NotFound) Error added in v0.5.1

func (f *NotFound) Error() string

type TaskWaiter added in v0.9.0

type TaskWaiter interface {
	WaitForResourceId(ctx context.Context, id string) (int, error)
	Wait(ctx context.Context, id string) error
}

type UpdateUserRequest

type UpdateUserRequest struct {
	Role     *string `json:"role,omitempty"`
	Password *string `json:"password,omitempty"`
}

func (UpdateUserRequest) String

func (o UpdateUserRequest) String() string

Jump to

Keyboard shortcuts

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