bjerkio/crayon-api-go

View on GitHub
client/users/get_users_parameters.go

Summary

Maintainability
F
4 days
Test Coverage
// Code generated by go-swagger; DO NOT EDIT.

package users

// 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"
)

// NewGetUsersParams creates a new GetUsersParams object
// with the default values initialized.
func NewGetUsersParams() *GetUsersParams {
    var ()
    return &GetUsersParams{

        timeout: cr.DefaultTimeout,
    }
}

// NewGetUsersParamsWithTimeout creates a new GetUsersParams object
// with the default values initialized, and the ability to set a timeout on a request
func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams {
    var ()
    return &GetUsersParams{

        timeout: timeout,
    }
}

// NewGetUsersParamsWithContext creates a new GetUsersParams object
// with the default values initialized, and the ability to set a context for a request
func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams {
    var ()
    return &GetUsersParams{

        Context: ctx,
    }
}

// NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object
// with the default values initialized, and the ability to set a custom HTTPClient for a request
func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams {
    var ()
    return &GetUsersParams{
        HTTPClient: client,
    }
}

/*GetUsersParams contains all the parameters to send to the API endpoint
for the get users operation typically these are written to a http.Request
*/
type GetUsersParams struct {

    /*OrganizationID*/
    OrganizationID *int32
    /*Page*/
    Page *int32
    /*PageSize*/
    PageSize *int32
    /*Role*/
    Role *string
    /*Search*/
    Search *string

    timeout    time.Duration
    Context    context.Context
    HTTPClient *http.Client
}

// WithTimeout adds the timeout to the get users params
func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams {
    o.SetTimeout(timeout)
    return o
}

// SetTimeout adds the timeout to the get users params
func (o *GetUsersParams) SetTimeout(timeout time.Duration) {
    o.timeout = timeout
}

// WithContext adds the context to the get users params
func (o *GetUsersParams) WithContext(ctx context.Context) *GetUsersParams {
    o.SetContext(ctx)
    return o
}

// SetContext adds the context to the get users params
func (o *GetUsersParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the get users params
func (o *GetUsersParams) WithHTTPClient(client *http.Client) *GetUsersParams {
    o.SetHTTPClient(client)
    return o
}

// SetHTTPClient adds the HTTPClient to the get users params
func (o *GetUsersParams) SetHTTPClient(client *http.Client) {
    o.HTTPClient = client
}

// WithOrganizationID adds the organizationID to the get users params
func (o *GetUsersParams) WithOrganizationID(organizationID *int32) *GetUsersParams {
    o.SetOrganizationID(organizationID)
    return o
}

// SetOrganizationID adds the organizationId to the get users params
func (o *GetUsersParams) SetOrganizationID(organizationID *int32) {
    o.OrganizationID = organizationID
}

// WithPage adds the page to the get users params
func (o *GetUsersParams) WithPage(page *int32) *GetUsersParams {
    o.SetPage(page)
    return o
}

// SetPage adds the page to the get users params
func (o *GetUsersParams) SetPage(page *int32) {
    o.Page = page
}

// WithPageSize adds the pageSize to the get users params
func (o *GetUsersParams) WithPageSize(pageSize *int32) *GetUsersParams {
    o.SetPageSize(pageSize)
    return o
}

// SetPageSize adds the pageSize to the get users params
func (o *GetUsersParams) SetPageSize(pageSize *int32) {
    o.PageSize = pageSize
}

// WithRole adds the role to the get users params
func (o *GetUsersParams) WithRole(role *string) *GetUsersParams {
    o.SetRole(role)
    return o
}

// SetRole adds the role to the get users params
func (o *GetUsersParams) SetRole(role *string) {
    o.Role = role
}

// WithSearch adds the search to the get users params
func (o *GetUsersParams) WithSearch(search *string) *GetUsersParams {
    o.SetSearch(search)
    return o
}

// SetSearch adds the search to the get users params
func (o *GetUsersParams) SetSearch(search *string) {
    o.Search = search
}

// WriteToRequest writes these params to a swagger request
func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {

    if err := r.SetTimeout(o.timeout); err != nil {
        return err
    }
    var res []error

    if o.OrganizationID != nil {

        // query param OrganizationId
        var qrOrganizationID int32
        if o.OrganizationID != nil {
            qrOrganizationID = *o.OrganizationID
        }
        qOrganizationID := swag.FormatInt32(qrOrganizationID)
        if qOrganizationID != "" {
            if err := r.SetQueryParam("OrganizationId", qOrganizationID); err != nil {
                return err
            }
        }

    }

    if o.Page != nil {

        // query param Page
        var qrPage int32
        if o.Page != nil {
            qrPage = *o.Page
        }
        qPage := swag.FormatInt32(qrPage)
        if qPage != "" {
            if err := r.SetQueryParam("Page", qPage); err != nil {
                return err
            }
        }

    }

    if o.PageSize != nil {

        // query param PageSize
        var qrPageSize int32
        if o.PageSize != nil {
            qrPageSize = *o.PageSize
        }
        qPageSize := swag.FormatInt32(qrPageSize)
        if qPageSize != "" {
            if err := r.SetQueryParam("PageSize", qPageSize); err != nil {
                return err
            }
        }

    }

    if o.Role != nil {

        // query param Role
        var qrRole string
        if o.Role != nil {
            qrRole = *o.Role
        }
        qRole := qrRole
        if qRole != "" {
            if err := r.SetQueryParam("Role", qRole); err != nil {
                return err
            }
        }

    }

    if o.Search != nil {

        // query param Search
        var qrSearch string
        if o.Search != nil {
            qrSearch = *o.Search
        }
        qSearch := qrSearch
        if qSearch != "" {
            if err := r.SetQueryParam("Search", qSearch); err != nil {
                return err
            }
        }

    }

    if len(res) > 0 {
        return errors.CompositeValidationError(res...)
    }
    return nil
}