go-kimai/client/user/post_api_users_parameters.go
2023-01-17 12:34:18 +01:00

151 lines
4.1 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package user
// This file was generated by the swagger tool.
// Editing this file might prove futile when you re-run the swagger generate command
import (
"context"
"net/http"
"time"
"github.com/go-openapi/errors"
"github.com/go-openapi/runtime"
cr "github.com/go-openapi/runtime/client"
"github.com/go-openapi/strfmt"
"github.com/decentral1se/go-kimai/models"
)
// NewPostAPIUsersParams creates a new PostAPIUsersParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewPostAPIUsersParams() *PostAPIUsersParams {
return &PostAPIUsersParams{
timeout: cr.DefaultTimeout,
}
}
// NewPostAPIUsersParamsWithTimeout creates a new PostAPIUsersParams object
// with the ability to set a timeout on a request.
func NewPostAPIUsersParamsWithTimeout(timeout time.Duration) *PostAPIUsersParams {
return &PostAPIUsersParams{
timeout: timeout,
}
}
// NewPostAPIUsersParamsWithContext creates a new PostAPIUsersParams object
// with the ability to set a context for a request.
func NewPostAPIUsersParamsWithContext(ctx context.Context) *PostAPIUsersParams {
return &PostAPIUsersParams{
Context: ctx,
}
}
// NewPostAPIUsersParamsWithHTTPClient creates a new PostAPIUsersParams object
// with the ability to set a custom HTTPClient for a request.
func NewPostAPIUsersParamsWithHTTPClient(client *http.Client) *PostAPIUsersParams {
return &PostAPIUsersParams{
HTTPClient: client,
}
}
/*
PostAPIUsersParams contains all the parameters to send to the API endpoint
for the post API users operation.
Typically these are written to a http.Request.
*/
type PostAPIUsersParams struct {
// Body.
Body *models.UserCreateForm
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the post API users params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIUsersParams) WithDefaults() *PostAPIUsersParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the post API users params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *PostAPIUsersParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the post API users params
func (o *PostAPIUsersParams) WithTimeout(timeout time.Duration) *PostAPIUsersParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the post API users params
func (o *PostAPIUsersParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the post API users params
func (o *PostAPIUsersParams) WithContext(ctx context.Context) *PostAPIUsersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the post API users params
func (o *PostAPIUsersParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the post API users params
func (o *PostAPIUsersParams) WithHTTPClient(client *http.Client) *PostAPIUsersParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the post API users params
func (o *PostAPIUsersParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBody adds the body to the post API users params
func (o *PostAPIUsersParams) WithBody(body *models.UserCreateForm) *PostAPIUsersParams {
o.SetBody(body)
return o
}
// SetBody adds the body to the post API users params
func (o *PostAPIUsersParams) SetBody(body *models.UserCreateForm) {
o.Body = body
}
// WriteToRequest writes these params to a swagger request
func (o *PostAPIUsersParams) 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
}