autogits/bots-common/gitea-generated/client/admin/admin_search_users_parameters.go
Adam Majer 598ecbbd5a .
2024-07-07 21:12:40 +02:00

269 lines
6.5 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package admin
// 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/go-openapi/swag"
)
// NewAdminSearchUsersParams creates a new AdminSearchUsersParams 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 NewAdminSearchUsersParams() *AdminSearchUsersParams {
return &AdminSearchUsersParams{
timeout: cr.DefaultTimeout,
}
}
// NewAdminSearchUsersParamsWithTimeout creates a new AdminSearchUsersParams object
// with the ability to set a timeout on a request.
func NewAdminSearchUsersParamsWithTimeout(timeout time.Duration) *AdminSearchUsersParams {
return &AdminSearchUsersParams{
timeout: timeout,
}
}
// NewAdminSearchUsersParamsWithContext creates a new AdminSearchUsersParams object
// with the ability to set a context for a request.
func NewAdminSearchUsersParamsWithContext(ctx context.Context) *AdminSearchUsersParams {
return &AdminSearchUsersParams{
Context: ctx,
}
}
// NewAdminSearchUsersParamsWithHTTPClient creates a new AdminSearchUsersParams object
// with the ability to set a custom HTTPClient for a request.
func NewAdminSearchUsersParamsWithHTTPClient(client *http.Client) *AdminSearchUsersParams {
return &AdminSearchUsersParams{
HTTPClient: client,
}
}
/*
AdminSearchUsersParams contains all the parameters to send to the API endpoint
for the admin search users operation.
Typically these are written to a http.Request.
*/
type AdminSearchUsersParams struct {
/* Limit.
page size of results
*/
Limit *int64
/* LoginName.
user's login name to search for
*/
LoginName *string
/* Page.
page number of results to return (1-based)
*/
Page *int64
/* SourceID.
ID of the user's login source to search for
Format: int64
*/
SourceID *int64
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the admin search users params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AdminSearchUsersParams) WithDefaults() *AdminSearchUsersParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the admin search users params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *AdminSearchUsersParams) SetDefaults() {
// no default values defined for this parameter
}
// WithTimeout adds the timeout to the admin search users params
func (o *AdminSearchUsersParams) WithTimeout(timeout time.Duration) *AdminSearchUsersParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the admin search users params
func (o *AdminSearchUsersParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the admin search users params
func (o *AdminSearchUsersParams) WithContext(ctx context.Context) *AdminSearchUsersParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the admin search users params
func (o *AdminSearchUsersParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the admin search users params
func (o *AdminSearchUsersParams) WithHTTPClient(client *http.Client) *AdminSearchUsersParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the admin search users params
func (o *AdminSearchUsersParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLimit adds the limit to the admin search users params
func (o *AdminSearchUsersParams) WithLimit(limit *int64) *AdminSearchUsersParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the admin search users params
func (o *AdminSearchUsersParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithLoginName adds the loginName to the admin search users params
func (o *AdminSearchUsersParams) WithLoginName(loginName *string) *AdminSearchUsersParams {
o.SetLoginName(loginName)
return o
}
// SetLoginName adds the loginName to the admin search users params
func (o *AdminSearchUsersParams) SetLoginName(loginName *string) {
o.LoginName = loginName
}
// WithPage adds the page to the admin search users params
func (o *AdminSearchUsersParams) WithPage(page *int64) *AdminSearchUsersParams {
o.SetPage(page)
return o
}
// SetPage adds the page to the admin search users params
func (o *AdminSearchUsersParams) SetPage(page *int64) {
o.Page = page
}
// WithSourceID adds the sourceID to the admin search users params
func (o *AdminSearchUsersParams) WithSourceID(sourceID *int64) *AdminSearchUsersParams {
o.SetSourceID(sourceID)
return o
}
// SetSourceID adds the sourceId to the admin search users params
func (o *AdminSearchUsersParams) SetSourceID(sourceID *int64) {
o.SourceID = sourceID
}
// WriteToRequest writes these params to a swagger request
func (o *AdminSearchUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.Limit != nil {
// query param limit
var qrLimit int64
if o.Limit != nil {
qrLimit = *o.Limit
}
qLimit := swag.FormatInt64(qrLimit)
if qLimit != "" {
if err := r.SetQueryParam("limit", qLimit); err != nil {
return err
}
}
}
if o.LoginName != nil {
// query param login_name
var qrLoginName string
if o.LoginName != nil {
qrLoginName = *o.LoginName
}
qLoginName := qrLoginName
if qLoginName != "" {
if err := r.SetQueryParam("login_name", qLoginName); err != nil {
return err
}
}
}
if o.Page != nil {
// query param page
var qrPage int64
if o.Page != nil {
qrPage = *o.Page
}
qPage := swag.FormatInt64(qrPage)
if qPage != "" {
if err := r.SetQueryParam("page", qPage); err != nil {
return err
}
}
}
if o.SourceID != nil {
// query param source_id
var qrSourceID int64
if o.SourceID != nil {
qrSourceID = *o.SourceID
}
qSourceID := swag.FormatInt64(qrSourceID)
if qSourceID != "" {
if err := r.SetQueryParam("source_id", qSourceID); err != nil {
return err
}
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}