Documentation ¶
Index ¶
- Constants
- type API
- func (a *API) Create(ctx context.Context, user CreateUserRequest) (int, error)
- func (a *API) Delete(ctx context.Context, id int) error
- func (a *API) Get(ctx context.Context, id int) (*GetUserResponse, error)
- func (a *API) List(ctx context.Context) ([]*GetUserResponse, error)
- func (a *API) Update(ctx context.Context, id int, user UpdateUserRequest) error
- type CreateUserRequest
- type GetUserResponse
- type HttpClient
- type ListUsersResponse
- type Log
- type NotFound
- type TaskWaiter
- type UpdateUserRequest
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
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 TaskWaiter ¶ added in v0.9.0
type UpdateUserRequest ¶
type UpdateUserRequest struct { Role *string `json:"role,omitempty"` Password *string `json:"password,omitempty"` }
func (UpdateUserRequest) String ¶
func (o UpdateUserRequest) String() string
Click to show internal directories.
Click to hide internal directories.