bjerkio/crayon-api-go

View on GitHub
client/assets/get_assets_parameters.go

Summary

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

package assets

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

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

    /*AssetType*/
    AssetType *string
    /*ExternalOrderID*/
    ExternalOrderID *string
    /*ExternalOrderIds*/
    ExternalOrderIds []string
    /*Page*/
    Page *int32
    /*PageSize*/
    PageSize *int32
    /*PublisherID*/
    PublisherID *int32
    /*ResellerCustomerID*/
    ResellerCustomerID *int32
    /*ReservationID*/
    ReservationID *string
    /*Search*/
    Search *string
    /*Status*/
    Status *string

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

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

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

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

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

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

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

// WithAssetType adds the assetType to the get assets params
func (o *GetAssetsParams) WithAssetType(assetType *string) *GetAssetsParams {
    o.SetAssetType(assetType)
    return o
}

// SetAssetType adds the assetType to the get assets params
func (o *GetAssetsParams) SetAssetType(assetType *string) {
    o.AssetType = assetType
}

// WithExternalOrderID adds the externalOrderID to the get assets params
func (o *GetAssetsParams) WithExternalOrderID(externalOrderID *string) *GetAssetsParams {
    o.SetExternalOrderID(externalOrderID)
    return o
}

// SetExternalOrderID adds the externalOrderId to the get assets params
func (o *GetAssetsParams) SetExternalOrderID(externalOrderID *string) {
    o.ExternalOrderID = externalOrderID
}

// WithExternalOrderIds adds the externalOrderIds to the get assets params
func (o *GetAssetsParams) WithExternalOrderIds(externalOrderIds []string) *GetAssetsParams {
    o.SetExternalOrderIds(externalOrderIds)
    return o
}

// SetExternalOrderIds adds the externalOrderIds to the get assets params
func (o *GetAssetsParams) SetExternalOrderIds(externalOrderIds []string) {
    o.ExternalOrderIds = externalOrderIds
}

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

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

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

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

// WithPublisherID adds the publisherID to the get assets params
func (o *GetAssetsParams) WithPublisherID(publisherID *int32) *GetAssetsParams {
    o.SetPublisherID(publisherID)
    return o
}

// SetPublisherID adds the publisherId to the get assets params
func (o *GetAssetsParams) SetPublisherID(publisherID *int32) {
    o.PublisherID = publisherID
}

// WithResellerCustomerID adds the resellerCustomerID to the get assets params
func (o *GetAssetsParams) WithResellerCustomerID(resellerCustomerID *int32) *GetAssetsParams {
    o.SetResellerCustomerID(resellerCustomerID)
    return o
}

// SetResellerCustomerID adds the resellerCustomerId to the get assets params
func (o *GetAssetsParams) SetResellerCustomerID(resellerCustomerID *int32) {
    o.ResellerCustomerID = resellerCustomerID
}

// WithReservationID adds the reservationID to the get assets params
func (o *GetAssetsParams) WithReservationID(reservationID *string) *GetAssetsParams {
    o.SetReservationID(reservationID)
    return o
}

// SetReservationID adds the reservationId to the get assets params
func (o *GetAssetsParams) SetReservationID(reservationID *string) {
    o.ReservationID = reservationID
}

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

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

// WithStatus adds the status to the get assets params
func (o *GetAssetsParams) WithStatus(status *string) *GetAssetsParams {
    o.SetStatus(status)
    return o
}

// SetStatus adds the status to the get assets params
func (o *GetAssetsParams) SetStatus(status *string) {
    o.Status = status
}

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

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

    if o.AssetType != nil {

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

    }

    if o.ExternalOrderID != nil {

        // query param ExternalOrderId
        var qrExternalOrderID string
        if o.ExternalOrderID != nil {
            qrExternalOrderID = *o.ExternalOrderID
        }
        qExternalOrderID := qrExternalOrderID
        if qExternalOrderID != "" {
            if err := r.SetQueryParam("ExternalOrderId", qExternalOrderID); err != nil {
                return err
            }
        }

    }

    valuesExternalOrderIds := o.ExternalOrderIds

    joinedExternalOrderIds := swag.JoinByFormat(valuesExternalOrderIds, "multi")
    // query array param ExternalOrderIds
    if err := r.SetQueryParam("ExternalOrderIds", joinedExternalOrderIds...); 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.PublisherID != nil {

        // query param PublisherId
        var qrPublisherID int32
        if o.PublisherID != nil {
            qrPublisherID = *o.PublisherID
        }
        qPublisherID := swag.FormatInt32(qrPublisherID)
        if qPublisherID != "" {
            if err := r.SetQueryParam("PublisherId", qPublisherID); err != nil {
                return err
            }
        }

    }

    if o.ResellerCustomerID != nil {

        // query param ResellerCustomerId
        var qrResellerCustomerID int32
        if o.ResellerCustomerID != nil {
            qrResellerCustomerID = *o.ResellerCustomerID
        }
        qResellerCustomerID := swag.FormatInt32(qrResellerCustomerID)
        if qResellerCustomerID != "" {
            if err := r.SetQueryParam("ResellerCustomerId", qResellerCustomerID); err != nil {
                return err
            }
        }

    }

    if o.ReservationID != nil {

        // query param ReservationId
        var qrReservationID string
        if o.ReservationID != nil {
            qrReservationID = *o.ReservationID
        }
        qReservationID := qrReservationID
        if qReservationID != "" {
            if err := r.SetQueryParam("ReservationId", qReservationID); 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 o.Status != nil {

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

    }

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