gtslib/client/timelines/home_timeline_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

317 lines
7.2 KiB
Go

// 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"
)
// NewHomeTimelineParams creates a new HomeTimelineParams 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 NewHomeTimelineParams() *HomeTimelineParams {
return &HomeTimelineParams{
timeout: cr.DefaultTimeout,
}
}
// NewHomeTimelineParamsWithTimeout creates a new HomeTimelineParams object
// with the ability to set a timeout on a request.
func NewHomeTimelineParamsWithTimeout(timeout time.Duration) *HomeTimelineParams {
return &HomeTimelineParams{
timeout: timeout,
}
}
// NewHomeTimelineParamsWithContext creates a new HomeTimelineParams object
// with the ability to set a context for a request.
func NewHomeTimelineParamsWithContext(ctx context.Context) *HomeTimelineParams {
return &HomeTimelineParams{
Context: ctx,
}
}
// NewHomeTimelineParamsWithHTTPClient creates a new HomeTimelineParams object
// with the ability to set a custom HTTPClient for a request.
func NewHomeTimelineParamsWithHTTPClient(client *http.Client) *HomeTimelineParams {
return &HomeTimelineParams{
HTTPClient: client,
}
}
/*
HomeTimelineParams contains all the parameters to send to the API endpoint
for the home timeline operation.
Typically these are written to a http.Request.
*/
type HomeTimelineParams struct {
/* Limit.
Number of statuses to return.
Default: 20
*/
Limit *int64
/* Local.
Show only statuses posted by local accounts.
*/
Local *bool
/* 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 *immediately 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 home timeline params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *HomeTimelineParams) WithDefaults() *HomeTimelineParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the home timeline params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *HomeTimelineParams) SetDefaults() {
var (
limitDefault = int64(20)
localDefault = bool(false)
)
val := HomeTimelineParams{
Limit: &limitDefault,
Local: &localDefault,
}
val.timeout = o.timeout
val.Context = o.Context
val.HTTPClient = o.HTTPClient
*o = val
}
// WithTimeout adds the timeout to the home timeline params
func (o *HomeTimelineParams) WithTimeout(timeout time.Duration) *HomeTimelineParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the home timeline params
func (o *HomeTimelineParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the home timeline params
func (o *HomeTimelineParams) WithContext(ctx context.Context) *HomeTimelineParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the home timeline params
func (o *HomeTimelineParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the home timeline params
func (o *HomeTimelineParams) WithHTTPClient(client *http.Client) *HomeTimelineParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the home timeline params
func (o *HomeTimelineParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithLimit adds the limit to the home timeline params
func (o *HomeTimelineParams) WithLimit(limit *int64) *HomeTimelineParams {
o.SetLimit(limit)
return o
}
// SetLimit adds the limit to the home timeline params
func (o *HomeTimelineParams) SetLimit(limit *int64) {
o.Limit = limit
}
// WithLocal adds the local to the home timeline params
func (o *HomeTimelineParams) WithLocal(local *bool) *HomeTimelineParams {
o.SetLocal(local)
return o
}
// SetLocal adds the local to the home timeline params
func (o *HomeTimelineParams) SetLocal(local *bool) {
o.Local = local
}
// WithMaxID adds the maxID to the home timeline params
func (o *HomeTimelineParams) WithMaxID(maxID *string) *HomeTimelineParams {
o.SetMaxID(maxID)
return o
}
// SetMaxID adds the maxId to the home timeline params
func (o *HomeTimelineParams) SetMaxID(maxID *string) {
o.MaxID = maxID
}
// WithMinID adds the minID to the home timeline params
func (o *HomeTimelineParams) WithMinID(minID *string) *HomeTimelineParams {
o.SetMinID(minID)
return o
}
// SetMinID adds the minId to the home timeline params
func (o *HomeTimelineParams) SetMinID(minID *string) {
o.MinID = minID
}
// WithSinceID adds the sinceID to the home timeline params
func (o *HomeTimelineParams) WithSinceID(sinceID *string) *HomeTimelineParams {
o.SetSinceID(sinceID)
return o
}
// SetSinceID adds the sinceId to the home timeline params
func (o *HomeTimelineParams) SetSinceID(sinceID *string) {
o.SinceID = sinceID
}
// WriteToRequest writes these params to a swagger request
func (o *HomeTimelineParams) 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.Local != nil {
// query param local
var qrLocal bool
if o.Local != nil {
qrLocal = *o.Local
}
qLocal := swag.FormatBool(qrLocal)
if qLocal != "" {
if err := r.SetQueryParam("local", qLocal); 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
}