openapi: generate

This commit is contained in:
Quaternions 2025-03-31 19:30:57 -07:00
parent 4e22933e34
commit 581c65594d
Signed by: Quaternions
GPG Key ID: D0DF5964F79AC131
6 changed files with 172 additions and 28 deletions

@ -2491,15 +2491,32 @@ func (c *Client) sendListScripts(ctx context.Context, params ListScriptsParams)
}
}
{
// Encode "SubmissionID" parameter.
// Encode "ResourceType" parameter.
cfg := uri.QueryParameterEncodingConfig{
Name: "SubmissionID",
Name: "ResourceType",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
if val, ok := params.SubmissionID.Get(); ok {
if val, ok := params.ResourceType.Get(); ok {
return e.EncodeValue(conv.Int32ToString(val))
}
return nil
}); err != nil {
return res, errors.Wrap(err, "encode query")
}
}
{
// Encode "ResourceID" parameter.
cfg := uri.QueryParameterEncodingConfig{
Name: "ResourceID",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
if val, ok := params.ResourceID.Get(); ok {
return e.EncodeValue(conv.Int64ToString(val))
}
return nil

@ -3487,9 +3487,13 @@ func (s *Server) handleListScriptsRequest(args [0]string, argsEscaped bool, w ht
In: "query",
}: params.Source,
{
Name: "SubmissionID",
Name: "ResourceType",
In: "query",
}: params.SubmissionID,
}: params.ResourceType,
{
Name: "ResourceID",
In: "query",
}: params.ResourceID,
},
Raw: r,
}

@ -1257,7 +1257,8 @@ type ListScriptsParams struct {
Hash OptString
Name OptString
Source OptString
SubmissionID OptInt64
ResourceType OptInt32
ResourceID OptInt64
}
func unpackListScriptsParams(packed middleware.Parameters) (params ListScriptsParams) {
@ -1304,11 +1305,20 @@ func unpackListScriptsParams(packed middleware.Parameters) (params ListScriptsPa
}
{
key := middleware.ParameterKey{
Name: "SubmissionID",
Name: "ResourceType",
In: "query",
}
if v, ok := packed[key]; ok {
params.SubmissionID = v.(OptInt64)
params.ResourceType = v.(OptInt32)
}
}
{
key := middleware.ParameterKey{
Name: "ResourceID",
In: "query",
}
if v, ok := packed[key]; ok {
params.ResourceID = v.(OptInt64)
}
}
return params
@ -1614,17 +1624,58 @@ func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request)
Err: err,
}
}
// Decode query: SubmissionID.
// Decode query: ResourceType.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "SubmissionID",
Name: "ResourceType",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotSubmissionIDVal int64
var paramsDotResourceTypeVal int32
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt32(val)
if err != nil {
return err
}
paramsDotResourceTypeVal = c
return nil
}(); err != nil {
return err
}
params.ResourceType.SetTo(paramsDotResourceTypeVal)
return nil
}); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "ResourceType",
In: "query",
Err: err,
}
}
// Decode query: ResourceID.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "ResourceID",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotResourceIDVal int64
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
@ -1636,12 +1687,12 @@ func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request)
return err
}
paramsDotSubmissionIDVal = c
paramsDotResourceIDVal = c
return nil
}(); err != nil {
return err
}
params.SubmissionID.SetTo(paramsDotSubmissionIDVal)
params.ResourceID.SetTo(paramsDotResourceIDVal)
return nil
}); err != nil {
return err
@ -1650,7 +1701,7 @@ func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request)
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "SubmissionID",
Name: "ResourceID",
In: "query",
Err: err,
}

@ -967,15 +967,32 @@ func (c *Client) sendListScripts(ctx context.Context, params ListScriptsParams)
}
}
{
// Encode "SubmissionID" parameter.
// Encode "ResourceType" parameter.
cfg := uri.QueryParameterEncodingConfig{
Name: "SubmissionID",
Name: "ResourceType",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
if val, ok := params.SubmissionID.Get(); ok {
if val, ok := params.ResourceType.Get(); ok {
return e.EncodeValue(conv.Int32ToString(val))
}
return nil
}); err != nil {
return res, errors.Wrap(err, "encode query")
}
}
{
// Encode "ResourceID" parameter.
cfg := uri.QueryParameterEncodingConfig{
Name: "ResourceID",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.EncodeParam(cfg, func(e uri.Encoder) error {
if val, ok := params.ResourceID.Get(); ok {
return e.EncodeValue(conv.Int64ToString(val))
}
return nil

@ -1212,9 +1212,13 @@ func (s *Server) handleListScriptsRequest(args [0]string, argsEscaped bool, w ht
In: "query",
}: params.Source,
{
Name: "SubmissionID",
Name: "ResourceType",
In: "query",
}: params.SubmissionID,
}: params.ResourceType,
{
Name: "ResourceID",
In: "query",
}: params.ResourceID,
},
Raw: r,
}

@ -703,7 +703,8 @@ type ListScriptsParams struct {
Hash OptString
Name OptString
Source OptString
SubmissionID OptInt64
ResourceType OptInt32
ResourceID OptInt64
}
func unpackListScriptsParams(packed middleware.Parameters) (params ListScriptsParams) {
@ -750,11 +751,20 @@ func unpackListScriptsParams(packed middleware.Parameters) (params ListScriptsPa
}
{
key := middleware.ParameterKey{
Name: "SubmissionID",
Name: "ResourceType",
In: "query",
}
if v, ok := packed[key]; ok {
params.SubmissionID = v.(OptInt64)
params.ResourceType = v.(OptInt32)
}
}
{
key := middleware.ParameterKey{
Name: "ResourceID",
In: "query",
}
if v, ok := packed[key]; ok {
params.ResourceID = v.(OptInt64)
}
}
return params
@ -1060,17 +1070,58 @@ func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request)
Err: err,
}
}
// Decode query: SubmissionID.
// Decode query: ResourceType.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "SubmissionID",
Name: "ResourceType",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotSubmissionIDVal int64
var paramsDotResourceTypeVal int32
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
return err
}
c, err := conv.ToInt32(val)
if err != nil {
return err
}
paramsDotResourceTypeVal = c
return nil
}(); err != nil {
return err
}
params.ResourceType.SetTo(paramsDotResourceTypeVal)
return nil
}); err != nil {
return err
}
}
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "ResourceType",
In: "query",
Err: err,
}
}
// Decode query: ResourceID.
if err := func() error {
cfg := uri.QueryParameterDecodingConfig{
Name: "ResourceID",
Style: uri.QueryStyleForm,
Explode: true,
}
if err := q.HasParam(cfg); err == nil {
if err := q.DecodeParam(cfg, func(d uri.Decoder) error {
var paramsDotResourceIDVal int64
if err := func() error {
val, err := d.DecodeValue()
if err != nil {
@ -1082,12 +1133,12 @@ func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request)
return err
}
paramsDotSubmissionIDVal = c
paramsDotResourceIDVal = c
return nil
}(); err != nil {
return err
}
params.SubmissionID.SetTo(paramsDotSubmissionIDVal)
params.ResourceID.SetTo(paramsDotResourceIDVal)
return nil
}); err != nil {
return err
@ -1096,7 +1147,7 @@ func decodeListScriptsParams(args [0]string, argsEscaped bool, r *http.Request)
return nil
}(); err != nil {
return params, &ogenerrors.DecodeParamError{
Name: "SubmissionID",
Name: "ResourceID",
In: "query",
Err: err,
}