downvote
All checks were successful
continuous-integration/drone/promote/production Build is passing
continuous-integration/drone/push Build is passing

This commit is contained in:
2024-04-23 21:13:27 +03:00
parent d56846b1cb
commit 5adc151104
5 changed files with 71 additions and 18 deletions

View File

@@ -160,6 +160,13 @@ func init() {
"name": "project_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Session UUID",
"name": "session_uuid",
"in": "query",
"required": true
}
],
"responses": {
@@ -365,6 +372,13 @@ func init() {
"name": "project_id",
"in": "path",
"required": true
},
{
"type": "string",
"description": "Session UUID",
"name": "session_uuid",
"in": "query",
"required": true
}
],
"responses": {

View File

@@ -9,8 +9,10 @@ import (
"net/http"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
"github.com/go-openapi/runtime/middleware"
"github.com/go-openapi/strfmt"
"github.com/go-openapi/validate"
)
// NewGetFeedbacksForProjectParams creates a new GetFeedbacksForProjectParams object
@@ -35,6 +37,11 @@ type GetFeedbacksForProjectParams struct {
In: path
*/
ProjectID string
/*Session UUID
Required: true
In: query
*/
SessionUUID string
}
// BindRequest both binds and validates a request, it assumes that complex things implement a Validatable(strfmt.Registry) error interface
@@ -46,10 +53,17 @@ func (o *GetFeedbacksForProjectParams) BindRequest(r *http.Request, route *middl
o.HTTPRequest = r
qs := runtime.Values(r.URL.Query())
rProjectID, rhkProjectID, _ := route.Params.GetOK("project_id")
if err := o.bindProjectID(rProjectID, rhkProjectID, route.Formats); err != nil {
res = append(res, err)
}
qSessionUUID, qhkSessionUUID, _ := qs.GetOK("session_uuid")
if err := o.bindSessionUUID(qSessionUUID, qhkSessionUUID, route.Formats); err != nil {
res = append(res, err)
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
@@ -69,3 +83,24 @@ func (o *GetFeedbacksForProjectParams) bindProjectID(rawData []string, hasKey bo
return nil
}
// bindSessionUUID binds and validates parameter SessionUUID from query.
func (o *GetFeedbacksForProjectParams) bindSessionUUID(rawData []string, hasKey bool, formats strfmt.Registry) error {
if !hasKey {
return errors.Required("session_uuid", "query", rawData)
}
var raw string
if len(rawData) > 0 {
raw = rawData[len(rawData)-1]
}
// Required: true
// AllowEmptyValue: false
if err := validate.RequiredString("session_uuid", "query", raw); err != nil {
return err
}
o.SessionUUID = raw
return nil
}

View File

@@ -16,6 +16,8 @@ import (
type GetFeedbacksForProjectURL struct {
ProjectID string
SessionUUID string
_basePath string
// avoid unkeyed usage
_ struct{}
@@ -55,6 +57,15 @@ func (o *GetFeedbacksForProjectURL) Build() (*url.URL, error) {
}
_result.Path = golangswaggerpaths.Join(_basePath, _path)
qs := make(url.Values)
sessionUUIDQ := o.SessionUUID
if sessionUUIDQ != "" {
qs.Set("session_uuid", sessionUUIDQ)
}
_result.RawQuery = qs.Encode()
return &_result, nil
}