78 lines
1.5 KiB
Go
78 lines
1.5 KiB
Go
// Code generated by ogen, DO NOT EDIT.
|
|
|
|
package gsn
|
|
|
|
import (
|
|
"net/http"
|
|
|
|
"github.com/google/uuid"
|
|
|
|
"github.com/ogen-go/ogen/conv"
|
|
"github.com/ogen-go/ogen/middleware"
|
|
"github.com/ogen-go/ogen/ogenerrors"
|
|
"github.com/ogen-go/ogen/uri"
|
|
)
|
|
|
|
// UnsubscribeParams is parameters of Unsubscribe operation.
|
|
type UnsubscribeParams struct {
|
|
ID OptUUID
|
|
}
|
|
|
|
func unpackUnsubscribeParams(packed middleware.Parameters) (params UnsubscribeParams) {
|
|
{
|
|
key := middleware.ParameterKey{
|
|
Name: "id",
|
|
In: "query",
|
|
}
|
|
if v, ok := packed[key]; ok {
|
|
params.ID = v.(OptUUID)
|
|
}
|
|
}
|
|
return params
|
|
}
|
|
|
|
func decodeUnsubscribeParams(args [0]string, argsEscaped bool, r *http.Request) (params UnsubscribeParams, _ error) {
|
|
q := uri.NewQueryDecoder(r.URL.Query())
|
|
// Decode query: id.
|
|
if err := func() error {
|
|
cfg := uri.QueryParameterDecodingConfig{
|
|
Name: "id",
|
|
Style: uri.QueryStyleForm,
|
|
Explode: true,
|
|
}
|
|
|
|
if err := q.HasParam(cfg); err == nil {
|
|
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
|
|
var paramsDotIDVal uuid.UUID
|
|
if err := func() error {
|
|
val, err := d.DecodeValue()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
c, err := conv.ToUUID(val)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
paramsDotIDVal = c
|
|
return nil
|
|
}(); err != nil {
|
|
return err
|
|
}
|
|
params.ID.SetTo(paramsDotIDVal)
|
|
return nil
|
|
}); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}(); err != nil {
|
|
return params, &ogenerrors.DecodeParamError{
|
|
Name: "id",
|
|
In: "query",
|
|
Err: err,
|
|
}
|
|
}
|
|
return params, nil
|
|
}
|