bjerkio/crayon-api-go

View on GitHub
client/activity_logs/get_activity_logs_parameters.go

Summary

Maintainability
D
1 day
Test Coverage
// Code generated by go-swagger; DO NOT EDIT.

package activity_logs

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

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

    /*Entity*/
    Entity *string
    /*From*/
    From *strfmt.DateTime
    /*ID*/
    ID *int32
    /*Ids*/
    Ids []int32
    /*Page*/
    Page *int32
    /*PageSize*/
    PageSize *int32
    /*SearchDate*/
    SearchDate *strfmt.DateTime
    /*To*/
    To *strfmt.DateTime

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

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

// SetTimeout adds the timeout to the get activity logs params
func (o *GetActivityLogsParams) SetTimeout(timeout time.Duration) {
    o.timeout = timeout
}

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

// SetContext adds the context to the get activity logs params
func (o *GetActivityLogsParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

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

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

// WithEntity adds the entity to the get activity logs params
func (o *GetActivityLogsParams) WithEntity(entity *string) *GetActivityLogsParams {
    o.SetEntity(entity)
    return o
}

// SetEntity adds the entity to the get activity logs params
func (o *GetActivityLogsParams) SetEntity(entity *string) {
    o.Entity = entity
}

// WithFrom adds the from to the get activity logs params
func (o *GetActivityLogsParams) WithFrom(from *strfmt.DateTime) *GetActivityLogsParams {
    o.SetFrom(from)
    return o
}

// SetFrom adds the from to the get activity logs params
func (o *GetActivityLogsParams) SetFrom(from *strfmt.DateTime) {
    o.From = from
}

// WithID adds the id to the get activity logs params
func (o *GetActivityLogsParams) WithID(id *int32) *GetActivityLogsParams {
    o.SetID(id)
    return o
}

// SetID adds the id to the get activity logs params
func (o *GetActivityLogsParams) SetID(id *int32) {
    o.ID = id
}

// WithIds adds the ids to the get activity logs params
func (o *GetActivityLogsParams) WithIds(ids []int32) *GetActivityLogsParams {
    o.SetIds(ids)
    return o
}

// SetIds adds the ids to the get activity logs params
func (o *GetActivityLogsParams) SetIds(ids []int32) {
    o.Ids = ids
}

// WithPage adds the page to the get activity logs params
func (o *GetActivityLogsParams) WithPage(page *int32) *GetActivityLogsParams {
    o.SetPage(page)
    return o
}

// SetPage adds the page to the get activity logs params
func (o *GetActivityLogsParams) SetPage(page *int32) {
    o.Page = page
}

// WithPageSize adds the pageSize to the get activity logs params
func (o *GetActivityLogsParams) WithPageSize(pageSize *int32) *GetActivityLogsParams {
    o.SetPageSize(pageSize)
    return o
}

// SetPageSize adds the pageSize to the get activity logs params
func (o *GetActivityLogsParams) SetPageSize(pageSize *int32) {
    o.PageSize = pageSize
}

// WithSearchDate adds the searchDate to the get activity logs params
func (o *GetActivityLogsParams) WithSearchDate(searchDate *strfmt.DateTime) *GetActivityLogsParams {
    o.SetSearchDate(searchDate)
    return o
}

// SetSearchDate adds the searchDate to the get activity logs params
func (o *GetActivityLogsParams) SetSearchDate(searchDate *strfmt.DateTime) {
    o.SearchDate = searchDate
}

// WithTo adds the to to the get activity logs params
func (o *GetActivityLogsParams) WithTo(to *strfmt.DateTime) *GetActivityLogsParams {
    o.SetTo(to)
    return o
}

// SetTo adds the to to the get activity logs params
func (o *GetActivityLogsParams) SetTo(to *strfmt.DateTime) {
    o.To = to
}

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

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

    if o.Entity != nil {

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

    }

    if o.From != nil {

        // query param From
        var qrFrom strfmt.DateTime
        if o.From != nil {
            qrFrom = *o.From
        }
        qFrom := qrFrom.String()
        if qFrom != "" {
            if err := r.SetQueryParam("From", qFrom); err != nil {
                return err
            }
        }

    }

    if o.ID != nil {

        // query param Id
        var qrID int32
        if o.ID != nil {
            qrID = *o.ID
        }
        qID := swag.FormatInt32(qrID)
        if qID != "" {
            if err := r.SetQueryParam("Id", qID); err != nil {
                return err
            }
        }

    }

    var valuesIds []string
    for _, v := range o.Ids {
        valuesIds = append(valuesIds, swag.FormatInt32(v))
    }

    joinedIds := swag.JoinByFormat(valuesIds, "multi")
    // query array param Ids
    if err := r.SetQueryParam("Ids", joinedIds...); 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.SearchDate != nil {

        // query param SearchDate
        var qrSearchDate strfmt.DateTime
        if o.SearchDate != nil {
            qrSearchDate = *o.SearchDate
        }
        qSearchDate := qrSearchDate.String()
        if qSearchDate != "" {
            if err := r.SetQueryParam("SearchDate", qSearchDate); err != nil {
                return err
            }
        }

    }

    if o.To != nil {

        // query param To
        var qrTo strfmt.DateTime
        if o.To != nil {
            qrTo = *o.To
        }
        qTo := qrTo.String()
        if qTo != "" {
            if err := r.SetQueryParam("To", qTo); err != nil {
                return err
            }
        }

    }

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