// Code generated by go-swagger; DO NOT EDIT. package reports // 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" ) // NewReportCreateParams creates a new ReportCreateParams 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 NewReportCreateParams() *ReportCreateParams { return &ReportCreateParams{ timeout: cr.DefaultTimeout, } } // NewReportCreateParamsWithTimeout creates a new ReportCreateParams object // with the ability to set a timeout on a request. func NewReportCreateParamsWithTimeout(timeout time.Duration) *ReportCreateParams { return &ReportCreateParams{ timeout: timeout, } } // NewReportCreateParamsWithContext creates a new ReportCreateParams object // with the ability to set a context for a request. func NewReportCreateParamsWithContext(ctx context.Context) *ReportCreateParams { return &ReportCreateParams{ Context: ctx, } } // NewReportCreateParamsWithHTTPClient creates a new ReportCreateParams object // with the ability to set a custom HTTPClient for a request. func NewReportCreateParamsWithHTTPClient(client *http.Client) *ReportCreateParams { return &ReportCreateParams{ HTTPClient: client, } } /* ReportCreateParams contains all the parameters to send to the API endpoint for the report create operation. Typically these are written to a http.Request. */ type ReportCreateParams struct { /* AccountID. ID of the account to report. Sample: 01GPE75FXSH2EGFBF85NXPH3KP */ AccountID string /* Category. Specify if the report is due to spam, violation of enumerated instance rules, or some other reason. Currently only 'other' is supported. Sample: other Default: "other" */ Category *string /* Comment. The reason for the report. Default maximum of 1000 characters. Sample: Anti-Blackness, transphobia. */ Comment *string /* Forward. If the account is remote, should the report be forwarded to the remote admin? Sample: true */ Forward *bool /* RuleIds. IDs of rules on this instance which have been broken according to the reporter. Sample: ["01GPBN5YDY6JKBWE44H7YQBDCQ","01GPBN65PDWSBPWVDD0SQCFFY3"] */ RuleIDs []string /* StatusIds. IDs of statuses to attach to the report to provide additional context. Sample: ["01GPE76N4SBVRZ8K24TW51ZZQ4","01GPE76WN9JZE62EPT3Q9FRRD4"] */ StatusIDs []string timeout time.Duration Context context.Context HTTPClient *http.Client } // WithDefaults hydrates default values in the report create params (not the query body). // // All values with no default are reset to their zero value. func (o *ReportCreateParams) WithDefaults() *ReportCreateParams { o.SetDefaults() return o } // SetDefaults hydrates default values in the report create params (not the query body). // // All values with no default are reset to their zero value. func (o *ReportCreateParams) SetDefaults() { var ( categoryDefault = string("other") forwardDefault = bool(false) ) val := ReportCreateParams{ Category: &categoryDefault, Forward: &forwardDefault, } val.timeout = o.timeout val.Context = o.Context val.HTTPClient = o.HTTPClient *o = val } // WithTimeout adds the timeout to the report create params func (o *ReportCreateParams) WithTimeout(timeout time.Duration) *ReportCreateParams { o.SetTimeout(timeout) return o } // SetTimeout adds the timeout to the report create params func (o *ReportCreateParams) SetTimeout(timeout time.Duration) { o.timeout = timeout } // WithContext adds the context to the report create params func (o *ReportCreateParams) WithContext(ctx context.Context) *ReportCreateParams { o.SetContext(ctx) return o } // SetContext adds the context to the report create params func (o *ReportCreateParams) SetContext(ctx context.Context) { o.Context = ctx } // WithHTTPClient adds the HTTPClient to the report create params func (o *ReportCreateParams) WithHTTPClient(client *http.Client) *ReportCreateParams { o.SetHTTPClient(client) return o } // SetHTTPClient adds the HTTPClient to the report create params func (o *ReportCreateParams) SetHTTPClient(client *http.Client) { o.HTTPClient = client } // WithAccountID adds the accountID to the report create params func (o *ReportCreateParams) WithAccountID(accountID string) *ReportCreateParams { o.SetAccountID(accountID) return o } // SetAccountID adds the accountId to the report create params func (o *ReportCreateParams) SetAccountID(accountID string) { o.AccountID = accountID } // WithCategory adds the category to the report create params func (o *ReportCreateParams) WithCategory(category *string) *ReportCreateParams { o.SetCategory(category) return o } // SetCategory adds the category to the report create params func (o *ReportCreateParams) SetCategory(category *string) { o.Category = category } // WithComment adds the comment to the report create params func (o *ReportCreateParams) WithComment(comment *string) *ReportCreateParams { o.SetComment(comment) return o } // SetComment adds the comment to the report create params func (o *ReportCreateParams) SetComment(comment *string) { o.Comment = comment } // WithForward adds the forward to the report create params func (o *ReportCreateParams) WithForward(forward *bool) *ReportCreateParams { o.SetForward(forward) return o } // SetForward adds the forward to the report create params func (o *ReportCreateParams) SetForward(forward *bool) { o.Forward = forward } // WithRuleIDs adds the ruleIds to the report create params func (o *ReportCreateParams) WithRuleIDs(ruleIds []string) *ReportCreateParams { o.SetRuleIDs(ruleIds) return o } // SetRuleIDs adds the ruleIds to the report create params func (o *ReportCreateParams) SetRuleIDs(ruleIds []string) { o.RuleIDs = ruleIds } // WithStatusIDs adds the statusIds to the report create params func (o *ReportCreateParams) WithStatusIDs(statusIds []string) *ReportCreateParams { o.SetStatusIDs(statusIds) return o } // SetStatusIDs adds the statusIds to the report create params func (o *ReportCreateParams) SetStatusIDs(statusIds []string) { o.StatusIDs = statusIds } // WriteToRequest writes these params to a swagger request func (o *ReportCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { if err := r.SetTimeout(o.timeout); err != nil { return err } var res []error // form param account_id frAccountID := o.AccountID fAccountID := frAccountID if fAccountID != "" { if err := r.SetFormParam("account_id", fAccountID); err != nil { return err } } if o.Category != nil { // form param category var frCategory string if o.Category != nil { frCategory = *o.Category } fCategory := frCategory if fCategory != "" { if err := r.SetFormParam("category", fCategory); err != nil { return err } } } if o.Comment != nil { // form param comment var frComment string if o.Comment != nil { frComment = *o.Comment } fComment := frComment if fComment != "" { if err := r.SetFormParam("comment", fComment); err != nil { return err } } } if o.Forward != nil { // form param forward var frForward bool if o.Forward != nil { frForward = *o.Forward } fForward := swag.FormatBool(frForward) if fForward != "" { if err := r.SetFormParam("forward", fForward); err != nil { return err } } } if o.RuleIDs != nil { // binding items for rule_ids joinedRuleIds := o.bindParamRuleIds(reg) // form array param rule_ids if err := r.SetFormParam("rule_ids", joinedRuleIds...); err != nil { return err } } if o.StatusIDs != nil { // binding items for status_ids joinedStatusIds := o.bindParamStatusIds(reg) // form array param status_ids if err := r.SetFormParam("status_ids", joinedStatusIds...); err != nil { return err } } if len(res) > 0 { return errors.CompositeValidationError(res...) } return nil } // bindParamReportCreate binds the parameter rule_ids func (o *ReportCreateParams) bindParamRuleIds(formats strfmt.Registry) []string { ruleIdsIR := o.RuleIDs var ruleIdsIC []string for _, ruleIdsIIR := range ruleIdsIR { // explode []string ruleIdsIIV := ruleIdsIIR // string as string ruleIdsIC = append(ruleIdsIC, ruleIdsIIV) } // items.CollectionFormat: "" ruleIdsIS := swag.JoinByFormat(ruleIdsIC, "") return ruleIdsIS } // bindParamReportCreate binds the parameter status_ids func (o *ReportCreateParams) bindParamStatusIds(formats strfmt.Registry) []string { statusIdsIR := o.StatusIDs var statusIdsIC []string for _, statusIdsIIR := range statusIdsIR { // explode []string statusIdsIIV := statusIdsIIR // string as string statusIdsIC = append(statusIdsIC, statusIdsIIV) } // items.CollectionFormat: "" statusIdsIS := swag.JoinByFormat(statusIdsIC, "") return statusIdsIS }