mirror of
https://github.com/hanzoai/go-fulfillment.git
synced 2026-10-30 18:36:06 +00:00
141 lines
3.6 KiB
Go
141 lines
3.6 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package auth
|
|
|
|
// This file was generated by the swagger tool.
|
|
// Editing this file might prove futile when you re-run the swagger generate command
|
|
|
|
import (
|
|
"net/http"
|
|
"time"
|
|
|
|
"golang.org/x/net/context"
|
|
|
|
"github.com/go-openapi/errors"
|
|
"github.com/go-openapi/runtime"
|
|
cr "github.com/go-openapi/runtime/client"
|
|
|
|
strfmt "github.com/go-openapi/strfmt"
|
|
|
|
models "go-fulfillment/models"
|
|
)
|
|
|
|
// NewGenerateTokenParams creates a new GenerateTokenParams object
|
|
// with the default values initialized.
|
|
func NewGenerateTokenParams() *GenerateTokenParams {
|
|
var ()
|
|
return &GenerateTokenParams{
|
|
|
|
timeout: cr.DefaultTimeout,
|
|
}
|
|
}
|
|
|
|
// NewGenerateTokenParamsWithTimeout creates a new GenerateTokenParams object
|
|
// with the default values initialized, and the ability to set a timeout on a request
|
|
func NewGenerateTokenParamsWithTimeout(timeout time.Duration) *GenerateTokenParams {
|
|
var ()
|
|
return &GenerateTokenParams{
|
|
|
|
timeout: timeout,
|
|
}
|
|
}
|
|
|
|
// NewGenerateTokenParamsWithContext creates a new GenerateTokenParams object
|
|
// with the default values initialized, and the ability to set a context for a request
|
|
func NewGenerateTokenParamsWithContext(ctx context.Context) *GenerateTokenParams {
|
|
var ()
|
|
return &GenerateTokenParams{
|
|
|
|
Context: ctx,
|
|
}
|
|
}
|
|
|
|
// NewGenerateTokenParamsWithHTTPClient creates a new GenerateTokenParams object
|
|
// with the default values initialized, and the ability to set a custom HTTPClient for a request
|
|
func NewGenerateTokenParamsWithHTTPClient(client *http.Client) *GenerateTokenParams {
|
|
var ()
|
|
return &GenerateTokenParams{
|
|
HTTPClient: client,
|
|
}
|
|
}
|
|
|
|
/*GenerateTokenParams contains all the parameters to send to the API endpoint
|
|
for the generate token operation typically these are written to a http.Request
|
|
*/
|
|
type GenerateTokenParams struct {
|
|
|
|
/*Body
|
|
Get an access token
|
|
|
|
*/
|
|
Body *models.AccessTokenRequest
|
|
|
|
timeout time.Duration
|
|
Context context.Context
|
|
HTTPClient *http.Client
|
|
}
|
|
|
|
// WithTimeout adds the timeout to the generate token params
|
|
func (o *GenerateTokenParams) WithTimeout(timeout time.Duration) *GenerateTokenParams {
|
|
o.SetTimeout(timeout)
|
|
return o
|
|
}
|
|
|
|
// SetTimeout adds the timeout to the generate token params
|
|
func (o *GenerateTokenParams) SetTimeout(timeout time.Duration) {
|
|
o.timeout = timeout
|
|
}
|
|
|
|
// WithContext adds the context to the generate token params
|
|
func (o *GenerateTokenParams) WithContext(ctx context.Context) *GenerateTokenParams {
|
|
o.SetContext(ctx)
|
|
return o
|
|
}
|
|
|
|
// SetContext adds the context to the generate token params
|
|
func (o *GenerateTokenParams) SetContext(ctx context.Context) {
|
|
o.Context = ctx
|
|
}
|
|
|
|
// WithHTTPClient adds the HTTPClient to the generate token params
|
|
func (o *GenerateTokenParams) WithHTTPClient(client *http.Client) *GenerateTokenParams {
|
|
o.SetHTTPClient(client)
|
|
return o
|
|
}
|
|
|
|
// SetHTTPClient adds the HTTPClient to the generate token params
|
|
func (o *GenerateTokenParams) SetHTTPClient(client *http.Client) {
|
|
o.HTTPClient = client
|
|
}
|
|
|
|
// WithBody adds the body to the generate token params
|
|
func (o *GenerateTokenParams) WithBody(body *models.AccessTokenRequest) *GenerateTokenParams {
|
|
o.SetBody(body)
|
|
return o
|
|
}
|
|
|
|
// SetBody adds the body to the generate token params
|
|
func (o *GenerateTokenParams) SetBody(body *models.AccessTokenRequest) {
|
|
o.Body = body
|
|
}
|
|
|
|
// WriteToRequest writes these params to a swagger request
|
|
func (o *GenerateTokenParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
|
|
|
if err := r.SetTimeout(o.timeout); err != nil {
|
|
return err
|
|
}
|
|
var res []error
|
|
|
|
if o.Body != nil {
|
|
if err := r.SetBodyParam(o.Body); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|