bjerkio/crayon-api-go

View on GitHub
client/reseller_sales_prices/get_current_async_parameters.go

Summary

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

package reseller_sales_prices

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

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

    /*FromDate*/
    FromDate *strfmt.DateTime
    /*ObjectID*/
    ObjectID *int32
    /*ObjectType*/
    ObjectType *string
    /*Type*/
    Type *string

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

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

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

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

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

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

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

// WithFromDate adds the fromDate to the get current async params
func (o *GetCurrentAsyncParams) WithFromDate(fromDate *strfmt.DateTime) *GetCurrentAsyncParams {
    o.SetFromDate(fromDate)
    return o
}

// SetFromDate adds the fromDate to the get current async params
func (o *GetCurrentAsyncParams) SetFromDate(fromDate *strfmt.DateTime) {
    o.FromDate = fromDate
}

// WithObjectID adds the objectID to the get current async params
func (o *GetCurrentAsyncParams) WithObjectID(objectID *int32) *GetCurrentAsyncParams {
    o.SetObjectID(objectID)
    return o
}

// SetObjectID adds the objectId to the get current async params
func (o *GetCurrentAsyncParams) SetObjectID(objectID *int32) {
    o.ObjectID = objectID
}

// WithObjectType adds the objectType to the get current async params
func (o *GetCurrentAsyncParams) WithObjectType(objectType *string) *GetCurrentAsyncParams {
    o.SetObjectType(objectType)
    return o
}

// SetObjectType adds the objectType to the get current async params
func (o *GetCurrentAsyncParams) SetObjectType(objectType *string) {
    o.ObjectType = objectType
}

// WithType adds the typeVar to the get current async params
func (o *GetCurrentAsyncParams) WithType(typeVar *string) *GetCurrentAsyncParams {
    o.SetType(typeVar)
    return o
}

// SetType adds the type to the get current async params
func (o *GetCurrentAsyncParams) SetType(typeVar *string) {
    o.Type = typeVar
}

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

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

    if o.FromDate != nil {

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

    }

    if o.ObjectID != nil {

        // query param ObjectId
        var qrObjectID int32
        if o.ObjectID != nil {
            qrObjectID = *o.ObjectID
        }
        qObjectID := swag.FormatInt32(qrObjectID)
        if qObjectID != "" {
            if err := r.SetQueryParam("ObjectId", qObjectID); err != nil {
                return err
            }
        }

    }

    if o.ObjectType != nil {

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

    }

    if o.Type != nil {

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

    }

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