bjerkio/crayon-api-go

View on GitHub
client/assets/get_asset_orders_async_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"
)

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

/*GetAssetOrdersAsyncParams contains all the parameters to send to the API endpoint
for the get asset orders async operation typically these are written to a http.Request
*/
type GetAssetOrdersAsyncParams 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 asset orders async params
func (o *GetAssetOrdersAsyncParams) WithTimeout(timeout time.Duration) *GetAssetOrdersAsyncParams {
    o.SetTimeout(timeout)
    return o
}

// SetTimeout adds the timeout to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetTimeout(timeout time.Duration) {
    o.timeout = timeout
}

// WithContext adds the context to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithContext(ctx context.Context) *GetAssetOrdersAsyncParams {
    o.SetContext(ctx)
    return o
}

// SetContext adds the context to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithHTTPClient(client *http.Client) *GetAssetOrdersAsyncParams {
    o.SetHTTPClient(client)
    return o
}

// SetHTTPClient adds the HTTPClient to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetHTTPClient(client *http.Client) {
    o.HTTPClient = client
}

// WithAssetType adds the assetType to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithAssetType(assetType *string) *GetAssetOrdersAsyncParams {
    o.SetAssetType(assetType)
    return o
}

// SetAssetType adds the assetType to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetAssetType(assetType *string) {
    o.AssetType = assetType
}

// WithExternalOrderID adds the externalOrderID to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithExternalOrderID(externalOrderID *string) *GetAssetOrdersAsyncParams {
    o.SetExternalOrderID(externalOrderID)
    return o
}

// SetExternalOrderID adds the externalOrderId to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetExternalOrderID(externalOrderID *string) {
    o.ExternalOrderID = externalOrderID
}

// WithExternalOrderIds adds the externalOrderIds to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithExternalOrderIds(externalOrderIds []string) *GetAssetOrdersAsyncParams {
    o.SetExternalOrderIds(externalOrderIds)
    return o
}

// SetExternalOrderIds adds the externalOrderIds to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetExternalOrderIds(externalOrderIds []string) {
    o.ExternalOrderIds = externalOrderIds
}

// WithPage adds the page to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithPage(page *int32) *GetAssetOrdersAsyncParams {
    o.SetPage(page)
    return o
}

// SetPage adds the page to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetPage(page *int32) {
    o.Page = page
}

// WithPageSize adds the pageSize to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithPageSize(pageSize *int32) *GetAssetOrdersAsyncParams {
    o.SetPageSize(pageSize)
    return o
}

// SetPageSize adds the pageSize to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetPageSize(pageSize *int32) {
    o.PageSize = pageSize
}

// WithPublisherID adds the publisherID to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithPublisherID(publisherID *int32) *GetAssetOrdersAsyncParams {
    o.SetPublisherID(publisherID)
    return o
}

// SetPublisherID adds the publisherId to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetPublisherID(publisherID *int32) {
    o.PublisherID = publisherID
}

// WithResellerCustomerID adds the resellerCustomerID to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithResellerCustomerID(resellerCustomerID *int32) *GetAssetOrdersAsyncParams {
    o.SetResellerCustomerID(resellerCustomerID)
    return o
}

// SetResellerCustomerID adds the resellerCustomerId to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetResellerCustomerID(resellerCustomerID *int32) {
    o.ResellerCustomerID = resellerCustomerID
}

// WithReservationID adds the reservationID to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithReservationID(reservationID *string) *GetAssetOrdersAsyncParams {
    o.SetReservationID(reservationID)
    return o
}

// SetReservationID adds the reservationId to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetReservationID(reservationID *string) {
    o.ReservationID = reservationID
}

// WithSearch adds the search to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithSearch(search *string) *GetAssetOrdersAsyncParams {
    o.SetSearch(search)
    return o
}

// SetSearch adds the search to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetSearch(search *string) {
    o.Search = search
}

// WithStatus adds the status to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) WithStatus(status *string) *GetAssetOrdersAsyncParams {
    o.SetStatus(status)
    return o
}

// SetStatus adds the status to the get asset orders async params
func (o *GetAssetOrdersAsyncParams) SetStatus(status *string) {
    o.Status = status
}

// WriteToRequest writes these params to a swagger request
func (o *GetAssetOrdersAsyncParams) 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
}