update go.mod and imports

This commit is contained in:
2023-03-17 12:54:34 +03:00
parent f3a1a4c83f
commit 437841c8dd
268 changed files with 4019 additions and 2045 deletions

View File

@@ -3,30 +3,25 @@ package bservice
import (
"context"
"encoding/json"
"errors"
"net/http"
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
)
// Request struct for get detailed information about service
type GetRequest struct {
// ID of the service to query information
// Required: true
ServiceID uint64 `url:"serviceId" json:"serviceId"`
}
func (bsrq GetRequest) validate() error {
if bsrq.ServiceID == 0 {
return errors.New("field ServiceID can not be empty or equal to 0")
}
return nil
ServiceID uint64 `url:"serviceId" json:"serviceId" validate:"required"`
}
// Get gets detailed specifications for the BasicService.
func (b BService) Get(ctx context.Context, req GetRequest) (*RecordBasicService, error) {
err := req.validate()
err := validators.ValidateRequest(req)
if err != nil {
return nil, err
for _, validationError := range validators.GetErrors(err) {
return nil, validators.ValidationError(validationError)
}
}
url := "/cloudapi/bservice/get"