gtslib/client/lists/list_create_parameters.go
decentral1se e4ade9c758
All checks were successful
continuous-integration/drone/push Build is passing
feat: init
2024-07-31 22:47:18 +02:00

206 lines
5.1 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package lists
// 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"
)
// NewListCreateParams creates a new ListCreateParams 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 NewListCreateParams() *ListCreateParams {
return &ListCreateParams{
timeout: cr.DefaultTimeout,
}
}
// NewListCreateParamsWithTimeout creates a new ListCreateParams object
// with the ability to set a timeout on a request.
func NewListCreateParamsWithTimeout(timeout time.Duration) *ListCreateParams {
return &ListCreateParams{
timeout: timeout,
}
}
// NewListCreateParamsWithContext creates a new ListCreateParams object
// with the ability to set a context for a request.
func NewListCreateParamsWithContext(ctx context.Context) *ListCreateParams {
return &ListCreateParams{
Context: ctx,
}
}
// NewListCreateParamsWithHTTPClient creates a new ListCreateParams object
// with the ability to set a custom HTTPClient for a request.
func NewListCreateParamsWithHTTPClient(client *http.Client) *ListCreateParams {
return &ListCreateParams{
HTTPClient: client,
}
}
/*
ListCreateParams contains all the parameters to send to the API endpoint
for the list create operation.
Typically these are written to a http.Request.
*/
type ListCreateParams struct {
/* RepliesPolicy.
RepliesPolicy for this list.
followed = Show replies to any followed user
list = Show replies to members of the list
none = Show replies to no one
Sample: list
Default: "list"
*/
RepliesPolicy *string
/* Title.
Title of this list.
Sample: Cool People
*/
Title string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the list create params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListCreateParams) WithDefaults() *ListCreateParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the list create params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *ListCreateParams) SetDefaults() {
var (
repliesPolicyDefault = string("list")
)
val := ListCreateParams{
RepliesPolicy: &repliesPolicyDefault,
}
val.timeout = o.timeout
val.Context = o.Context
val.HTTPClient = o.HTTPClient
*o = val
}
// WithTimeout adds the timeout to the list create params
func (o *ListCreateParams) WithTimeout(timeout time.Duration) *ListCreateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the list create params
func (o *ListCreateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the list create params
func (o *ListCreateParams) WithContext(ctx context.Context) *ListCreateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the list create params
func (o *ListCreateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the list create params
func (o *ListCreateParams) WithHTTPClient(client *http.Client) *ListCreateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the list create params
func (o *ListCreateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithRepliesPolicy adds the repliesPolicy to the list create params
func (o *ListCreateParams) WithRepliesPolicy(repliesPolicy *string) *ListCreateParams {
o.SetRepliesPolicy(repliesPolicy)
return o
}
// SetRepliesPolicy adds the repliesPolicy to the list create params
func (o *ListCreateParams) SetRepliesPolicy(repliesPolicy *string) {
o.RepliesPolicy = repliesPolicy
}
// WithTitle adds the title to the list create params
func (o *ListCreateParams) WithTitle(title string) *ListCreateParams {
o.SetTitle(title)
return o
}
// SetTitle adds the title to the list create params
func (o *ListCreateParams) SetTitle(title string) {
o.Title = title
}
// WriteToRequest writes these params to a swagger request
func (o *ListCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
if o.RepliesPolicy != nil {
// form param replies_policy
var frRepliesPolicy string
if o.RepliesPolicy != nil {
frRepliesPolicy = *o.RepliesPolicy
}
fRepliesPolicy := frRepliesPolicy
if fRepliesPolicy != "" {
if err := r.SetFormParam("replies_policy", fRepliesPolicy); err != nil {
return err
}
}
}
// form param title
frTitle := o.Title
fTitle := frTitle
if fTitle != "" {
if err := r.SetFormParam("title", fTitle); err != nil {
return err
}
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}