// Code generated by go-swagger; DO NOT EDIT.

package conversations

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

// NewConversationsGetParams creates a new ConversationsGetParams object,
// with the default timeout for this client.
//
// Default values are not hydrated, since defaults are normally applied by the API server side.
//
// To enforce default values in parameter, use SetDefaults or WithDefaults.
func NewConversationsGetParams() *ConversationsGetParams {
	return &ConversationsGetParams{
		timeout: cr.DefaultTimeout,
	}
}

// NewConversationsGetParamsWithTimeout creates a new ConversationsGetParams object
// with the ability to set a timeout on a request.
func NewConversationsGetParamsWithTimeout(timeout time.Duration) *ConversationsGetParams {
	return &ConversationsGetParams{
		timeout: timeout,
	}
}

// NewConversationsGetParamsWithContext creates a new ConversationsGetParams object
// with the ability to set a context for a request.
func NewConversationsGetParamsWithContext(ctx context.Context) *ConversationsGetParams {
	return &ConversationsGetParams{
		Context: ctx,
	}
}

// NewConversationsGetParamsWithHTTPClient creates a new ConversationsGetParams object
// with the ability to set a custom HTTPClient for a request.
func NewConversationsGetParamsWithHTTPClient(client *http.Client) *ConversationsGetParams {
	return &ConversationsGetParams{
		HTTPClient: client,
	}
}

/*
ConversationsGetParams contains all the parameters to send to the API endpoint

	for the conversations get operation.

	Typically these are written to a http.Request.
*/
type ConversationsGetParams struct {

	/* Limit.

	   Number of conversations to return.

	   Default: 40
	*/
	Limit *int64

	/* MaxID.

	   Return only conversations with last statuses *OLDER* than the given max ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination.
	*/
	MaxID *string

	/* MinID.

	   Return only conversations with last statuses *IMMEDIATELY NEWER* than the given min ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination.
	*/
	MinID *string

	/* SinceID.

	   Return only conversations with last statuses *NEWER* than the given since ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination.
	*/
	SinceID *string

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

// WithDefaults hydrates default values in the conversations get params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ConversationsGetParams) WithDefaults() *ConversationsGetParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the conversations get params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ConversationsGetParams) SetDefaults() {
	var (
		limitDefault = int64(40)
	)

	val := ConversationsGetParams{
		Limit: &limitDefault,
	}

	val.timeout = o.timeout
	val.Context = o.Context
	val.HTTPClient = o.HTTPClient
	*o = val
}

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

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

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

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

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

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

// WithLimit adds the limit to the conversations get params
func (o *ConversationsGetParams) WithLimit(limit *int64) *ConversationsGetParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the conversations get params
func (o *ConversationsGetParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithMaxID adds the maxID to the conversations get params
func (o *ConversationsGetParams) WithMaxID(maxID *string) *ConversationsGetParams {
	o.SetMaxID(maxID)
	return o
}

// SetMaxID adds the maxId to the conversations get params
func (o *ConversationsGetParams) SetMaxID(maxID *string) {
	o.MaxID = maxID
}

// WithMinID adds the minID to the conversations get params
func (o *ConversationsGetParams) WithMinID(minID *string) *ConversationsGetParams {
	o.SetMinID(minID)
	return o
}

// SetMinID adds the minId to the conversations get params
func (o *ConversationsGetParams) SetMinID(minID *string) {
	o.MinID = minID
}

// WithSinceID adds the sinceID to the conversations get params
func (o *ConversationsGetParams) WithSinceID(sinceID *string) *ConversationsGetParams {
	o.SetSinceID(sinceID)
	return o
}

// SetSinceID adds the sinceId to the conversations get params
func (o *ConversationsGetParams) SetSinceID(sinceID *string) {
	o.SinceID = sinceID
}

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

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

	if o.Limit != nil {

		// query param limit
		var qrLimit int64

		if o.Limit != nil {
			qrLimit = *o.Limit
		}
		qLimit := swag.FormatInt64(qrLimit)
		if qLimit != "" {

			if err := r.SetQueryParam("limit", qLimit); err != nil {
				return err
			}
		}
	}

	if o.MaxID != nil {

		// query param max_id
		var qrMaxID string

		if o.MaxID != nil {
			qrMaxID = *o.MaxID
		}
		qMaxID := qrMaxID
		if qMaxID != "" {

			if err := r.SetQueryParam("max_id", qMaxID); err != nil {
				return err
			}
		}
	}

	if o.MinID != nil {

		// query param min_id
		var qrMinID string

		if o.MinID != nil {
			qrMinID = *o.MinID
		}
		qMinID := qrMinID
		if qMinID != "" {

			if err := r.SetQueryParam("min_id", qMinID); err != nil {
				return err
			}
		}
	}

	if o.SinceID != nil {

		// query param since_id
		var qrSinceID string

		if o.SinceID != nil {
			qrSinceID = *o.SinceID
		}
		qSinceID := qrSinceID
		if qSinceID != "" {

			if err := r.SetQueryParam("since_id", qSinceID); err != nil {
				return err
			}
		}
	}

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