This commit is contained in:
2023-10-23 12:40:54 +03:00
parent b069c31745
commit b666789c7d
73 changed files with 1134 additions and 641 deletions

View File

@@ -8,25 +8,16 @@ import (
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Reuqest struct for getting details of the specified group.
// GetRequest struct to get details of the specified group.
type GetRequest struct {
// Group ID
// Required: true
GroupID string `url:"groupId" json:"groupId" validate:"required"`
}
// Get gets details of the specified group.
// Get gets details of the specified group as an ItemGroup struct
func (g Group) Get(ctx context.Context, req GetRequest) (*ItemGroup, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return nil, validators.ValidationError(validationError)
}
}
url := "/cloudbroker/group/get"
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
res, err := g.GetRaw(ctx, req)
if err != nil {
return nil, err
}
@@ -40,3 +31,18 @@ func (g Group) Get(ctx context.Context, req GetRequest) (*ItemGroup, error) {
return &info, nil
}
// GetRaw gets details of the specified group as an array of bytes
func (g Group) GetRaw(ctx context.Context, req GetRequest) ([]byte, error) {
err := validators.ValidateRequest(req)
if err != nil {
for _, validationError := range validators.GetErrors(err) {
return nil, validators.ValidationError(validationError)
}
}
url := "/cloudbroker/group/get"
res, err := g.client.DecortApiCall(ctx, http.MethodPost, url, req)
return res, err
}