All checks were successful
continuous-integration/drone/push Build is passing
231 lines
5.7 KiB
Go
231 lines
5.7 KiB
Go
// Code generated by go-swagger; DO NOT EDIT.
|
|
|
|
package accounts
|
|
|
|
// 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"
|
|
)
|
|
|
|
// NewAccountMuteParams creates a new AccountMuteParams 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 NewAccountMuteParams() *AccountMuteParams {
|
|
return &AccountMuteParams{
|
|
timeout: cr.DefaultTimeout,
|
|
}
|
|
}
|
|
|
|
// NewAccountMuteParamsWithTimeout creates a new AccountMuteParams object
|
|
// with the ability to set a timeout on a request.
|
|
func NewAccountMuteParamsWithTimeout(timeout time.Duration) *AccountMuteParams {
|
|
return &AccountMuteParams{
|
|
timeout: timeout,
|
|
}
|
|
}
|
|
|
|
// NewAccountMuteParamsWithContext creates a new AccountMuteParams object
|
|
// with the ability to set a context for a request.
|
|
func NewAccountMuteParamsWithContext(ctx context.Context) *AccountMuteParams {
|
|
return &AccountMuteParams{
|
|
Context: ctx,
|
|
}
|
|
}
|
|
|
|
// NewAccountMuteParamsWithHTTPClient creates a new AccountMuteParams object
|
|
// with the ability to set a custom HTTPClient for a request.
|
|
func NewAccountMuteParamsWithHTTPClient(client *http.Client) *AccountMuteParams {
|
|
return &AccountMuteParams{
|
|
HTTPClient: client,
|
|
}
|
|
}
|
|
|
|
/*
|
|
AccountMuteParams contains all the parameters to send to the API endpoint
|
|
|
|
for the account mute operation.
|
|
|
|
Typically these are written to a http.Request.
|
|
*/
|
|
type AccountMuteParams struct {
|
|
|
|
/* Duration.
|
|
|
|
How long the mute should last, in seconds. If 0 or not provided, mute lasts indefinitely.
|
|
*/
|
|
Duration *float64
|
|
|
|
/* ID.
|
|
|
|
The ID of the account to block.
|
|
*/
|
|
ID string
|
|
|
|
/* Notifications.
|
|
|
|
Mute notifications as well as posts.
|
|
*/
|
|
Notifications *bool
|
|
|
|
timeout time.Duration
|
|
Context context.Context
|
|
HTTPClient *http.Client
|
|
}
|
|
|
|
// WithDefaults hydrates default values in the account mute params (not the query body).
|
|
//
|
|
// All values with no default are reset to their zero value.
|
|
func (o *AccountMuteParams) WithDefaults() *AccountMuteParams {
|
|
o.SetDefaults()
|
|
return o
|
|
}
|
|
|
|
// SetDefaults hydrates default values in the account mute params (not the query body).
|
|
//
|
|
// All values with no default are reset to their zero value.
|
|
func (o *AccountMuteParams) SetDefaults() {
|
|
var (
|
|
durationDefault = float64(0)
|
|
|
|
notificationsDefault = bool(false)
|
|
)
|
|
|
|
val := AccountMuteParams{
|
|
Duration: &durationDefault,
|
|
Notifications: ¬ificationsDefault,
|
|
}
|
|
|
|
val.timeout = o.timeout
|
|
val.Context = o.Context
|
|
val.HTTPClient = o.HTTPClient
|
|
*o = val
|
|
}
|
|
|
|
// WithTimeout adds the timeout to the account mute params
|
|
func (o *AccountMuteParams) WithTimeout(timeout time.Duration) *AccountMuteParams {
|
|
o.SetTimeout(timeout)
|
|
return o
|
|
}
|
|
|
|
// SetTimeout adds the timeout to the account mute params
|
|
func (o *AccountMuteParams) SetTimeout(timeout time.Duration) {
|
|
o.timeout = timeout
|
|
}
|
|
|
|
// WithContext adds the context to the account mute params
|
|
func (o *AccountMuteParams) WithContext(ctx context.Context) *AccountMuteParams {
|
|
o.SetContext(ctx)
|
|
return o
|
|
}
|
|
|
|
// SetContext adds the context to the account mute params
|
|
func (o *AccountMuteParams) SetContext(ctx context.Context) {
|
|
o.Context = ctx
|
|
}
|
|
|
|
// WithHTTPClient adds the HTTPClient to the account mute params
|
|
func (o *AccountMuteParams) WithHTTPClient(client *http.Client) *AccountMuteParams {
|
|
o.SetHTTPClient(client)
|
|
return o
|
|
}
|
|
|
|
// SetHTTPClient adds the HTTPClient to the account mute params
|
|
func (o *AccountMuteParams) SetHTTPClient(client *http.Client) {
|
|
o.HTTPClient = client
|
|
}
|
|
|
|
// WithDuration adds the duration to the account mute params
|
|
func (o *AccountMuteParams) WithDuration(duration *float64) *AccountMuteParams {
|
|
o.SetDuration(duration)
|
|
return o
|
|
}
|
|
|
|
// SetDuration adds the duration to the account mute params
|
|
func (o *AccountMuteParams) SetDuration(duration *float64) {
|
|
o.Duration = duration
|
|
}
|
|
|
|
// WithID adds the id to the account mute params
|
|
func (o *AccountMuteParams) WithID(id string) *AccountMuteParams {
|
|
o.SetID(id)
|
|
return o
|
|
}
|
|
|
|
// SetID adds the id to the account mute params
|
|
func (o *AccountMuteParams) SetID(id string) {
|
|
o.ID = id
|
|
}
|
|
|
|
// WithNotifications adds the notifications to the account mute params
|
|
func (o *AccountMuteParams) WithNotifications(notifications *bool) *AccountMuteParams {
|
|
o.SetNotifications(notifications)
|
|
return o
|
|
}
|
|
|
|
// SetNotifications adds the notifications to the account mute params
|
|
func (o *AccountMuteParams) SetNotifications(notifications *bool) {
|
|
o.Notifications = notifications
|
|
}
|
|
|
|
// WriteToRequest writes these params to a swagger request
|
|
func (o *AccountMuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
|
|
|
|
if err := r.SetTimeout(o.timeout); err != nil {
|
|
return err
|
|
}
|
|
var res []error
|
|
|
|
if o.Duration != nil {
|
|
|
|
// form param duration
|
|
var frDuration float64
|
|
if o.Duration != nil {
|
|
frDuration = *o.Duration
|
|
}
|
|
fDuration := swag.FormatFloat64(frDuration)
|
|
if fDuration != "" {
|
|
if err := r.SetFormParam("duration", fDuration); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
// path param id
|
|
if err := r.SetPathParam("id", o.ID); err != nil {
|
|
return err
|
|
}
|
|
|
|
if o.Notifications != nil {
|
|
|
|
// form param notifications
|
|
var frNotifications bool
|
|
if o.Notifications != nil {
|
|
frNotifications = *o.Notifications
|
|
}
|
|
fNotifications := swag.FormatBool(frNotifications)
|
|
if fNotifications != "" {
|
|
if err := r.SetFormParam("notifications", fNotifications); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
}
|
|
|
|
if len(res) > 0 {
|
|
return errors.CompositeValidationError(res...)
|
|
}
|
|
return nil
|
|
}
|