go-kimai/client/timesheet/get_api_timesheets_recent_parameters.go

207 lines
5.8 KiB
Go
Raw Normal View History

2023-01-14 14:14:06 +00:00
// Code generated by go-swagger; DO NOT EDIT.
package timesheet
// 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"
)
// NewGetAPITimesheetsRecentParams creates a new GetAPITimesheetsRecentParams 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 NewGetAPITimesheetsRecentParams() *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
timeout: cr.DefaultTimeout,
}
}
// NewGetAPITimesheetsRecentParamsWithTimeout creates a new GetAPITimesheetsRecentParams object
// with the ability to set a timeout on a request.
func NewGetAPITimesheetsRecentParamsWithTimeout(timeout time.Duration) *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
timeout: timeout,
}
}
// NewGetAPITimesheetsRecentParamsWithContext creates a new GetAPITimesheetsRecentParams object
// with the ability to set a context for a request.
func NewGetAPITimesheetsRecentParamsWithContext(ctx context.Context) *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
Context: ctx,
}
}
// NewGetAPITimesheetsRecentParamsWithHTTPClient creates a new GetAPITimesheetsRecentParams object
// with the ability to set a custom HTTPClient for a request.
func NewGetAPITimesheetsRecentParamsWithHTTPClient(client *http.Client) *GetAPITimesheetsRecentParams {
return &GetAPITimesheetsRecentParams{
HTTPClient: client,
}
}
/*
GetAPITimesheetsRecentParams contains all the parameters to send to the API endpoint
for the get API timesheets recent operation.
Typically these are written to a http.Request.
*/
type GetAPITimesheetsRecentParams struct {
/* Begin.
Only records after this date will be included. Default: today - 1 year (format: HTML5)
Format: DateTime
*/
Begin string
/* Size.
The amount of entries (default: 10)
*/
Size string
/* User.
User ID to filter timesheets. Needs permission 'view_other_timesheet', pass 'all' to fetch data for all user (default: current user)
*/
User string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the get API timesheets recent params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITimesheetsRecentParams) WithDefaults() *GetAPITimesheetsRecentParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the get API timesheets recent params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *GetAPITimesheetsRecentParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithTimeout(timeout time.Duration) *GetAPITimesheetsRecentParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithContext(ctx context.Context) *GetAPITimesheetsRecentParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithHTTPClient(client *http.Client) *GetAPITimesheetsRecentParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithBegin adds the begin to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithBegin(begin string) *GetAPITimesheetsRecentParams {
o.SetBegin(begin)
return o
}
// SetBegin adds the begin to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetBegin(begin string) {
o.Begin = begin
}
// WithSize adds the size to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithSize(size string) *GetAPITimesheetsRecentParams {
o.SetSize(size)
return o
}
// SetSize adds the size to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetSize(size string) {
o.Size = size
}
// WithUser adds the user to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) WithUser(user string) *GetAPITimesheetsRecentParams {
o.SetUser(user)
return o
}
// SetUser adds the user to the get API timesheets recent params
func (o *GetAPITimesheetsRecentParams) SetUser(user string) {
o.User = user
}
// WriteToRequest writes these params to a swagger request
func (o *GetAPITimesheetsRecentParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// query param begin
qrBegin := o.Begin
qBegin := qrBegin
if err := r.SetQueryParam("begin", qBegin); err != nil {
return err
}
// query param size
qrSize := o.Size
qSize := qrSize
if err := r.SetQueryParam("size", qSize); err != nil {
return err
}
// query param user
qrUser := o.User
qUser := qrUser
if err := r.SetQueryParam("user", qUser); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}