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

package waypoint_service

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

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

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

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

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

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

	for the waypoint service git hub callback session operation.

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

	/* Code.

	   code is the code from the callback
	*/
	Code *string

	/* State.

	   state is session id
	*/
	State *string

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

// WithDefaults hydrates default values in the waypoint service git hub callback session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *WaypointServiceGitHubCallbackSessionParams) WithDefaults() *WaypointServiceGitHubCallbackSessionParams {
	o.SetDefaults()
	return o
}

// SetDefaults hydrates default values in the waypoint service git hub callback session params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *WaypointServiceGitHubCallbackSessionParams) SetDefaults() {
	// no default values defined for this parameter
}

// WithTimeout adds the timeout to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) WithTimeout(timeout time.Duration) *WaypointServiceGitHubCallbackSessionParams {
	o.SetTimeout(timeout)
	return o
}

// SetTimeout adds the timeout to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) SetTimeout(timeout time.Duration) {
	o.timeout = timeout
}

// WithContext adds the context to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) WithContext(ctx context.Context) *WaypointServiceGitHubCallbackSessionParams {
	o.SetContext(ctx)
	return o
}

// SetContext adds the context to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) SetContext(ctx context.Context) {
	o.Context = ctx
}

// WithHTTPClient adds the HTTPClient to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) WithHTTPClient(client *http.Client) *WaypointServiceGitHubCallbackSessionParams {
	o.SetHTTPClient(client)
	return o
}

// SetHTTPClient adds the HTTPClient to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) SetHTTPClient(client *http.Client) {
	o.HTTPClient = client
}

// WithCode adds the code to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) WithCode(code *string) *WaypointServiceGitHubCallbackSessionParams {
	o.SetCode(code)
	return o
}

// SetCode adds the code to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) SetCode(code *string) {
	o.Code = code
}

// WithState adds the state to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) WithState(state *string) *WaypointServiceGitHubCallbackSessionParams {
	o.SetState(state)
	return o
}

// SetState adds the state to the waypoint service git hub callback session params
func (o *WaypointServiceGitHubCallbackSessionParams) SetState(state *string) {
	o.State = state
}

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

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

	if o.Code != nil {

		// query param code
		var qrCode string

		if o.Code != nil {
			qrCode = *o.Code
		}
		qCode := qrCode
		if qCode != "" {

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

	if o.State != nil {

		// query param state
		var qrState string

		if o.State != nil {
			qrState = *o.State
		}
		qState := qrState
		if qState != "" {

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

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