gtslib/client/media/media_update_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

213 lines
5.4 KiB
Go

// Code generated by go-swagger; DO NOT EDIT.
package media
// 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"
)
// NewMediaUpdateParams creates a new MediaUpdateParams 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 NewMediaUpdateParams() *MediaUpdateParams {
return &MediaUpdateParams{
timeout: cr.DefaultTimeout,
}
}
// NewMediaUpdateParamsWithTimeout creates a new MediaUpdateParams object
// with the ability to set a timeout on a request.
func NewMediaUpdateParamsWithTimeout(timeout time.Duration) *MediaUpdateParams {
return &MediaUpdateParams{
timeout: timeout,
}
}
// NewMediaUpdateParamsWithContext creates a new MediaUpdateParams object
// with the ability to set a context for a request.
func NewMediaUpdateParamsWithContext(ctx context.Context) *MediaUpdateParams {
return &MediaUpdateParams{
Context: ctx,
}
}
// NewMediaUpdateParamsWithHTTPClient creates a new MediaUpdateParams object
// with the ability to set a custom HTTPClient for a request.
func NewMediaUpdateParamsWithHTTPClient(client *http.Client) *MediaUpdateParams {
return &MediaUpdateParams{
HTTPClient: client,
}
}
/*
MediaUpdateParams contains all the parameters to send to the API endpoint
for the media update operation.
Typically these are written to a http.Request.
*/
type MediaUpdateParams struct {
/* Description.
Image or media description to use as alt-text on the attachment. This is very useful for users of screenreaders! May or may not be required, depending on your instance settings.
*/
Description string
/* Focus.
Focus of the media file. If present, it should be in the form of two comma-separated floats between -1 and 1. For example: `-0.5,0.25`.
Default: "0,0"
*/
Focus string
/* ID.
id of the attachment to update
*/
ID string
timeout time.Duration
Context context.Context
HTTPClient *http.Client
}
// WithDefaults hydrates default values in the media update params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *MediaUpdateParams) WithDefaults() *MediaUpdateParams {
o.SetDefaults()
return o
}
// SetDefaults hydrates default values in the media update params (not the query body).
//
// All values with no default are reset to their zero value.
func (o *MediaUpdateParams) SetDefaults() {
var (
focusDefault = string("0,0")
)
val := MediaUpdateParams{
Focus: focusDefault,
}
val.timeout = o.timeout
val.Context = o.Context
val.HTTPClient = o.HTTPClient
*o = val
}
// WithTimeout adds the timeout to the media update params
func (o *MediaUpdateParams) WithTimeout(timeout time.Duration) *MediaUpdateParams {
o.SetTimeout(timeout)
return o
}
// SetTimeout adds the timeout to the media update params
func (o *MediaUpdateParams) SetTimeout(timeout time.Duration) {
o.timeout = timeout
}
// WithContext adds the context to the media update params
func (o *MediaUpdateParams) WithContext(ctx context.Context) *MediaUpdateParams {
o.SetContext(ctx)
return o
}
// SetContext adds the context to the media update params
func (o *MediaUpdateParams) SetContext(ctx context.Context) {
o.Context = ctx
}
// WithHTTPClient adds the HTTPClient to the media update params
func (o *MediaUpdateParams) WithHTTPClient(client *http.Client) *MediaUpdateParams {
o.SetHTTPClient(client)
return o
}
// SetHTTPClient adds the HTTPClient to the media update params
func (o *MediaUpdateParams) SetHTTPClient(client *http.Client) {
o.HTTPClient = client
}
// WithDescription adds the description to the media update params
func (o *MediaUpdateParams) WithDescription(description string) *MediaUpdateParams {
o.SetDescription(description)
return o
}
// SetDescription adds the description to the media update params
func (o *MediaUpdateParams) SetDescription(description string) {
o.Description = description
}
// WithFocus adds the focus to the media update params
func (o *MediaUpdateParams) WithFocus(focus string) *MediaUpdateParams {
o.SetFocus(focus)
return o
}
// SetFocus adds the focus to the media update params
func (o *MediaUpdateParams) SetFocus(focus string) {
o.Focus = focus
}
// WithID adds the id to the media update params
func (o *MediaUpdateParams) WithID(id string) *MediaUpdateParams {
o.SetID(id)
return o
}
// SetID adds the id to the media update params
func (o *MediaUpdateParams) SetID(id string) {
o.ID = id
}
// WriteToRequest writes these params to a swagger request
func (o *MediaUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error {
if err := r.SetTimeout(o.timeout); err != nil {
return err
}
var res []error
// form param description
frDescription := o.Description
fDescription := frDescription
if err := r.SetFormParam("description", fDescription); err != nil {
return err
}
// form param focus
frFocus := o.Focus
fFocus := frFocus
if err := r.SetFormParam("focus", fFocus); err != nil {
return err
}
// path param id
if err := r.SetPathParam("id", o.ID); err != nil {
return err
}
if len(res) > 0 {
return errors.CompositeValidationError(res...)
}
return nil
}