v1.8.0
This commit is contained in:
@@ -4,6 +4,8 @@ import (
|
||||
"context"
|
||||
"encoding/json"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// ListRequest struct to get list of SEPs
|
||||
@@ -18,7 +20,7 @@ type ListRequest struct {
|
||||
|
||||
// Find by gId
|
||||
// Required: false
|
||||
GID uint64 `url:"gId,omitempty" json:"gId,omitempty"`
|
||||
GID uint64 `url:"gid,omitempty" json:"gid,omitempty"`
|
||||
|
||||
// Find by sep type
|
||||
// Required: false
|
||||
@@ -36,6 +38,10 @@ type ListRequest struct {
|
||||
// Required: false
|
||||
ConsumedBy uint64 `url:"consumedBy,omitempty" json:"consumedBy,omitempty"`
|
||||
|
||||
// Sort by one of supported fields, format +|-(field)
|
||||
// Required: false
|
||||
SortBy string `url:"sortBy,omitempty" json:"sortBy,omitempty" validate:"omitempty,sortBy"`
|
||||
|
||||
// Page size
|
||||
// Required: false
|
||||
Size uint64 `url:"size,omitempty" json:"size,omitempty"`
|
||||
@@ -47,6 +53,7 @@ type ListRequest struct {
|
||||
|
||||
// List gets list of SEPs as a ListSEP struct
|
||||
func (s SEP) List(ctx context.Context, req ListRequest) (*ListSEP, error) {
|
||||
|
||||
res, err := s.ListRaw(ctx, req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@@ -64,6 +71,12 @@ func (s SEP) List(ctx context.Context, req ListRequest) (*ListSEP, error) {
|
||||
|
||||
// ListRaw gets list of SEPs as an array of bytes
|
||||
func (s SEP) ListRaw(ctx context.Context, req ListRequest) ([]byte, error) {
|
||||
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return nil, validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/list"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
|
||||
Reference in New Issue
Block a user