v1.11.0
This commit is contained in:
36
pkg/cloudbroker/sep/get_template.go
Normal file
36
pkg/cloudbroker/sep/get_template.go
Normal file
@@ -0,0 +1,36 @@
|
||||
package sep
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net/http"
|
||||
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/validators"
|
||||
)
|
||||
|
||||
// GetTemplateRequest struct to get template of SEP
|
||||
type GetTemplateRequest struct {
|
||||
// Type of SEP
|
||||
// Required: true
|
||||
SepType string `url:"sep_type" json:"sep_type" validate:"required,sepType"`
|
||||
|
||||
// Language of template
|
||||
// Required: true
|
||||
Language string `url:"lang" json:"lang" validate:"required,language"`
|
||||
}
|
||||
|
||||
// GetTemplate gets data to sep template
|
||||
func (s SEP) GetTemplate(ctx context.Context, req GetTemplateRequest) (string, error) {
|
||||
err := validators.ValidateRequest(req)
|
||||
if err != nil {
|
||||
return "", validators.ValidationErrors(validators.GetErrors(err))
|
||||
}
|
||||
|
||||
url := "/cloudbroker/sep/getTemplate"
|
||||
|
||||
res, err := s.client.DecortApiCall(ctx, http.MethodPost, url, req)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
|
||||
return string(res), nil
|
||||
}
|
||||
Reference in New Issue
Block a user