v1.8.0
This commit is contained in:
@@ -4,13 +4,15 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ListRequest struct to get all non deleted user instances.
|
||||
type ListRequest struct {
|
||||
// Find by ID.
|
||||
// Required: false
|
||||
ByID uint64 `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
ByID string `url:"by_id,omitempty" json:"by_id,omitempty"`
|
||||
|
||||
// Find by active. True or False.
|
||||
// Required: false
|
||||
@@ -20,6 +22,10 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
ServiceAccount bool `url:"serviceaccount,omitempty" json:"serviceaccount,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page number.
|
||||
// Required: false
|
||||
Page uint64 `url:"page,omitempty" json:"page,omitempty"`
|
||||
@@ -31,6 +37,7 @@ type ListRequest struct {
|
||||
|
||||
// List gets all non deleted user instances as a ListUsers struct
|
||||
func (u User) List(ctx context.Context, req ListRequest) (*ListUsers, error) {
|
||||
|
||||
res, err := u.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -48,6 +55,12 @@ func (u User) List(ctx context.Context, req ListRequest) (*ListUsers, error) {
|
||||
|
||||
// ListRaw gets all non deleted user instances as an array of bytes
|
||||
func (u User) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/user/list"
|
||||
|
||||
res, err := u.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
|
||||
Reference in New Issue
Block a user