bjerkio/crayon-api-go

View on GitHub
client/usage_cost/get_for_subscription_parameters.go

Summary

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

package usage_cost

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

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

        timeout: cr.DefaultTimeout,
    }
}

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

        timeout: timeout,
    }
}

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

        Context: ctx,
    }
}

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

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

    /*CurrencyCode*/
    CurrencyCode string
    /*From*/
    From *strfmt.DateTime
    /*ResellerCustomerID*/
    ResellerCustomerID int32
    /*SubscriptionID*/
    SubscriptionID string
    /*To*/
    To *strfmt.DateTime

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

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

// SetTimeout adds the timeout to the get for subscription params
func (o *GetForSubscriptionParams) SetTimeout(timeout time.Duration) {
    o.timeout = timeout
}

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

// SetContext adds the context to the get for subscription params
func (o *GetForSubscriptionParams) SetContext(ctx context.Context) {
    o.Context = ctx
}

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

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

// WithCurrencyCode adds the currencyCode to the get for subscription params
func (o *GetForSubscriptionParams) WithCurrencyCode(currencyCode string) *GetForSubscriptionParams {
    o.SetCurrencyCode(currencyCode)
    return o
}

// SetCurrencyCode adds the currencyCode to the get for subscription params
func (o *GetForSubscriptionParams) SetCurrencyCode(currencyCode string) {
    o.CurrencyCode = currencyCode
}

// WithFrom adds the from to the get for subscription params
func (o *GetForSubscriptionParams) WithFrom(from *strfmt.DateTime) *GetForSubscriptionParams {
    o.SetFrom(from)
    return o
}

// SetFrom adds the from to the get for subscription params
func (o *GetForSubscriptionParams) SetFrom(from *strfmt.DateTime) {
    o.From = from
}

// WithResellerCustomerID adds the resellerCustomerID to the get for subscription params
func (o *GetForSubscriptionParams) WithResellerCustomerID(resellerCustomerID int32) *GetForSubscriptionParams {
    o.SetResellerCustomerID(resellerCustomerID)
    return o
}

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

// WithSubscriptionID adds the subscriptionID to the get for subscription params
func (o *GetForSubscriptionParams) WithSubscriptionID(subscriptionID string) *GetForSubscriptionParams {
    o.SetSubscriptionID(subscriptionID)
    return o
}

// SetSubscriptionID adds the subscriptionId to the get for subscription params
func (o *GetForSubscriptionParams) SetSubscriptionID(subscriptionID string) {
    o.SubscriptionID = subscriptionID
}

// WithTo adds the to to the get for subscription params
func (o *GetForSubscriptionParams) WithTo(to *strfmt.DateTime) *GetForSubscriptionParams {
    o.SetTo(to)
    return o
}

// SetTo adds the to to the get for subscription params
func (o *GetForSubscriptionParams) SetTo(to *strfmt.DateTime) {
    o.To = to
}

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

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

    // path param currencyCode
    if err := r.SetPathParam("currencyCode", o.CurrencyCode); 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
            }
        }

    }

    // path param resellerCustomerId
    if err := r.SetPathParam("resellerCustomerId", swag.FormatInt32(o.ResellerCustomerID)); err != nil {
        return err
    }

    // path param subscriptionId
    if err := r.SetPathParam("subscriptionId", o.SubscriptionID); 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
}