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

package timelines

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

// NewListTimelineParams creates a new ListTimelineParams 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 NewListTimelineParams() *ListTimelineParams {
	return &ListTimelineParams{
		timeout: cr.DefaultTimeout,
	}
}

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

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

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

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

	for the list timeline operation.

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

	/* ID.

	   ID of the list
	*/
	ID string

	/* Limit.

	   Number of statuses to return.

	   Default: 20
	*/
	Limit *int64

	/* MaxID.

	   Return only statuses *OLDER* than the given max status ID. The status with the specified ID will not be included in the response.
	*/
	MaxID *string

	/* MinID.

	   Return only statuses *NEWER* than the given since status ID. The status with the specified ID will not be included in the response.
	*/
	MinID *string

	/* SinceID.

	   Return only statuses *NEWER* than the given since status ID. The status with the specified ID will not be included in the response.
	*/
	SinceID *string

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

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

// SetDefaults hydrates default values in the list timeline params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListTimelineParams) SetDefaults() {
	var (
		limitDefault = int64(20)
	)

	val := ListTimelineParams{
		Limit: &limitDefault,
	}

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

// WithTimeout adds the timeout to the list timeline params
func (o *ListTimelineParams) WithTimeout(timeout time.Duration) *ListTimelineParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the list timeline params
func (o *ListTimelineParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the list timeline params
func (o *ListTimelineParams) WithContext(ctx context.Context) *ListTimelineParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the list timeline params
func (o *ListTimelineParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the list timeline params
func (o *ListTimelineParams) WithHTTPClient(client *http.Client) *ListTimelineParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the list timeline params
func (o *ListTimelineParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithID adds the id to the list timeline params
func (o *ListTimelineParams) WithID(id string) *ListTimelineParams {
	o.SetID(id)
	return o
}

// SetID adds the id to the list timeline params
func (o *ListTimelineParams) SetID(id string) {
	o.ID = id
}

// WithLimit adds the limit to the list timeline params
func (o *ListTimelineParams) WithLimit(limit *int64) *ListTimelineParams {
	o.SetLimit(limit)
	return o
}

// SetLimit adds the limit to the list timeline params
func (o *ListTimelineParams) SetLimit(limit *int64) {
	o.Limit = limit
}

// WithMaxID adds the maxID to the list timeline params
func (o *ListTimelineParams) WithMaxID(maxID *string) *ListTimelineParams {
	o.SetMaxID(maxID)
	return o
}

// SetMaxID adds the maxId to the list timeline params
func (o *ListTimelineParams) SetMaxID(maxID *string) {
	o.MaxID = maxID
}

// WithMinID adds the minID to the list timeline params
func (o *ListTimelineParams) WithMinID(minID *string) *ListTimelineParams {
	o.SetMinID(minID)
	return o
}

// SetMinID adds the minId to the list timeline params
func (o *ListTimelineParams) SetMinID(minID *string) {
	o.MinID = minID
}

// WithSinceID adds the sinceID to the list timeline params
func (o *ListTimelineParams) WithSinceID(sinceID *string) *ListTimelineParams {
	o.SetSinceID(sinceID)
	return o
}

// SetSinceID adds the sinceId to the list timeline params
func (o *ListTimelineParams) SetSinceID(sinceID *string) {
	o.SinceID = sinceID
}

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

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

	// path param id
	if err := r.SetPathParam("id", o.ID); err != nil {
		return err
	}

	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
}
