bjerkio/crayon-api-go

View on GitHub
client/billing_statements/get_billing_statements_parameters.go

Summary

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

package billing_statements

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

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

    /*From*/
    From *strfmt.DateTime
    /*InvoiceProfileID*/
    InvoiceProfileID *int32
    /*OrganizationID*/
    OrganizationID *int32
    /*Page*/
    Page *int32
    /*PageSize*/
    PageSize *int32
    /*ProvisionType*/
    ProvisionType *string
    /*To*/
    To *strfmt.DateTime

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

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

// SetTimeout adds the timeout to the get billing statements params
func (o *GetBillingStatementsParams) SetTimeout(timeout time.Duration) {
    o.timeout = timeout
}

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

// SetContext adds the context to the get billing statements params
func (o *GetBillingStatementsParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

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

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

// WithFrom adds the from to the get billing statements params
func (o *GetBillingStatementsParams) WithFrom(from *strfmt.DateTime) *GetBillingStatementsParams {
    o.SetFrom(from)
    return o
}

// SetFrom adds the from to the get billing statements params
func (o *GetBillingStatementsParams) SetFrom(from *strfmt.DateTime) {
    o.From = from
}

// WithInvoiceProfileID adds the invoiceProfileID to the get billing statements params
func (o *GetBillingStatementsParams) WithInvoiceProfileID(invoiceProfileID *int32) *GetBillingStatementsParams {
    o.SetInvoiceProfileID(invoiceProfileID)
    return o
}

// SetInvoiceProfileID adds the invoiceProfileId to the get billing statements params
func (o *GetBillingStatementsParams) SetInvoiceProfileID(invoiceProfileID *int32) {
    o.InvoiceProfileID = invoiceProfileID
}

// WithOrganizationID adds the organizationID to the get billing statements params
func (o *GetBillingStatementsParams) WithOrganizationID(organizationID *int32) *GetBillingStatementsParams {
    o.SetOrganizationID(organizationID)
    return o
}

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

// WithPage adds the page to the get billing statements params
func (o *GetBillingStatementsParams) WithPage(page *int32) *GetBillingStatementsParams {
    o.SetPage(page)
    return o
}

// SetPage adds the page to the get billing statements params
func (o *GetBillingStatementsParams) SetPage(page *int32) {
    o.Page = page
}

// WithPageSize adds the pageSize to the get billing statements params
func (o *GetBillingStatementsParams) WithPageSize(pageSize *int32) *GetBillingStatementsParams {
    o.SetPageSize(pageSize)
    return o
}

// SetPageSize adds the pageSize to the get billing statements params
func (o *GetBillingStatementsParams) SetPageSize(pageSize *int32) {
    o.PageSize = pageSize
}

// WithProvisionType adds the provisionType to the get billing statements params
func (o *GetBillingStatementsParams) WithProvisionType(provisionType *string) *GetBillingStatementsParams {
    o.SetProvisionType(provisionType)
    return o
}

// SetProvisionType adds the provisionType to the get billing statements params
func (o *GetBillingStatementsParams) SetProvisionType(provisionType *string) {
    o.ProvisionType = provisionType
}

// WithTo adds the to to the get billing statements params
func (o *GetBillingStatementsParams) WithTo(to *strfmt.DateTime) *GetBillingStatementsParams {
    o.SetTo(to)
    return o
}

// SetTo adds the to to the get billing statements params
func (o *GetBillingStatementsParams) SetTo(to *strfmt.DateTime) {
    o.To = to
}

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

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

    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.InvoiceProfileID != nil {

        // query param InvoiceProfileId
        var qrInvoiceProfileID int32
        if o.InvoiceProfileID != nil {
            qrInvoiceProfileID = *o.InvoiceProfileID
        }
        qInvoiceProfileID := swag.FormatInt32(qrInvoiceProfileID)
        if qInvoiceProfileID != "" {
            if err := r.SetQueryParam("InvoiceProfileId", qInvoiceProfileID); err != nil {
                return err
            }
        }

    }

    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.ProvisionType != nil {

        // query param ProvisionType
        var qrProvisionType string
        if o.ProvisionType != nil {
            qrProvisionType = *o.ProvisionType
        }
        qProvisionType := qrProvisionType
        if qProvisionType != "" {
            if err := r.SetQueryParam("ProvisionType", qProvisionType); 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
}