commit e4ade9c75895664f1104f02bbc1266050e6be483 Author: decentral1se Date: Sun Jul 28 22:36:17 2024 +0200 feat: init diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..34f26c5 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,8 @@ +--- +kind: pipeline +name: gtslib +steps: + - name: build + image: golang:1.21 + commands: + - go build -v ./... diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..034880d --- /dev/null +++ b/LICENSE @@ -0,0 +1,15 @@ +gtslib: Go API bindings for GoToSocial +Copyright (C) 2024 decentral1se + +This program is free software: you can redistribute it and/or modify it under +the terms of the GNU Affero General Public License as published by the Free +Software Foundation, either version 3 of the License, or (at your option) any +later version. + +This program is distributed in the hope that it will be useful, but WITHOUT ANY +WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A +PARTICULAR PURPOSE. See the GNU Affero General Public License for more +details. + +You should have received a copy of the GNU Affero General Public License along +with this program. If not, see . diff --git a/README.md b/README.md new file mode 100644 index 0000000..f503c2f --- /dev/null +++ b/README.md @@ -0,0 +1,28 @@ +# gtslib + +[![Build Status](https://build.coopcloud.tech/api/badges/decentral1se/gtslib/status.svg?ref=refs/heads/main)](https://build.coopcloud.tech/decentral1se/gtslib) + +> Go API bindings for GoToSocial + +[GoToSocial](https://gotosocial.org) is still **alpha** software and so are these bindings. I have no grand schemes beyond updating the bindings to match the latest releases of GtS as things progress. Current version generated from this [`swagger.yml`](https://github.com/superseriousbusiness/gotosocial/blob/368c97f0f85f243796a0407960dc5a2ccad24bab/docs/api/swagger.yaml). + +## Generate + +You'll need to install [`go-swagger`](https://goswagger.io/install.html). + +``` +go generate ./... + +# apply workaround for https://github.com/go-swagger/go-swagger/issues/2997 +patch -u -p1 -i filter-context.diff +``` + +## ACK + +Made possible by the good work of [`slurp`](https://github.com/VyrCossont/slurp). + +## License + + + + diff --git a/client/accounts/account_alias_parameters.go b/client/accounts/account_alias_parameters.go new file mode 100644 index 0000000..7b66072 --- /dev/null +++ b/client/accounts/account_alias_parameters.go @@ -0,0 +1,156 @@ +// 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" +) + +// NewAccountAliasParams creates a new AccountAliasParams 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 NewAccountAliasParams() *AccountAliasParams { + return &AccountAliasParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountAliasParamsWithTimeout creates a new AccountAliasParams object +// with the ability to set a timeout on a request. +func NewAccountAliasParamsWithTimeout(timeout time.Duration) *AccountAliasParams { + return &AccountAliasParams{ + timeout: timeout, + } +} + +// NewAccountAliasParamsWithContext creates a new AccountAliasParams object +// with the ability to set a context for a request. +func NewAccountAliasParamsWithContext(ctx context.Context) *AccountAliasParams { + return &AccountAliasParams{ + Context: ctx, + } +} + +// NewAccountAliasParamsWithHTTPClient creates a new AccountAliasParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountAliasParamsWithHTTPClient(client *http.Client) *AccountAliasParams { + return &AccountAliasParams{ + HTTPClient: client, + } +} + +/* +AccountAliasParams contains all the parameters to send to the API endpoint + + for the account alias operation. + + Typically these are written to a http.Request. +*/ +type AccountAliasParams struct { + + /* AlsoKnownAsUris. + + ActivityPub URI/IDs of target accounts to which this account is being aliased. Eg., `["https://example.org/users/some_account"]`. + Use an empty array to unset alsoKnownAs, clearing the aliases. + */ + AlsoKnownAsUris string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account alias params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAliasParams) WithDefaults() *AccountAliasParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account alias params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAliasParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account alias params +func (o *AccountAliasParams) WithTimeout(timeout time.Duration) *AccountAliasParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account alias params +func (o *AccountAliasParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account alias params +func (o *AccountAliasParams) WithContext(ctx context.Context) *AccountAliasParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account alias params +func (o *AccountAliasParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account alias params +func (o *AccountAliasParams) WithHTTPClient(client *http.Client) *AccountAliasParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account alias params +func (o *AccountAliasParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAlsoKnownAsUris adds the alsoKnownAsUris to the account alias params +func (o *AccountAliasParams) WithAlsoKnownAsUris(alsoKnownAsUris string) *AccountAliasParams { + o.SetAlsoKnownAsUris(alsoKnownAsUris) + return o +} + +// SetAlsoKnownAsUris adds the alsoKnownAsUris to the account alias params +func (o *AccountAliasParams) SetAlsoKnownAsUris(alsoKnownAsUris string) { + o.AlsoKnownAsUris = alsoKnownAsUris +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountAliasParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param also_known_as_uris + frAlsoKnownAsUris := o.AlsoKnownAsUris + fAlsoKnownAsUris := frAlsoKnownAsUris + if fAlsoKnownAsUris != "" { + if err := r.SetFormParam("also_known_as_uris", fAlsoKnownAsUris); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_alias_responses.go b/client/accounts/account_alias_responses.go new file mode 100644 index 0000000..45699e7 --- /dev/null +++ b/client/accounts/account_alias_responses.go @@ -0,0 +1,478 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountAliasReader is a Reader for the AccountAlias structure. +type AccountAliasReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountAliasReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountAliasOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountAliasBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountAliasUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountAliasNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountAliasNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewAccountAliasUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountAliasInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/alias] accountAlias", response, response.Code()) + } +} + +// NewAccountAliasOK creates a AccountAliasOK with default headers values +func NewAccountAliasOK() *AccountAliasOK { + return &AccountAliasOK{} +} + +/* +AccountAliasOK describes a response with status code 200, with default header values. + +The newly updated account. +*/ +type AccountAliasOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account alias o k response has a 2xx status code +func (o *AccountAliasOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account alias o k response has a 3xx status code +func (o *AccountAliasOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias o k response has a 4xx status code +func (o *AccountAliasOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account alias o k response has a 5xx status code +func (o *AccountAliasOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias o k response a status code equal to that given +func (o *AccountAliasOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account alias o k response +func (o *AccountAliasOK) Code() int { + return 200 +} + +func (o *AccountAliasOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasOK %s", 200, payload) +} + +func (o *AccountAliasOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasOK %s", 200, payload) +} + +func (o *AccountAliasOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountAliasOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountAliasBadRequest creates a AccountAliasBadRequest with default headers values +func NewAccountAliasBadRequest() *AccountAliasBadRequest { + return &AccountAliasBadRequest{} +} + +/* +AccountAliasBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountAliasBadRequest struct { +} + +// IsSuccess returns true when this account alias bad request response has a 2xx status code +func (o *AccountAliasBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias bad request response has a 3xx status code +func (o *AccountAliasBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias bad request response has a 4xx status code +func (o *AccountAliasBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias bad request response has a 5xx status code +func (o *AccountAliasBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias bad request response a status code equal to that given +func (o *AccountAliasBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account alias bad request response +func (o *AccountAliasBadRequest) Code() int { + return 400 +} + +func (o *AccountAliasBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasBadRequest", 400) +} + +func (o *AccountAliasBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasBadRequest", 400) +} + +func (o *AccountAliasBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasUnauthorized creates a AccountAliasUnauthorized with default headers values +func NewAccountAliasUnauthorized() *AccountAliasUnauthorized { + return &AccountAliasUnauthorized{} +} + +/* +AccountAliasUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountAliasUnauthorized struct { +} + +// IsSuccess returns true when this account alias unauthorized response has a 2xx status code +func (o *AccountAliasUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias unauthorized response has a 3xx status code +func (o *AccountAliasUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias unauthorized response has a 4xx status code +func (o *AccountAliasUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias unauthorized response has a 5xx status code +func (o *AccountAliasUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias unauthorized response a status code equal to that given +func (o *AccountAliasUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account alias unauthorized response +func (o *AccountAliasUnauthorized) Code() int { + return 401 +} + +func (o *AccountAliasUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnauthorized", 401) +} + +func (o *AccountAliasUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnauthorized", 401) +} + +func (o *AccountAliasUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasNotFound creates a AccountAliasNotFound with default headers values +func NewAccountAliasNotFound() *AccountAliasNotFound { + return &AccountAliasNotFound{} +} + +/* +AccountAliasNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountAliasNotFound struct { +} + +// IsSuccess returns true when this account alias not found response has a 2xx status code +func (o *AccountAliasNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias not found response has a 3xx status code +func (o *AccountAliasNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias not found response has a 4xx status code +func (o *AccountAliasNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias not found response has a 5xx status code +func (o *AccountAliasNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias not found response a status code equal to that given +func (o *AccountAliasNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account alias not found response +func (o *AccountAliasNotFound) Code() int { + return 404 +} + +func (o *AccountAliasNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotFound", 404) +} + +func (o *AccountAliasNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotFound", 404) +} + +func (o *AccountAliasNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasNotAcceptable creates a AccountAliasNotAcceptable with default headers values +func NewAccountAliasNotAcceptable() *AccountAliasNotAcceptable { + return &AccountAliasNotAcceptable{} +} + +/* +AccountAliasNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountAliasNotAcceptable struct { +} + +// IsSuccess returns true when this account alias not acceptable response has a 2xx status code +func (o *AccountAliasNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias not acceptable response has a 3xx status code +func (o *AccountAliasNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias not acceptable response has a 4xx status code +func (o *AccountAliasNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias not acceptable response has a 5xx status code +func (o *AccountAliasNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias not acceptable response a status code equal to that given +func (o *AccountAliasNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account alias not acceptable response +func (o *AccountAliasNotAcceptable) Code() int { + return 406 +} + +func (o *AccountAliasNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotAcceptable", 406) +} + +func (o *AccountAliasNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasNotAcceptable", 406) +} + +func (o *AccountAliasNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasUnprocessableEntity creates a AccountAliasUnprocessableEntity with default headers values +func NewAccountAliasUnprocessableEntity() *AccountAliasUnprocessableEntity { + return &AccountAliasUnprocessableEntity{} +} + +/* +AccountAliasUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable. Check the response body for more details. +*/ +type AccountAliasUnprocessableEntity struct { +} + +// IsSuccess returns true when this account alias unprocessable entity response has a 2xx status code +func (o *AccountAliasUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias unprocessable entity response has a 3xx status code +func (o *AccountAliasUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias unprocessable entity response has a 4xx status code +func (o *AccountAliasUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this account alias unprocessable entity response has a 5xx status code +func (o *AccountAliasUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this account alias unprocessable entity response a status code equal to that given +func (o *AccountAliasUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the account alias unprocessable entity response +func (o *AccountAliasUnprocessableEntity) Code() int { + return 422 +} + +func (o *AccountAliasUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnprocessableEntity", 422) +} + +func (o *AccountAliasUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasUnprocessableEntity", 422) +} + +func (o *AccountAliasUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAliasInternalServerError creates a AccountAliasInternalServerError with default headers values +func NewAccountAliasInternalServerError() *AccountAliasInternalServerError { + return &AccountAliasInternalServerError{} +} + +/* +AccountAliasInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountAliasInternalServerError struct { +} + +// IsSuccess returns true when this account alias internal server error response has a 2xx status code +func (o *AccountAliasInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account alias internal server error response has a 3xx status code +func (o *AccountAliasInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account alias internal server error response has a 4xx status code +func (o *AccountAliasInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account alias internal server error response has a 5xx status code +func (o *AccountAliasInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account alias internal server error response a status code equal to that given +func (o *AccountAliasInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account alias internal server error response +func (o *AccountAliasInternalServerError) Code() int { + return 500 +} + +func (o *AccountAliasInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasInternalServerError", 500) +} + +func (o *AccountAliasInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/alias][%d] accountAliasInternalServerError", 500) +} + +func (o *AccountAliasInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_avatar_delete_parameters.go b/client/accounts/account_avatar_delete_parameters.go new file mode 100644 index 0000000..98b1d35 --- /dev/null +++ b/client/accounts/account_avatar_delete_parameters.go @@ -0,0 +1,128 @@ +// 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" +) + +// NewAccountAvatarDeleteParams creates a new AccountAvatarDeleteParams 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 NewAccountAvatarDeleteParams() *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountAvatarDeleteParamsWithTimeout creates a new AccountAvatarDeleteParams object +// with the ability to set a timeout on a request. +func NewAccountAvatarDeleteParamsWithTimeout(timeout time.Duration) *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + timeout: timeout, + } +} + +// NewAccountAvatarDeleteParamsWithContext creates a new AccountAvatarDeleteParams object +// with the ability to set a context for a request. +func NewAccountAvatarDeleteParamsWithContext(ctx context.Context) *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + Context: ctx, + } +} + +// NewAccountAvatarDeleteParamsWithHTTPClient creates a new AccountAvatarDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountAvatarDeleteParamsWithHTTPClient(client *http.Client) *AccountAvatarDeleteParams { + return &AccountAvatarDeleteParams{ + HTTPClient: client, + } +} + +/* +AccountAvatarDeleteParams contains all the parameters to send to the API endpoint + + for the account avatar delete operation. + + Typically these are written to a http.Request. +*/ +type AccountAvatarDeleteParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account avatar delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAvatarDeleteParams) WithDefaults() *AccountAvatarDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account avatar delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountAvatarDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account avatar delete params +func (o *AccountAvatarDeleteParams) WithTimeout(timeout time.Duration) *AccountAvatarDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account avatar delete params +func (o *AccountAvatarDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account avatar delete params +func (o *AccountAvatarDeleteParams) WithContext(ctx context.Context) *AccountAvatarDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account avatar delete params +func (o *AccountAvatarDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account avatar delete params +func (o *AccountAvatarDeleteParams) WithHTTPClient(client *http.Client) *AccountAvatarDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account avatar delete params +func (o *AccountAvatarDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountAvatarDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_avatar_delete_responses.go b/client/accounts/account_avatar_delete_responses.go new file mode 100644 index 0000000..b01a3c3 --- /dev/null +++ b/client/accounts/account_avatar_delete_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountAvatarDeleteReader is a Reader for the AccountAvatarDelete structure. +type AccountAvatarDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountAvatarDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountAvatarDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountAvatarDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountAvatarDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAccountAvatarDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountAvatarDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountAvatarDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/profile/avatar] accountAvatarDelete", response, response.Code()) + } +} + +// NewAccountAvatarDeleteOK creates a AccountAvatarDeleteOK with default headers values +func NewAccountAvatarDeleteOK() *AccountAvatarDeleteOK { + return &AccountAvatarDeleteOK{} +} + +/* +AccountAvatarDeleteOK describes a response with status code 200, with default header values. + +The updated account, including profile source information. +*/ +type AccountAvatarDeleteOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account avatar delete o k response has a 2xx status code +func (o *AccountAvatarDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account avatar delete o k response has a 3xx status code +func (o *AccountAvatarDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete o k response has a 4xx status code +func (o *AccountAvatarDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account avatar delete o k response has a 5xx status code +func (o *AccountAvatarDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete o k response a status code equal to that given +func (o *AccountAvatarDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account avatar delete o k response +func (o *AccountAvatarDeleteOK) Code() int { + return 200 +} + +func (o *AccountAvatarDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteOK %s", 200, payload) +} + +func (o *AccountAvatarDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteOK %s", 200, payload) +} + +func (o *AccountAvatarDeleteOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountAvatarDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountAvatarDeleteBadRequest creates a AccountAvatarDeleteBadRequest with default headers values +func NewAccountAvatarDeleteBadRequest() *AccountAvatarDeleteBadRequest { + return &AccountAvatarDeleteBadRequest{} +} + +/* +AccountAvatarDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountAvatarDeleteBadRequest struct { +} + +// IsSuccess returns true when this account avatar delete bad request response has a 2xx status code +func (o *AccountAvatarDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete bad request response has a 3xx status code +func (o *AccountAvatarDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete bad request response has a 4xx status code +func (o *AccountAvatarDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete bad request response has a 5xx status code +func (o *AccountAvatarDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete bad request response a status code equal to that given +func (o *AccountAvatarDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account avatar delete bad request response +func (o *AccountAvatarDeleteBadRequest) Code() int { + return 400 +} + +func (o *AccountAvatarDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteBadRequest", 400) +} + +func (o *AccountAvatarDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteBadRequest", 400) +} + +func (o *AccountAvatarDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteUnauthorized creates a AccountAvatarDeleteUnauthorized with default headers values +func NewAccountAvatarDeleteUnauthorized() *AccountAvatarDeleteUnauthorized { + return &AccountAvatarDeleteUnauthorized{} +} + +/* +AccountAvatarDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountAvatarDeleteUnauthorized struct { +} + +// IsSuccess returns true when this account avatar delete unauthorized response has a 2xx status code +func (o *AccountAvatarDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete unauthorized response has a 3xx status code +func (o *AccountAvatarDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete unauthorized response has a 4xx status code +func (o *AccountAvatarDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete unauthorized response has a 5xx status code +func (o *AccountAvatarDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete unauthorized response a status code equal to that given +func (o *AccountAvatarDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account avatar delete unauthorized response +func (o *AccountAvatarDeleteUnauthorized) Code() int { + return 401 +} + +func (o *AccountAvatarDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteUnauthorized", 401) +} + +func (o *AccountAvatarDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteUnauthorized", 401) +} + +func (o *AccountAvatarDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteForbidden creates a AccountAvatarDeleteForbidden with default headers values +func NewAccountAvatarDeleteForbidden() *AccountAvatarDeleteForbidden { + return &AccountAvatarDeleteForbidden{} +} + +/* +AccountAvatarDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AccountAvatarDeleteForbidden struct { +} + +// IsSuccess returns true when this account avatar delete forbidden response has a 2xx status code +func (o *AccountAvatarDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete forbidden response has a 3xx status code +func (o *AccountAvatarDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete forbidden response has a 4xx status code +func (o *AccountAvatarDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete forbidden response has a 5xx status code +func (o *AccountAvatarDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete forbidden response a status code equal to that given +func (o *AccountAvatarDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the account avatar delete forbidden response +func (o *AccountAvatarDeleteForbidden) Code() int { + return 403 +} + +func (o *AccountAvatarDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteForbidden", 403) +} + +func (o *AccountAvatarDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteForbidden", 403) +} + +func (o *AccountAvatarDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteNotAcceptable creates a AccountAvatarDeleteNotAcceptable with default headers values +func NewAccountAvatarDeleteNotAcceptable() *AccountAvatarDeleteNotAcceptable { + return &AccountAvatarDeleteNotAcceptable{} +} + +/* +AccountAvatarDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountAvatarDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this account avatar delete not acceptable response has a 2xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete not acceptable response has a 3xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete not acceptable response has a 4xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account avatar delete not acceptable response has a 5xx status code +func (o *AccountAvatarDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account avatar delete not acceptable response a status code equal to that given +func (o *AccountAvatarDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account avatar delete not acceptable response +func (o *AccountAvatarDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountAvatarDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteNotAcceptable", 406) +} + +func (o *AccountAvatarDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteNotAcceptable", 406) +} + +func (o *AccountAvatarDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountAvatarDeleteInternalServerError creates a AccountAvatarDeleteInternalServerError with default headers values +func NewAccountAvatarDeleteInternalServerError() *AccountAvatarDeleteInternalServerError { + return &AccountAvatarDeleteInternalServerError{} +} + +/* +AccountAvatarDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountAvatarDeleteInternalServerError struct { +} + +// IsSuccess returns true when this account avatar delete internal server error response has a 2xx status code +func (o *AccountAvatarDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account avatar delete internal server error response has a 3xx status code +func (o *AccountAvatarDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account avatar delete internal server error response has a 4xx status code +func (o *AccountAvatarDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account avatar delete internal server error response has a 5xx status code +func (o *AccountAvatarDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account avatar delete internal server error response a status code equal to that given +func (o *AccountAvatarDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account avatar delete internal server error response +func (o *AccountAvatarDeleteInternalServerError) Code() int { + return 500 +} + +func (o *AccountAvatarDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteInternalServerError", 500) +} + +func (o *AccountAvatarDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/avatar][%d] accountAvatarDeleteInternalServerError", 500) +} + +func (o *AccountAvatarDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_block_parameters.go b/client/accounts/account_block_parameters.go new file mode 100644 index 0000000..af3bfb8 --- /dev/null +++ b/client/accounts/account_block_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewAccountBlockParams creates a new AccountBlockParams 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 NewAccountBlockParams() *AccountBlockParams { + return &AccountBlockParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountBlockParamsWithTimeout creates a new AccountBlockParams object +// with the ability to set a timeout on a request. +func NewAccountBlockParamsWithTimeout(timeout time.Duration) *AccountBlockParams { + return &AccountBlockParams{ + timeout: timeout, + } +} + +// NewAccountBlockParamsWithContext creates a new AccountBlockParams object +// with the ability to set a context for a request. +func NewAccountBlockParamsWithContext(ctx context.Context) *AccountBlockParams { + return &AccountBlockParams{ + Context: ctx, + } +} + +// NewAccountBlockParamsWithHTTPClient creates a new AccountBlockParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountBlockParamsWithHTTPClient(client *http.Client) *AccountBlockParams { + return &AccountBlockParams{ + HTTPClient: client, + } +} + +/* +AccountBlockParams contains all the parameters to send to the API endpoint + + for the account block operation. + + Typically these are written to a http.Request. +*/ +type AccountBlockParams struct { + + /* ID. + + The id of the account to block. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountBlockParams) WithDefaults() *AccountBlockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account block params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountBlockParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account block params +func (o *AccountBlockParams) WithTimeout(timeout time.Duration) *AccountBlockParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account block params +func (o *AccountBlockParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account block params +func (o *AccountBlockParams) WithContext(ctx context.Context) *AccountBlockParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account block params +func (o *AccountBlockParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account block params +func (o *AccountBlockParams) WithHTTPClient(client *http.Client) *AccountBlockParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account block params +func (o *AccountBlockParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account block params +func (o *AccountBlockParams) WithID(id string) *AccountBlockParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account block params +func (o *AccountBlockParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountBlockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_block_responses.go b/client/accounts/account_block_responses.go new file mode 100644 index 0000000..17d62d9 --- /dev/null +++ b/client/accounts/account_block_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountBlockReader is a Reader for the AccountBlock structure. +type AccountBlockReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountBlockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountBlockOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountBlockBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountBlockUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountBlockNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountBlockNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountBlockInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/block] accountBlock", response, response.Code()) + } +} + +// NewAccountBlockOK creates a AccountBlockOK with default headers values +func NewAccountBlockOK() *AccountBlockOK { + return &AccountBlockOK{} +} + +/* +AccountBlockOK describes a response with status code 200, with default header values. + +Your relationship to the account. +*/ +type AccountBlockOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account block o k response has a 2xx status code +func (o *AccountBlockOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account block o k response has a 3xx status code +func (o *AccountBlockOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block o k response has a 4xx status code +func (o *AccountBlockOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account block o k response has a 5xx status code +func (o *AccountBlockOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account block o k response a status code equal to that given +func (o *AccountBlockOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account block o k response +func (o *AccountBlockOK) Code() int { + return 200 +} + +func (o *AccountBlockOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockOK %s", 200, payload) +} + +func (o *AccountBlockOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockOK %s", 200, payload) +} + +func (o *AccountBlockOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountBlockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountBlockBadRequest creates a AccountBlockBadRequest with default headers values +func NewAccountBlockBadRequest() *AccountBlockBadRequest { + return &AccountBlockBadRequest{} +} + +/* +AccountBlockBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountBlockBadRequest struct { +} + +// IsSuccess returns true when this account block bad request response has a 2xx status code +func (o *AccountBlockBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block bad request response has a 3xx status code +func (o *AccountBlockBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block bad request response has a 4xx status code +func (o *AccountBlockBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block bad request response has a 5xx status code +func (o *AccountBlockBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account block bad request response a status code equal to that given +func (o *AccountBlockBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account block bad request response +func (o *AccountBlockBadRequest) Code() int { + return 400 +} + +func (o *AccountBlockBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockBadRequest", 400) +} + +func (o *AccountBlockBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockBadRequest", 400) +} + +func (o *AccountBlockBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockUnauthorized creates a AccountBlockUnauthorized with default headers values +func NewAccountBlockUnauthorized() *AccountBlockUnauthorized { + return &AccountBlockUnauthorized{} +} + +/* +AccountBlockUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountBlockUnauthorized struct { +} + +// IsSuccess returns true when this account block unauthorized response has a 2xx status code +func (o *AccountBlockUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block unauthorized response has a 3xx status code +func (o *AccountBlockUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block unauthorized response has a 4xx status code +func (o *AccountBlockUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block unauthorized response has a 5xx status code +func (o *AccountBlockUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account block unauthorized response a status code equal to that given +func (o *AccountBlockUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account block unauthorized response +func (o *AccountBlockUnauthorized) Code() int { + return 401 +} + +func (o *AccountBlockUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockUnauthorized", 401) +} + +func (o *AccountBlockUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockUnauthorized", 401) +} + +func (o *AccountBlockUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockNotFound creates a AccountBlockNotFound with default headers values +func NewAccountBlockNotFound() *AccountBlockNotFound { + return &AccountBlockNotFound{} +} + +/* +AccountBlockNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountBlockNotFound struct { +} + +// IsSuccess returns true when this account block not found response has a 2xx status code +func (o *AccountBlockNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block not found response has a 3xx status code +func (o *AccountBlockNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block not found response has a 4xx status code +func (o *AccountBlockNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block not found response has a 5xx status code +func (o *AccountBlockNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account block not found response a status code equal to that given +func (o *AccountBlockNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account block not found response +func (o *AccountBlockNotFound) Code() int { + return 404 +} + +func (o *AccountBlockNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotFound", 404) +} + +func (o *AccountBlockNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotFound", 404) +} + +func (o *AccountBlockNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockNotAcceptable creates a AccountBlockNotAcceptable with default headers values +func NewAccountBlockNotAcceptable() *AccountBlockNotAcceptable { + return &AccountBlockNotAcceptable{} +} + +/* +AccountBlockNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountBlockNotAcceptable struct { +} + +// IsSuccess returns true when this account block not acceptable response has a 2xx status code +func (o *AccountBlockNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block not acceptable response has a 3xx status code +func (o *AccountBlockNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block not acceptable response has a 4xx status code +func (o *AccountBlockNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account block not acceptable response has a 5xx status code +func (o *AccountBlockNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account block not acceptable response a status code equal to that given +func (o *AccountBlockNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account block not acceptable response +func (o *AccountBlockNotAcceptable) Code() int { + return 406 +} + +func (o *AccountBlockNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotAcceptable", 406) +} + +func (o *AccountBlockNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockNotAcceptable", 406) +} + +func (o *AccountBlockNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountBlockInternalServerError creates a AccountBlockInternalServerError with default headers values +func NewAccountBlockInternalServerError() *AccountBlockInternalServerError { + return &AccountBlockInternalServerError{} +} + +/* +AccountBlockInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountBlockInternalServerError struct { +} + +// IsSuccess returns true when this account block internal server error response has a 2xx status code +func (o *AccountBlockInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account block internal server error response has a 3xx status code +func (o *AccountBlockInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account block internal server error response has a 4xx status code +func (o *AccountBlockInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account block internal server error response has a 5xx status code +func (o *AccountBlockInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account block internal server error response a status code equal to that given +func (o *AccountBlockInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account block internal server error response +func (o *AccountBlockInternalServerError) Code() int { + return 500 +} + +func (o *AccountBlockInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockInternalServerError", 500) +} + +func (o *AccountBlockInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/block][%d] accountBlockInternalServerError", 500) +} + +func (o *AccountBlockInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_create_parameters.go b/client/accounts/account_create_parameters.go new file mode 100644 index 0000000..e655f6b --- /dev/null +++ b/client/accounts/account_create_parameters.go @@ -0,0 +1,334 @@ +// 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" +) + +// NewAccountCreateParams creates a new AccountCreateParams 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 NewAccountCreateParams() *AccountCreateParams { + return &AccountCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountCreateParamsWithTimeout creates a new AccountCreateParams object +// with the ability to set a timeout on a request. +func NewAccountCreateParamsWithTimeout(timeout time.Duration) *AccountCreateParams { + return &AccountCreateParams{ + timeout: timeout, + } +} + +// NewAccountCreateParamsWithContext creates a new AccountCreateParams object +// with the ability to set a context for a request. +func NewAccountCreateParamsWithContext(ctx context.Context) *AccountCreateParams { + return &AccountCreateParams{ + Context: ctx, + } +} + +// NewAccountCreateParamsWithHTTPClient creates a new AccountCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountCreateParamsWithHTTPClient(client *http.Client) *AccountCreateParams { + return &AccountCreateParams{ + HTTPClient: client, + } +} + +/* +AccountCreateParams contains all the parameters to send to the API endpoint + + for the account create operation. + + Typically these are written to a http.Request. +*/ +type AccountCreateParams struct { + + /* Agreement. + + The user agrees to the terms, conditions, and policies of the instance. + */ + Agreement *bool + + /* Email. + + The email address to be used for login. + */ + Email *string + + /* Locale. + + The language of the confirmation email that will be sent. + */ + Locale *string + + /* Password. + + The password to be used for login. This will be hashed before storage. + */ + Password *string + + /* Reason. + + Text that will be reviewed by moderators if registrations require manual approval. + */ + Reason *string + + /* Username. + + The desired username for the account. + */ + Username *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountCreateParams) WithDefaults() *AccountCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account create params +func (o *AccountCreateParams) WithTimeout(timeout time.Duration) *AccountCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account create params +func (o *AccountCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account create params +func (o *AccountCreateParams) WithContext(ctx context.Context) *AccountCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account create params +func (o *AccountCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account create params +func (o *AccountCreateParams) WithHTTPClient(client *http.Client) *AccountCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account create params +func (o *AccountCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAgreement adds the agreement to the account create params +func (o *AccountCreateParams) WithAgreement(agreement *bool) *AccountCreateParams { + o.SetAgreement(agreement) + return o +} + +// SetAgreement adds the agreement to the account create params +func (o *AccountCreateParams) SetAgreement(agreement *bool) { + o.Agreement = agreement +} + +// WithEmail adds the email to the account create params +func (o *AccountCreateParams) WithEmail(email *string) *AccountCreateParams { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the account create params +func (o *AccountCreateParams) SetEmail(email *string) { + o.Email = email +} + +// WithLocale adds the locale to the account create params +func (o *AccountCreateParams) WithLocale(locale *string) *AccountCreateParams { + o.SetLocale(locale) + return o +} + +// SetLocale adds the locale to the account create params +func (o *AccountCreateParams) SetLocale(locale *string) { + o.Locale = locale +} + +// WithPassword adds the password to the account create params +func (o *AccountCreateParams) WithPassword(password *string) *AccountCreateParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the account create params +func (o *AccountCreateParams) SetPassword(password *string) { + o.Password = password +} + +// WithReason adds the reason to the account create params +func (o *AccountCreateParams) WithReason(reason *string) *AccountCreateParams { + o.SetReason(reason) + return o +} + +// SetReason adds the reason to the account create params +func (o *AccountCreateParams) SetReason(reason *string) { + o.Reason = reason +} + +// WithUsername adds the username to the account create params +func (o *AccountCreateParams) WithUsername(username *string) *AccountCreateParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the account create params +func (o *AccountCreateParams) SetUsername(username *string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Agreement != nil { + + // query param agreement + var qrAgreement bool + + if o.Agreement != nil { + qrAgreement = *o.Agreement + } + qAgreement := swag.FormatBool(qrAgreement) + if qAgreement != "" { + + if err := r.SetQueryParam("agreement", qAgreement); err != nil { + return err + } + } + } + + if o.Email != nil { + + // query param email + var qrEmail string + + if o.Email != nil { + qrEmail = *o.Email + } + qEmail := qrEmail + if qEmail != "" { + + if err := r.SetQueryParam("email", qEmail); err != nil { + return err + } + } + } + + if o.Locale != nil { + + // query param locale + var qrLocale string + + if o.Locale != nil { + qrLocale = *o.Locale + } + qLocale := qrLocale + if qLocale != "" { + + if err := r.SetQueryParam("locale", qLocale); err != nil { + return err + } + } + } + + if o.Password != nil { + + // query param password + var qrPassword string + + if o.Password != nil { + qrPassword = *o.Password + } + qPassword := qrPassword + if qPassword != "" { + + if err := r.SetQueryParam("password", qPassword); err != nil { + return err + } + } + } + + if o.Reason != nil { + + // query param reason + var qrReason string + + if o.Reason != nil { + qrReason = *o.Reason + } + qReason := qrReason + if qReason != "" { + + if err := r.SetQueryParam("reason", qReason); err != nil { + return err + } + } + } + + if o.Username != nil { + + // query param username + var qrUsername string + + if o.Username != nil { + qrUsername = *o.Username + } + qUsername := qrUsername + if qUsername != "" { + + if err := r.SetQueryParam("username", qUsername); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_create_responses.go b/client/accounts/account_create_responses.go new file mode 100644 index 0000000..17a4ad9 --- /dev/null +++ b/client/accounts/account_create_responses.go @@ -0,0 +1,478 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountCreateReader is a Reader for the AccountCreate structure. +type AccountCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewAccountCreateUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts] accountCreate", response, response.Code()) + } +} + +// NewAccountCreateOK creates a AccountCreateOK with default headers values +func NewAccountCreateOK() *AccountCreateOK { + return &AccountCreateOK{} +} + +/* +AccountCreateOK describes a response with status code 200, with default header values. + +An OAuth2 access token for the newly-created account. +*/ +type AccountCreateOK struct { + Payload *models.Token +} + +// IsSuccess returns true when this account create o k response has a 2xx status code +func (o *AccountCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account create o k response has a 3xx status code +func (o *AccountCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create o k response has a 4xx status code +func (o *AccountCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account create o k response has a 5xx status code +func (o *AccountCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account create o k response a status code equal to that given +func (o *AccountCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account create o k response +func (o *AccountCreateOK) Code() int { + return 200 +} + +func (o *AccountCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateOK %s", 200, payload) +} + +func (o *AccountCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateOK %s", 200, payload) +} + +func (o *AccountCreateOK) GetPayload() *models.Token { + return o.Payload +} + +func (o *AccountCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Token) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountCreateBadRequest creates a AccountCreateBadRequest with default headers values +func NewAccountCreateBadRequest() *AccountCreateBadRequest { + return &AccountCreateBadRequest{} +} + +/* +AccountCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountCreateBadRequest struct { +} + +// IsSuccess returns true when this account create bad request response has a 2xx status code +func (o *AccountCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create bad request response has a 3xx status code +func (o *AccountCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create bad request response has a 4xx status code +func (o *AccountCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create bad request response has a 5xx status code +func (o *AccountCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account create bad request response a status code equal to that given +func (o *AccountCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account create bad request response +func (o *AccountCreateBadRequest) Code() int { + return 400 +} + +func (o *AccountCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateBadRequest", 400) +} + +func (o *AccountCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateBadRequest", 400) +} + +func (o *AccountCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateUnauthorized creates a AccountCreateUnauthorized with default headers values +func NewAccountCreateUnauthorized() *AccountCreateUnauthorized { + return &AccountCreateUnauthorized{} +} + +/* +AccountCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountCreateUnauthorized struct { +} + +// IsSuccess returns true when this account create unauthorized response has a 2xx status code +func (o *AccountCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create unauthorized response has a 3xx status code +func (o *AccountCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create unauthorized response has a 4xx status code +func (o *AccountCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create unauthorized response has a 5xx status code +func (o *AccountCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account create unauthorized response a status code equal to that given +func (o *AccountCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account create unauthorized response +func (o *AccountCreateUnauthorized) Code() int { + return 401 +} + +func (o *AccountCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnauthorized", 401) +} + +func (o *AccountCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnauthorized", 401) +} + +func (o *AccountCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateNotFound creates a AccountCreateNotFound with default headers values +func NewAccountCreateNotFound() *AccountCreateNotFound { + return &AccountCreateNotFound{} +} + +/* +AccountCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountCreateNotFound struct { +} + +// IsSuccess returns true when this account create not found response has a 2xx status code +func (o *AccountCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create not found response has a 3xx status code +func (o *AccountCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create not found response has a 4xx status code +func (o *AccountCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create not found response has a 5xx status code +func (o *AccountCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account create not found response a status code equal to that given +func (o *AccountCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account create not found response +func (o *AccountCreateNotFound) Code() int { + return 404 +} + +func (o *AccountCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotFound", 404) +} + +func (o *AccountCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotFound", 404) +} + +func (o *AccountCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateNotAcceptable creates a AccountCreateNotAcceptable with default headers values +func NewAccountCreateNotAcceptable() *AccountCreateNotAcceptable { + return &AccountCreateNotAcceptable{} +} + +/* +AccountCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountCreateNotAcceptable struct { +} + +// IsSuccess returns true when this account create not acceptable response has a 2xx status code +func (o *AccountCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create not acceptable response has a 3xx status code +func (o *AccountCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create not acceptable response has a 4xx status code +func (o *AccountCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create not acceptable response has a 5xx status code +func (o *AccountCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account create not acceptable response a status code equal to that given +func (o *AccountCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account create not acceptable response +func (o *AccountCreateNotAcceptable) Code() int { + return 406 +} + +func (o *AccountCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotAcceptable", 406) +} + +func (o *AccountCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateNotAcceptable", 406) +} + +func (o *AccountCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateUnprocessableEntity creates a AccountCreateUnprocessableEntity with default headers values +func NewAccountCreateUnprocessableEntity() *AccountCreateUnprocessableEntity { + return &AccountCreateUnprocessableEntity{} +} + +/* +AccountCreateUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable. Your account creation request cannot be processed because either too many accounts have been created on this instance in the last 24h, or the pending account backlog is full. +*/ +type AccountCreateUnprocessableEntity struct { +} + +// IsSuccess returns true when this account create unprocessable entity response has a 2xx status code +func (o *AccountCreateUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create unprocessable entity response has a 3xx status code +func (o *AccountCreateUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create unprocessable entity response has a 4xx status code +func (o *AccountCreateUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this account create unprocessable entity response has a 5xx status code +func (o *AccountCreateUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this account create unprocessable entity response a status code equal to that given +func (o *AccountCreateUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the account create unprocessable entity response +func (o *AccountCreateUnprocessableEntity) Code() int { + return 422 +} + +func (o *AccountCreateUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnprocessableEntity", 422) +} + +func (o *AccountCreateUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateUnprocessableEntity", 422) +} + +func (o *AccountCreateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountCreateInternalServerError creates a AccountCreateInternalServerError with default headers values +func NewAccountCreateInternalServerError() *AccountCreateInternalServerError { + return &AccountCreateInternalServerError{} +} + +/* +AccountCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountCreateInternalServerError struct { +} + +// IsSuccess returns true when this account create internal server error response has a 2xx status code +func (o *AccountCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account create internal server error response has a 3xx status code +func (o *AccountCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account create internal server error response has a 4xx status code +func (o *AccountCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account create internal server error response has a 5xx status code +func (o *AccountCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account create internal server error response a status code equal to that given +func (o *AccountCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account create internal server error response +func (o *AccountCreateInternalServerError) Code() int { + return 500 +} + +func (o *AccountCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateInternalServerError", 500) +} + +func (o *AccountCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts][%d] accountCreateInternalServerError", 500) +} + +func (o *AccountCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_delete_parameters.go b/client/accounts/account_delete_parameters.go new file mode 100644 index 0000000..0666fcb --- /dev/null +++ b/client/accounts/account_delete_parameters.go @@ -0,0 +1,155 @@ +// 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" +) + +// NewAccountDeleteParams creates a new AccountDeleteParams 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 NewAccountDeleteParams() *AccountDeleteParams { + return &AccountDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountDeleteParamsWithTimeout creates a new AccountDeleteParams object +// with the ability to set a timeout on a request. +func NewAccountDeleteParamsWithTimeout(timeout time.Duration) *AccountDeleteParams { + return &AccountDeleteParams{ + timeout: timeout, + } +} + +// NewAccountDeleteParamsWithContext creates a new AccountDeleteParams object +// with the ability to set a context for a request. +func NewAccountDeleteParamsWithContext(ctx context.Context) *AccountDeleteParams { + return &AccountDeleteParams{ + Context: ctx, + } +} + +// NewAccountDeleteParamsWithHTTPClient creates a new AccountDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountDeleteParamsWithHTTPClient(client *http.Client) *AccountDeleteParams { + return &AccountDeleteParams{ + HTTPClient: client, + } +} + +/* +AccountDeleteParams contains all the parameters to send to the API endpoint + + for the account delete operation. + + Typically these are written to a http.Request. +*/ +type AccountDeleteParams struct { + + /* Password. + + Password of the account user, for confirmation. + */ + Password string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountDeleteParams) WithDefaults() *AccountDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account delete params +func (o *AccountDeleteParams) WithTimeout(timeout time.Duration) *AccountDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account delete params +func (o *AccountDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account delete params +func (o *AccountDeleteParams) WithContext(ctx context.Context) *AccountDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account delete params +func (o *AccountDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account delete params +func (o *AccountDeleteParams) WithHTTPClient(client *http.Client) *AccountDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account delete params +func (o *AccountDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithPassword adds the password to the account delete params +func (o *AccountDeleteParams) WithPassword(password string) *AccountDeleteParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the account delete params +func (o *AccountDeleteParams) SetPassword(password string) { + o.Password = password +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param password + frPassword := o.Password + fPassword := frPassword + if fPassword != "" { + if err := r.SetFormParam("password", fPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_delete_responses.go b/client/accounts/account_delete_responses.go new file mode 100644 index 0000000..ae33a0c --- /dev/null +++ b/client/accounts/account_delete_responses.go @@ -0,0 +1,398 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// AccountDeleteReader is a Reader for the AccountDelete structure. +type AccountDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewAccountDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/delete] accountDelete", response, response.Code()) + } +} + +// NewAccountDeleteAccepted creates a AccountDeleteAccepted with default headers values +func NewAccountDeleteAccepted() *AccountDeleteAccepted { + return &AccountDeleteAccepted{} +} + +/* +AccountDeleteAccepted describes a response with status code 202, with default header values. + +The account deletion has been accepted and the account will be deleted. +*/ +type AccountDeleteAccepted struct { +} + +// IsSuccess returns true when this account delete accepted response has a 2xx status code +func (o *AccountDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account delete accepted response has a 3xx status code +func (o *AccountDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete accepted response has a 4xx status code +func (o *AccountDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this account delete accepted response has a 5xx status code +func (o *AccountDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete accepted response a status code equal to that given +func (o *AccountDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the account delete accepted response +func (o *AccountDeleteAccepted) Code() int { + return 202 +} + +func (o *AccountDeleteAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteAccepted", 202) +} + +func (o *AccountDeleteAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteAccepted", 202) +} + +func (o *AccountDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteBadRequest creates a AccountDeleteBadRequest with default headers values +func NewAccountDeleteBadRequest() *AccountDeleteBadRequest { + return &AccountDeleteBadRequest{} +} + +/* +AccountDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountDeleteBadRequest struct { +} + +// IsSuccess returns true when this account delete bad request response has a 2xx status code +func (o *AccountDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete bad request response has a 3xx status code +func (o *AccountDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete bad request response has a 4xx status code +func (o *AccountDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete bad request response has a 5xx status code +func (o *AccountDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete bad request response a status code equal to that given +func (o *AccountDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account delete bad request response +func (o *AccountDeleteBadRequest) Code() int { + return 400 +} + +func (o *AccountDeleteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteBadRequest", 400) +} + +func (o *AccountDeleteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteBadRequest", 400) +} + +func (o *AccountDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteUnauthorized creates a AccountDeleteUnauthorized with default headers values +func NewAccountDeleteUnauthorized() *AccountDeleteUnauthorized { + return &AccountDeleteUnauthorized{} +} + +/* +AccountDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountDeleteUnauthorized struct { +} + +// IsSuccess returns true when this account delete unauthorized response has a 2xx status code +func (o *AccountDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete unauthorized response has a 3xx status code +func (o *AccountDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete unauthorized response has a 4xx status code +func (o *AccountDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete unauthorized response has a 5xx status code +func (o *AccountDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete unauthorized response a status code equal to that given +func (o *AccountDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account delete unauthorized response +func (o *AccountDeleteUnauthorized) Code() int { + return 401 +} + +func (o *AccountDeleteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteUnauthorized", 401) +} + +func (o *AccountDeleteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteUnauthorized", 401) +} + +func (o *AccountDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteNotFound creates a AccountDeleteNotFound with default headers values +func NewAccountDeleteNotFound() *AccountDeleteNotFound { + return &AccountDeleteNotFound{} +} + +/* +AccountDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountDeleteNotFound struct { +} + +// IsSuccess returns true when this account delete not found response has a 2xx status code +func (o *AccountDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete not found response has a 3xx status code +func (o *AccountDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete not found response has a 4xx status code +func (o *AccountDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete not found response has a 5xx status code +func (o *AccountDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete not found response a status code equal to that given +func (o *AccountDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account delete not found response +func (o *AccountDeleteNotFound) Code() int { + return 404 +} + +func (o *AccountDeleteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotFound", 404) +} + +func (o *AccountDeleteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotFound", 404) +} + +func (o *AccountDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteNotAcceptable creates a AccountDeleteNotAcceptable with default headers values +func NewAccountDeleteNotAcceptable() *AccountDeleteNotAcceptable { + return &AccountDeleteNotAcceptable{} +} + +/* +AccountDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this account delete not acceptable response has a 2xx status code +func (o *AccountDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete not acceptable response has a 3xx status code +func (o *AccountDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete not acceptable response has a 4xx status code +func (o *AccountDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account delete not acceptable response has a 5xx status code +func (o *AccountDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account delete not acceptable response a status code equal to that given +func (o *AccountDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account delete not acceptable response +func (o *AccountDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotAcceptable", 406) +} + +func (o *AccountDeleteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteNotAcceptable", 406) +} + +func (o *AccountDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountDeleteInternalServerError creates a AccountDeleteInternalServerError with default headers values +func NewAccountDeleteInternalServerError() *AccountDeleteInternalServerError { + return &AccountDeleteInternalServerError{} +} + +/* +AccountDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountDeleteInternalServerError struct { +} + +// IsSuccess returns true when this account delete internal server error response has a 2xx status code +func (o *AccountDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account delete internal server error response has a 3xx status code +func (o *AccountDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account delete internal server error response has a 4xx status code +func (o *AccountDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account delete internal server error response has a 5xx status code +func (o *AccountDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account delete internal server error response a status code equal to that given +func (o *AccountDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account delete internal server error response +func (o *AccountDeleteInternalServerError) Code() int { + return 500 +} + +func (o *AccountDeleteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteInternalServerError", 500) +} + +func (o *AccountDeleteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/delete][%d] accountDeleteInternalServerError", 500) +} + +func (o *AccountDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_follow_parameters.go b/client/accounts/account_follow_parameters.go new file mode 100644 index 0000000..9919012 --- /dev/null +++ b/client/accounts/account_follow_parameters.go @@ -0,0 +1,232 @@ +// 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" +) + +// NewAccountFollowParams creates a new AccountFollowParams 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 NewAccountFollowParams() *AccountFollowParams { + return &AccountFollowParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountFollowParamsWithTimeout creates a new AccountFollowParams object +// with the ability to set a timeout on a request. +func NewAccountFollowParamsWithTimeout(timeout time.Duration) *AccountFollowParams { + return &AccountFollowParams{ + timeout: timeout, + } +} + +// NewAccountFollowParamsWithContext creates a new AccountFollowParams object +// with the ability to set a context for a request. +func NewAccountFollowParamsWithContext(ctx context.Context) *AccountFollowParams { + return &AccountFollowParams{ + Context: ctx, + } +} + +// NewAccountFollowParamsWithHTTPClient creates a new AccountFollowParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountFollowParamsWithHTTPClient(client *http.Client) *AccountFollowParams { + return &AccountFollowParams{ + HTTPClient: client, + } +} + +/* +AccountFollowParams contains all the parameters to send to the API endpoint + + for the account follow operation. + + Typically these are written to a http.Request. +*/ +type AccountFollowParams struct { + + /* ID. + + ID of the account to follow. + */ + ID string + + /* Notify. + + Notify when this account posts. + */ + Notify *bool + + /* Reblogs. + + Show reblogs from this account. + + Default: true + */ + Reblogs *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account follow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowParams) WithDefaults() *AccountFollowParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account follow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowParams) SetDefaults() { + var ( + notifyDefault = bool(false) + + reblogsDefault = bool(true) + ) + + val := AccountFollowParams{ + Notify: ¬ifyDefault, + Reblogs: &reblogsDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account follow params +func (o *AccountFollowParams) WithTimeout(timeout time.Duration) *AccountFollowParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account follow params +func (o *AccountFollowParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account follow params +func (o *AccountFollowParams) WithContext(ctx context.Context) *AccountFollowParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account follow params +func (o *AccountFollowParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account follow params +func (o *AccountFollowParams) WithHTTPClient(client *http.Client) *AccountFollowParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account follow params +func (o *AccountFollowParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account follow params +func (o *AccountFollowParams) WithID(id string) *AccountFollowParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account follow params +func (o *AccountFollowParams) SetID(id string) { + o.ID = id +} + +// WithNotify adds the notify to the account follow params +func (o *AccountFollowParams) WithNotify(notify *bool) *AccountFollowParams { + o.SetNotify(notify) + return o +} + +// SetNotify adds the notify to the account follow params +func (o *AccountFollowParams) SetNotify(notify *bool) { + o.Notify = notify +} + +// WithReblogs adds the reblogs to the account follow params +func (o *AccountFollowParams) WithReblogs(reblogs *bool) *AccountFollowParams { + o.SetReblogs(reblogs) + return o +} + +// SetReblogs adds the reblogs to the account follow params +func (o *AccountFollowParams) SetReblogs(reblogs *bool) { + o.Reblogs = reblogs +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountFollowParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Notify != nil { + + // form param notify + var frNotify bool + if o.Notify != nil { + frNotify = *o.Notify + } + fNotify := swag.FormatBool(frNotify) + if fNotify != "" { + if err := r.SetFormParam("notify", fNotify); err != nil { + return err + } + } + } + + if o.Reblogs != nil { + + // form param reblogs + var frReblogs bool + if o.Reblogs != nil { + frReblogs = *o.Reblogs + } + fReblogs := swag.FormatBool(frReblogs) + if fReblogs != "" { + if err := r.SetFormParam("reblogs", fReblogs); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_follow_responses.go b/client/accounts/account_follow_responses.go new file mode 100644 index 0000000..f25afd1 --- /dev/null +++ b/client/accounts/account_follow_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountFollowReader is a Reader for the AccountFollow structure. +type AccountFollowReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountFollowReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountFollowOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountFollowBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountFollowUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountFollowNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountFollowNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountFollowInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/follow] accountFollow", response, response.Code()) + } +} + +// NewAccountFollowOK creates a AccountFollowOK with default headers values +func NewAccountFollowOK() *AccountFollowOK { + return &AccountFollowOK{} +} + +/* +AccountFollowOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountFollowOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account follow o k response has a 2xx status code +func (o *AccountFollowOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account follow o k response has a 3xx status code +func (o *AccountFollowOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow o k response has a 4xx status code +func (o *AccountFollowOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account follow o k response has a 5xx status code +func (o *AccountFollowOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow o k response a status code equal to that given +func (o *AccountFollowOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account follow o k response +func (o *AccountFollowOK) Code() int { + return 200 +} + +func (o *AccountFollowOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowOK %s", 200, payload) +} + +func (o *AccountFollowOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowOK %s", 200, payload) +} + +func (o *AccountFollowOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountFollowOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountFollowBadRequest creates a AccountFollowBadRequest with default headers values +func NewAccountFollowBadRequest() *AccountFollowBadRequest { + return &AccountFollowBadRequest{} +} + +/* +AccountFollowBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountFollowBadRequest struct { +} + +// IsSuccess returns true when this account follow bad request response has a 2xx status code +func (o *AccountFollowBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow bad request response has a 3xx status code +func (o *AccountFollowBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow bad request response has a 4xx status code +func (o *AccountFollowBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow bad request response has a 5xx status code +func (o *AccountFollowBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow bad request response a status code equal to that given +func (o *AccountFollowBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account follow bad request response +func (o *AccountFollowBadRequest) Code() int { + return 400 +} + +func (o *AccountFollowBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowBadRequest", 400) +} + +func (o *AccountFollowBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowBadRequest", 400) +} + +func (o *AccountFollowBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowUnauthorized creates a AccountFollowUnauthorized with default headers values +func NewAccountFollowUnauthorized() *AccountFollowUnauthorized { + return &AccountFollowUnauthorized{} +} + +/* +AccountFollowUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountFollowUnauthorized struct { +} + +// IsSuccess returns true when this account follow unauthorized response has a 2xx status code +func (o *AccountFollowUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow unauthorized response has a 3xx status code +func (o *AccountFollowUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow unauthorized response has a 4xx status code +func (o *AccountFollowUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow unauthorized response has a 5xx status code +func (o *AccountFollowUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow unauthorized response a status code equal to that given +func (o *AccountFollowUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account follow unauthorized response +func (o *AccountFollowUnauthorized) Code() int { + return 401 +} + +func (o *AccountFollowUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowUnauthorized", 401) +} + +func (o *AccountFollowUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowUnauthorized", 401) +} + +func (o *AccountFollowUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowNotFound creates a AccountFollowNotFound with default headers values +func NewAccountFollowNotFound() *AccountFollowNotFound { + return &AccountFollowNotFound{} +} + +/* +AccountFollowNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountFollowNotFound struct { +} + +// IsSuccess returns true when this account follow not found response has a 2xx status code +func (o *AccountFollowNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow not found response has a 3xx status code +func (o *AccountFollowNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow not found response has a 4xx status code +func (o *AccountFollowNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow not found response has a 5xx status code +func (o *AccountFollowNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow not found response a status code equal to that given +func (o *AccountFollowNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account follow not found response +func (o *AccountFollowNotFound) Code() int { + return 404 +} + +func (o *AccountFollowNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotFound", 404) +} + +func (o *AccountFollowNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotFound", 404) +} + +func (o *AccountFollowNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowNotAcceptable creates a AccountFollowNotAcceptable with default headers values +func NewAccountFollowNotAcceptable() *AccountFollowNotAcceptable { + return &AccountFollowNotAcceptable{} +} + +/* +AccountFollowNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountFollowNotAcceptable struct { +} + +// IsSuccess returns true when this account follow not acceptable response has a 2xx status code +func (o *AccountFollowNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow not acceptable response has a 3xx status code +func (o *AccountFollowNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow not acceptable response has a 4xx status code +func (o *AccountFollowNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account follow not acceptable response has a 5xx status code +func (o *AccountFollowNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account follow not acceptable response a status code equal to that given +func (o *AccountFollowNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account follow not acceptable response +func (o *AccountFollowNotAcceptable) Code() int { + return 406 +} + +func (o *AccountFollowNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotAcceptable", 406) +} + +func (o *AccountFollowNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowNotAcceptable", 406) +} + +func (o *AccountFollowNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowInternalServerError creates a AccountFollowInternalServerError with default headers values +func NewAccountFollowInternalServerError() *AccountFollowInternalServerError { + return &AccountFollowInternalServerError{} +} + +/* +AccountFollowInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountFollowInternalServerError struct { +} + +// IsSuccess returns true when this account follow internal server error response has a 2xx status code +func (o *AccountFollowInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account follow internal server error response has a 3xx status code +func (o *AccountFollowInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account follow internal server error response has a 4xx status code +func (o *AccountFollowInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account follow internal server error response has a 5xx status code +func (o *AccountFollowInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account follow internal server error response a status code equal to that given +func (o *AccountFollowInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account follow internal server error response +func (o *AccountFollowInternalServerError) Code() int { + return 500 +} + +func (o *AccountFollowInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowInternalServerError", 500) +} + +func (o *AccountFollowInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/follow][%d] accountFollowInternalServerError", 500) +} + +func (o *AccountFollowInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_followers_parameters.go b/client/accounts/account_followers_parameters.go new file mode 100644 index 0000000..73aee3c --- /dev/null +++ b/client/accounts/account_followers_parameters.go @@ -0,0 +1,301 @@ +// 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" +) + +// NewAccountFollowersParams creates a new AccountFollowersParams 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 NewAccountFollowersParams() *AccountFollowersParams { + return &AccountFollowersParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountFollowersParamsWithTimeout creates a new AccountFollowersParams object +// with the ability to set a timeout on a request. +func NewAccountFollowersParamsWithTimeout(timeout time.Duration) *AccountFollowersParams { + return &AccountFollowersParams{ + timeout: timeout, + } +} + +// NewAccountFollowersParamsWithContext creates a new AccountFollowersParams object +// with the ability to set a context for a request. +func NewAccountFollowersParamsWithContext(ctx context.Context) *AccountFollowersParams { + return &AccountFollowersParams{ + Context: ctx, + } +} + +// NewAccountFollowersParamsWithHTTPClient creates a new AccountFollowersParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountFollowersParamsWithHTTPClient(client *http.Client) *AccountFollowersParams { + return &AccountFollowersParams{ + HTTPClient: client, + } +} + +/* +AccountFollowersParams contains all the parameters to send to the API endpoint + + for the account followers operation. + + Typically these are written to a http.Request. +*/ +type AccountFollowersParams struct { + + /* ID. + + Account ID. + */ + ID string + + /* Limit. + + Number of follower accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only follower accounts *OLDER* than the given max ID. The follower account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only follower accounts *IMMEDIATELY NEWER* than the given min ID. The follower account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only follower accounts *NEWER* than the given since ID. The follower account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account followers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowersParams) WithDefaults() *AccountFollowersParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account followers params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowersParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := AccountFollowersParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account followers params +func (o *AccountFollowersParams) WithTimeout(timeout time.Duration) *AccountFollowersParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account followers params +func (o *AccountFollowersParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account followers params +func (o *AccountFollowersParams) WithContext(ctx context.Context) *AccountFollowersParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account followers params +func (o *AccountFollowersParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account followers params +func (o *AccountFollowersParams) WithHTTPClient(client *http.Client) *AccountFollowersParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account followers params +func (o *AccountFollowersParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account followers params +func (o *AccountFollowersParams) WithID(id string) *AccountFollowersParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account followers params +func (o *AccountFollowersParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the account followers params +func (o *AccountFollowersParams) WithLimit(limit *int64) *AccountFollowersParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account followers params +func (o *AccountFollowersParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the account followers params +func (o *AccountFollowersParams) WithMaxID(maxID *string) *AccountFollowersParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the account followers params +func (o *AccountFollowersParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the account followers params +func (o *AccountFollowersParams) WithMinID(minID *string) *AccountFollowersParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the account followers params +func (o *AccountFollowersParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the account followers params +func (o *AccountFollowersParams) WithSinceID(sinceID *string) *AccountFollowersParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the account followers params +func (o *AccountFollowersParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountFollowersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + 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.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 +} diff --git a/client/accounts/account_followers_responses.go b/client/accounts/account_followers_responses.go new file mode 100644 index 0000000..dd9ea24 --- /dev/null +++ b/client/accounts/account_followers_responses.go @@ -0,0 +1,426 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountFollowersReader is a Reader for the AccountFollowers structure. +type AccountFollowersReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountFollowersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountFollowersOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountFollowersBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountFollowersUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountFollowersNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountFollowersNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountFollowersInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/followers] accountFollowers", response, response.Code()) + } +} + +// NewAccountFollowersOK creates a AccountFollowersOK with default headers values +func NewAccountFollowersOK() *AccountFollowersOK { + return &AccountFollowersOK{} +} + +/* +AccountFollowersOK describes a response with status code 200, with default header values. + +Array of accounts that follow this account. +*/ +type AccountFollowersOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this account followers o k response has a 2xx status code +func (o *AccountFollowersOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account followers o k response has a 3xx status code +func (o *AccountFollowersOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers o k response has a 4xx status code +func (o *AccountFollowersOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account followers o k response has a 5xx status code +func (o *AccountFollowersOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers o k response a status code equal to that given +func (o *AccountFollowersOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account followers o k response +func (o *AccountFollowersOK) Code() int { + return 200 +} + +func (o *AccountFollowersOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersOK %s", 200, payload) +} + +func (o *AccountFollowersOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersOK %s", 200, payload) +} + +func (o *AccountFollowersOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *AccountFollowersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountFollowersBadRequest creates a AccountFollowersBadRequest with default headers values +func NewAccountFollowersBadRequest() *AccountFollowersBadRequest { + return &AccountFollowersBadRequest{} +} + +/* +AccountFollowersBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountFollowersBadRequest struct { +} + +// IsSuccess returns true when this account followers bad request response has a 2xx status code +func (o *AccountFollowersBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers bad request response has a 3xx status code +func (o *AccountFollowersBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers bad request response has a 4xx status code +func (o *AccountFollowersBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers bad request response has a 5xx status code +func (o *AccountFollowersBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers bad request response a status code equal to that given +func (o *AccountFollowersBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account followers bad request response +func (o *AccountFollowersBadRequest) Code() int { + return 400 +} + +func (o *AccountFollowersBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersBadRequest", 400) +} + +func (o *AccountFollowersBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersBadRequest", 400) +} + +func (o *AccountFollowersBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersUnauthorized creates a AccountFollowersUnauthorized with default headers values +func NewAccountFollowersUnauthorized() *AccountFollowersUnauthorized { + return &AccountFollowersUnauthorized{} +} + +/* +AccountFollowersUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountFollowersUnauthorized struct { +} + +// IsSuccess returns true when this account followers unauthorized response has a 2xx status code +func (o *AccountFollowersUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers unauthorized response has a 3xx status code +func (o *AccountFollowersUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers unauthorized response has a 4xx status code +func (o *AccountFollowersUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers unauthorized response has a 5xx status code +func (o *AccountFollowersUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers unauthorized response a status code equal to that given +func (o *AccountFollowersUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account followers unauthorized response +func (o *AccountFollowersUnauthorized) Code() int { + return 401 +} + +func (o *AccountFollowersUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersUnauthorized", 401) +} + +func (o *AccountFollowersUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersUnauthorized", 401) +} + +func (o *AccountFollowersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersNotFound creates a AccountFollowersNotFound with default headers values +func NewAccountFollowersNotFound() *AccountFollowersNotFound { + return &AccountFollowersNotFound{} +} + +/* +AccountFollowersNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountFollowersNotFound struct { +} + +// IsSuccess returns true when this account followers not found response has a 2xx status code +func (o *AccountFollowersNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers not found response has a 3xx status code +func (o *AccountFollowersNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers not found response has a 4xx status code +func (o *AccountFollowersNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers not found response has a 5xx status code +func (o *AccountFollowersNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers not found response a status code equal to that given +func (o *AccountFollowersNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account followers not found response +func (o *AccountFollowersNotFound) Code() int { + return 404 +} + +func (o *AccountFollowersNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotFound", 404) +} + +func (o *AccountFollowersNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotFound", 404) +} + +func (o *AccountFollowersNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersNotAcceptable creates a AccountFollowersNotAcceptable with default headers values +func NewAccountFollowersNotAcceptable() *AccountFollowersNotAcceptable { + return &AccountFollowersNotAcceptable{} +} + +/* +AccountFollowersNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountFollowersNotAcceptable struct { +} + +// IsSuccess returns true when this account followers not acceptable response has a 2xx status code +func (o *AccountFollowersNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers not acceptable response has a 3xx status code +func (o *AccountFollowersNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers not acceptable response has a 4xx status code +func (o *AccountFollowersNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account followers not acceptable response has a 5xx status code +func (o *AccountFollowersNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account followers not acceptable response a status code equal to that given +func (o *AccountFollowersNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account followers not acceptable response +func (o *AccountFollowersNotAcceptable) Code() int { + return 406 +} + +func (o *AccountFollowersNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotAcceptable", 406) +} + +func (o *AccountFollowersNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersNotAcceptable", 406) +} + +func (o *AccountFollowersNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowersInternalServerError creates a AccountFollowersInternalServerError with default headers values +func NewAccountFollowersInternalServerError() *AccountFollowersInternalServerError { + return &AccountFollowersInternalServerError{} +} + +/* +AccountFollowersInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountFollowersInternalServerError struct { +} + +// IsSuccess returns true when this account followers internal server error response has a 2xx status code +func (o *AccountFollowersInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account followers internal server error response has a 3xx status code +func (o *AccountFollowersInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account followers internal server error response has a 4xx status code +func (o *AccountFollowersInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account followers internal server error response has a 5xx status code +func (o *AccountFollowersInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account followers internal server error response a status code equal to that given +func (o *AccountFollowersInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account followers internal server error response +func (o *AccountFollowersInternalServerError) Code() int { + return 500 +} + +func (o *AccountFollowersInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersInternalServerError", 500) +} + +func (o *AccountFollowersInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/followers][%d] accountFollowersInternalServerError", 500) +} + +func (o *AccountFollowersInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_following_parameters.go b/client/accounts/account_following_parameters.go new file mode 100644 index 0000000..03471eb --- /dev/null +++ b/client/accounts/account_following_parameters.go @@ -0,0 +1,301 @@ +// 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" +) + +// NewAccountFollowingParams creates a new AccountFollowingParams 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 NewAccountFollowingParams() *AccountFollowingParams { + return &AccountFollowingParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountFollowingParamsWithTimeout creates a new AccountFollowingParams object +// with the ability to set a timeout on a request. +func NewAccountFollowingParamsWithTimeout(timeout time.Duration) *AccountFollowingParams { + return &AccountFollowingParams{ + timeout: timeout, + } +} + +// NewAccountFollowingParamsWithContext creates a new AccountFollowingParams object +// with the ability to set a context for a request. +func NewAccountFollowingParamsWithContext(ctx context.Context) *AccountFollowingParams { + return &AccountFollowingParams{ + Context: ctx, + } +} + +// NewAccountFollowingParamsWithHTTPClient creates a new AccountFollowingParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountFollowingParamsWithHTTPClient(client *http.Client) *AccountFollowingParams { + return &AccountFollowingParams{ + HTTPClient: client, + } +} + +/* +AccountFollowingParams contains all the parameters to send to the API endpoint + + for the account following operation. + + Typically these are written to a http.Request. +*/ +type AccountFollowingParams struct { + + /* ID. + + Account ID. + */ + ID string + + /* Limit. + + Number of following accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only following accounts *OLDER* than the given max ID. The following account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only following accounts *IMMEDIATELY NEWER* than the given min ID. The following account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only following accounts *NEWER* than the given since ID. The following account with the specified ID will not be included in the response. NOTE: the ID is of the internal follow, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account following params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowingParams) WithDefaults() *AccountFollowingParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account following params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountFollowingParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := AccountFollowingParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account following params +func (o *AccountFollowingParams) WithTimeout(timeout time.Duration) *AccountFollowingParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account following params +func (o *AccountFollowingParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account following params +func (o *AccountFollowingParams) WithContext(ctx context.Context) *AccountFollowingParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account following params +func (o *AccountFollowingParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account following params +func (o *AccountFollowingParams) WithHTTPClient(client *http.Client) *AccountFollowingParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account following params +func (o *AccountFollowingParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account following params +func (o *AccountFollowingParams) WithID(id string) *AccountFollowingParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account following params +func (o *AccountFollowingParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the account following params +func (o *AccountFollowingParams) WithLimit(limit *int64) *AccountFollowingParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account following params +func (o *AccountFollowingParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the account following params +func (o *AccountFollowingParams) WithMaxID(maxID *string) *AccountFollowingParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the account following params +func (o *AccountFollowingParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the account following params +func (o *AccountFollowingParams) WithMinID(minID *string) *AccountFollowingParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the account following params +func (o *AccountFollowingParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the account following params +func (o *AccountFollowingParams) WithSinceID(sinceID *string) *AccountFollowingParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the account following params +func (o *AccountFollowingParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountFollowingParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + 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.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 +} diff --git a/client/accounts/account_following_responses.go b/client/accounts/account_following_responses.go new file mode 100644 index 0000000..3e0c985 --- /dev/null +++ b/client/accounts/account_following_responses.go @@ -0,0 +1,426 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountFollowingReader is a Reader for the AccountFollowing structure. +type AccountFollowingReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountFollowingReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountFollowingOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountFollowingBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountFollowingUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountFollowingNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountFollowingNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountFollowingInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/following] accountFollowing", response, response.Code()) + } +} + +// NewAccountFollowingOK creates a AccountFollowingOK with default headers values +func NewAccountFollowingOK() *AccountFollowingOK { + return &AccountFollowingOK{} +} + +/* +AccountFollowingOK describes a response with status code 200, with default header values. + +Array of accounts that are followed by this account. +*/ +type AccountFollowingOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this account following o k response has a 2xx status code +func (o *AccountFollowingOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account following o k response has a 3xx status code +func (o *AccountFollowingOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following o k response has a 4xx status code +func (o *AccountFollowingOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account following o k response has a 5xx status code +func (o *AccountFollowingOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account following o k response a status code equal to that given +func (o *AccountFollowingOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account following o k response +func (o *AccountFollowingOK) Code() int { + return 200 +} + +func (o *AccountFollowingOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingOK %s", 200, payload) +} + +func (o *AccountFollowingOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingOK %s", 200, payload) +} + +func (o *AccountFollowingOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *AccountFollowingOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountFollowingBadRequest creates a AccountFollowingBadRequest with default headers values +func NewAccountFollowingBadRequest() *AccountFollowingBadRequest { + return &AccountFollowingBadRequest{} +} + +/* +AccountFollowingBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountFollowingBadRequest struct { +} + +// IsSuccess returns true when this account following bad request response has a 2xx status code +func (o *AccountFollowingBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following bad request response has a 3xx status code +func (o *AccountFollowingBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following bad request response has a 4xx status code +func (o *AccountFollowingBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following bad request response has a 5xx status code +func (o *AccountFollowingBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account following bad request response a status code equal to that given +func (o *AccountFollowingBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account following bad request response +func (o *AccountFollowingBadRequest) Code() int { + return 400 +} + +func (o *AccountFollowingBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingBadRequest", 400) +} + +func (o *AccountFollowingBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingBadRequest", 400) +} + +func (o *AccountFollowingBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingUnauthorized creates a AccountFollowingUnauthorized with default headers values +func NewAccountFollowingUnauthorized() *AccountFollowingUnauthorized { + return &AccountFollowingUnauthorized{} +} + +/* +AccountFollowingUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountFollowingUnauthorized struct { +} + +// IsSuccess returns true when this account following unauthorized response has a 2xx status code +func (o *AccountFollowingUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following unauthorized response has a 3xx status code +func (o *AccountFollowingUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following unauthorized response has a 4xx status code +func (o *AccountFollowingUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following unauthorized response has a 5xx status code +func (o *AccountFollowingUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account following unauthorized response a status code equal to that given +func (o *AccountFollowingUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account following unauthorized response +func (o *AccountFollowingUnauthorized) Code() int { + return 401 +} + +func (o *AccountFollowingUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingUnauthorized", 401) +} + +func (o *AccountFollowingUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingUnauthorized", 401) +} + +func (o *AccountFollowingUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingNotFound creates a AccountFollowingNotFound with default headers values +func NewAccountFollowingNotFound() *AccountFollowingNotFound { + return &AccountFollowingNotFound{} +} + +/* +AccountFollowingNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountFollowingNotFound struct { +} + +// IsSuccess returns true when this account following not found response has a 2xx status code +func (o *AccountFollowingNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following not found response has a 3xx status code +func (o *AccountFollowingNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following not found response has a 4xx status code +func (o *AccountFollowingNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following not found response has a 5xx status code +func (o *AccountFollowingNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account following not found response a status code equal to that given +func (o *AccountFollowingNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account following not found response +func (o *AccountFollowingNotFound) Code() int { + return 404 +} + +func (o *AccountFollowingNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotFound", 404) +} + +func (o *AccountFollowingNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotFound", 404) +} + +func (o *AccountFollowingNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingNotAcceptable creates a AccountFollowingNotAcceptable with default headers values +func NewAccountFollowingNotAcceptable() *AccountFollowingNotAcceptable { + return &AccountFollowingNotAcceptable{} +} + +/* +AccountFollowingNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountFollowingNotAcceptable struct { +} + +// IsSuccess returns true when this account following not acceptable response has a 2xx status code +func (o *AccountFollowingNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following not acceptable response has a 3xx status code +func (o *AccountFollowingNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following not acceptable response has a 4xx status code +func (o *AccountFollowingNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account following not acceptable response has a 5xx status code +func (o *AccountFollowingNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account following not acceptable response a status code equal to that given +func (o *AccountFollowingNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account following not acceptable response +func (o *AccountFollowingNotAcceptable) Code() int { + return 406 +} + +func (o *AccountFollowingNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotAcceptable", 406) +} + +func (o *AccountFollowingNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingNotAcceptable", 406) +} + +func (o *AccountFollowingNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountFollowingInternalServerError creates a AccountFollowingInternalServerError with default headers values +func NewAccountFollowingInternalServerError() *AccountFollowingInternalServerError { + return &AccountFollowingInternalServerError{} +} + +/* +AccountFollowingInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountFollowingInternalServerError struct { +} + +// IsSuccess returns true when this account following internal server error response has a 2xx status code +func (o *AccountFollowingInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account following internal server error response has a 3xx status code +func (o *AccountFollowingInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account following internal server error response has a 4xx status code +func (o *AccountFollowingInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account following internal server error response has a 5xx status code +func (o *AccountFollowingInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account following internal server error response a status code equal to that given +func (o *AccountFollowingInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account following internal server error response +func (o *AccountFollowingInternalServerError) Code() int { + return 500 +} + +func (o *AccountFollowingInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingInternalServerError", 500) +} + +func (o *AccountFollowingInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/following][%d] accountFollowingInternalServerError", 500) +} + +func (o *AccountFollowingInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_get_parameters.go b/client/accounts/account_get_parameters.go new file mode 100644 index 0000000..21d7921 --- /dev/null +++ b/client/accounts/account_get_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewAccountGetParams creates a new AccountGetParams 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 NewAccountGetParams() *AccountGetParams { + return &AccountGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountGetParamsWithTimeout creates a new AccountGetParams object +// with the ability to set a timeout on a request. +func NewAccountGetParamsWithTimeout(timeout time.Duration) *AccountGetParams { + return &AccountGetParams{ + timeout: timeout, + } +} + +// NewAccountGetParamsWithContext creates a new AccountGetParams object +// with the ability to set a context for a request. +func NewAccountGetParamsWithContext(ctx context.Context) *AccountGetParams { + return &AccountGetParams{ + Context: ctx, + } +} + +// NewAccountGetParamsWithHTTPClient creates a new AccountGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountGetParamsWithHTTPClient(client *http.Client) *AccountGetParams { + return &AccountGetParams{ + HTTPClient: client, + } +} + +/* +AccountGetParams contains all the parameters to send to the API endpoint + + for the account get operation. + + Typically these are written to a http.Request. +*/ +type AccountGetParams struct { + + /* ID. + + The id of the requested account. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountGetParams) WithDefaults() *AccountGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account get params +func (o *AccountGetParams) WithTimeout(timeout time.Duration) *AccountGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account get params +func (o *AccountGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account get params +func (o *AccountGetParams) WithContext(ctx context.Context) *AccountGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account get params +func (o *AccountGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account get params +func (o *AccountGetParams) WithHTTPClient(client *http.Client) *AccountGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account get params +func (o *AccountGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account get params +func (o *AccountGetParams) WithID(id string) *AccountGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account get params +func (o *AccountGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_get_responses.go b/client/accounts/account_get_responses.go new file mode 100644 index 0000000..4507041 --- /dev/null +++ b/client/accounts/account_get_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountGetReader is a Reader for the AccountGet structure. +type AccountGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}] accountGet", response, response.Code()) + } +} + +// NewAccountGetOK creates a AccountGetOK with default headers values +func NewAccountGetOK() *AccountGetOK { + return &AccountGetOK{} +} + +/* +AccountGetOK describes a response with status code 200, with default header values. + +The requested account. +*/ +type AccountGetOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account get o k response has a 2xx status code +func (o *AccountGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account get o k response has a 3xx status code +func (o *AccountGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get o k response has a 4xx status code +func (o *AccountGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account get o k response has a 5xx status code +func (o *AccountGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account get o k response a status code equal to that given +func (o *AccountGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account get o k response +func (o *AccountGetOK) Code() int { + return 200 +} + +func (o *AccountGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetOK %s", 200, payload) +} + +func (o *AccountGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetOK %s", 200, payload) +} + +func (o *AccountGetOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountGetBadRequest creates a AccountGetBadRequest with default headers values +func NewAccountGetBadRequest() *AccountGetBadRequest { + return &AccountGetBadRequest{} +} + +/* +AccountGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountGetBadRequest struct { +} + +// IsSuccess returns true when this account get bad request response has a 2xx status code +func (o *AccountGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get bad request response has a 3xx status code +func (o *AccountGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get bad request response has a 4xx status code +func (o *AccountGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get bad request response has a 5xx status code +func (o *AccountGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account get bad request response a status code equal to that given +func (o *AccountGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account get bad request response +func (o *AccountGetBadRequest) Code() int { + return 400 +} + +func (o *AccountGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetBadRequest", 400) +} + +func (o *AccountGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetBadRequest", 400) +} + +func (o *AccountGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetUnauthorized creates a AccountGetUnauthorized with default headers values +func NewAccountGetUnauthorized() *AccountGetUnauthorized { + return &AccountGetUnauthorized{} +} + +/* +AccountGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountGetUnauthorized struct { +} + +// IsSuccess returns true when this account get unauthorized response has a 2xx status code +func (o *AccountGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get unauthorized response has a 3xx status code +func (o *AccountGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get unauthorized response has a 4xx status code +func (o *AccountGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get unauthorized response has a 5xx status code +func (o *AccountGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account get unauthorized response a status code equal to that given +func (o *AccountGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account get unauthorized response +func (o *AccountGetUnauthorized) Code() int { + return 401 +} + +func (o *AccountGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetUnauthorized", 401) +} + +func (o *AccountGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetUnauthorized", 401) +} + +func (o *AccountGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetNotFound creates a AccountGetNotFound with default headers values +func NewAccountGetNotFound() *AccountGetNotFound { + return &AccountGetNotFound{} +} + +/* +AccountGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountGetNotFound struct { +} + +// IsSuccess returns true when this account get not found response has a 2xx status code +func (o *AccountGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get not found response has a 3xx status code +func (o *AccountGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get not found response has a 4xx status code +func (o *AccountGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get not found response has a 5xx status code +func (o *AccountGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account get not found response a status code equal to that given +func (o *AccountGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account get not found response +func (o *AccountGetNotFound) Code() int { + return 404 +} + +func (o *AccountGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotFound", 404) +} + +func (o *AccountGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotFound", 404) +} + +func (o *AccountGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetNotAcceptable creates a AccountGetNotAcceptable with default headers values +func NewAccountGetNotAcceptable() *AccountGetNotAcceptable { + return &AccountGetNotAcceptable{} +} + +/* +AccountGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountGetNotAcceptable struct { +} + +// IsSuccess returns true when this account get not acceptable response has a 2xx status code +func (o *AccountGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get not acceptable response has a 3xx status code +func (o *AccountGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get not acceptable response has a 4xx status code +func (o *AccountGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account get not acceptable response has a 5xx status code +func (o *AccountGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account get not acceptable response a status code equal to that given +func (o *AccountGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account get not acceptable response +func (o *AccountGetNotAcceptable) Code() int { + return 406 +} + +func (o *AccountGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotAcceptable", 406) +} + +func (o *AccountGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetNotAcceptable", 406) +} + +func (o *AccountGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountGetInternalServerError creates a AccountGetInternalServerError with default headers values +func NewAccountGetInternalServerError() *AccountGetInternalServerError { + return &AccountGetInternalServerError{} +} + +/* +AccountGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountGetInternalServerError struct { +} + +// IsSuccess returns true when this account get internal server error response has a 2xx status code +func (o *AccountGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account get internal server error response has a 3xx status code +func (o *AccountGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account get internal server error response has a 4xx status code +func (o *AccountGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account get internal server error response has a 5xx status code +func (o *AccountGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account get internal server error response a status code equal to that given +func (o *AccountGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account get internal server error response +func (o *AccountGetInternalServerError) Code() int { + return 500 +} + +func (o *AccountGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetInternalServerError", 500) +} + +func (o *AccountGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}][%d] accountGetInternalServerError", 500) +} + +func (o *AccountGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_header_delete_parameters.go b/client/accounts/account_header_delete_parameters.go new file mode 100644 index 0000000..e0b6a28 --- /dev/null +++ b/client/accounts/account_header_delete_parameters.go @@ -0,0 +1,128 @@ +// 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" +) + +// NewAccountHeaderDeleteParams creates a new AccountHeaderDeleteParams 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 NewAccountHeaderDeleteParams() *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountHeaderDeleteParamsWithTimeout creates a new AccountHeaderDeleteParams object +// with the ability to set a timeout on a request. +func NewAccountHeaderDeleteParamsWithTimeout(timeout time.Duration) *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + timeout: timeout, + } +} + +// NewAccountHeaderDeleteParamsWithContext creates a new AccountHeaderDeleteParams object +// with the ability to set a context for a request. +func NewAccountHeaderDeleteParamsWithContext(ctx context.Context) *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + Context: ctx, + } +} + +// NewAccountHeaderDeleteParamsWithHTTPClient creates a new AccountHeaderDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountHeaderDeleteParamsWithHTTPClient(client *http.Client) *AccountHeaderDeleteParams { + return &AccountHeaderDeleteParams{ + HTTPClient: client, + } +} + +/* +AccountHeaderDeleteParams contains all the parameters to send to the API endpoint + + for the account header delete operation. + + Typically these are written to a http.Request. +*/ +type AccountHeaderDeleteParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account header delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountHeaderDeleteParams) WithDefaults() *AccountHeaderDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account header delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountHeaderDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account header delete params +func (o *AccountHeaderDeleteParams) WithTimeout(timeout time.Duration) *AccountHeaderDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account header delete params +func (o *AccountHeaderDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account header delete params +func (o *AccountHeaderDeleteParams) WithContext(ctx context.Context) *AccountHeaderDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account header delete params +func (o *AccountHeaderDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account header delete params +func (o *AccountHeaderDeleteParams) WithHTTPClient(client *http.Client) *AccountHeaderDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account header delete params +func (o *AccountHeaderDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountHeaderDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_header_delete_responses.go b/client/accounts/account_header_delete_responses.go new file mode 100644 index 0000000..4bfe10a --- /dev/null +++ b/client/accounts/account_header_delete_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountHeaderDeleteReader is a Reader for the AccountHeaderDelete structure. +type AccountHeaderDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountHeaderDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountHeaderDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountHeaderDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountHeaderDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAccountHeaderDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountHeaderDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountHeaderDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/profile/header] accountHeaderDelete", response, response.Code()) + } +} + +// NewAccountHeaderDeleteOK creates a AccountHeaderDeleteOK with default headers values +func NewAccountHeaderDeleteOK() *AccountHeaderDeleteOK { + return &AccountHeaderDeleteOK{} +} + +/* +AccountHeaderDeleteOK describes a response with status code 200, with default header values. + +The updated account, including profile source information. +*/ +type AccountHeaderDeleteOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account header delete o k response has a 2xx status code +func (o *AccountHeaderDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account header delete o k response has a 3xx status code +func (o *AccountHeaderDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete o k response has a 4xx status code +func (o *AccountHeaderDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account header delete o k response has a 5xx status code +func (o *AccountHeaderDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete o k response a status code equal to that given +func (o *AccountHeaderDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account header delete o k response +func (o *AccountHeaderDeleteOK) Code() int { + return 200 +} + +func (o *AccountHeaderDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteOK %s", 200, payload) +} + +func (o *AccountHeaderDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteOK %s", 200, payload) +} + +func (o *AccountHeaderDeleteOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountHeaderDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountHeaderDeleteBadRequest creates a AccountHeaderDeleteBadRequest with default headers values +func NewAccountHeaderDeleteBadRequest() *AccountHeaderDeleteBadRequest { + return &AccountHeaderDeleteBadRequest{} +} + +/* +AccountHeaderDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountHeaderDeleteBadRequest struct { +} + +// IsSuccess returns true when this account header delete bad request response has a 2xx status code +func (o *AccountHeaderDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete bad request response has a 3xx status code +func (o *AccountHeaderDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete bad request response has a 4xx status code +func (o *AccountHeaderDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete bad request response has a 5xx status code +func (o *AccountHeaderDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete bad request response a status code equal to that given +func (o *AccountHeaderDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account header delete bad request response +func (o *AccountHeaderDeleteBadRequest) Code() int { + return 400 +} + +func (o *AccountHeaderDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteBadRequest", 400) +} + +func (o *AccountHeaderDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteBadRequest", 400) +} + +func (o *AccountHeaderDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteUnauthorized creates a AccountHeaderDeleteUnauthorized with default headers values +func NewAccountHeaderDeleteUnauthorized() *AccountHeaderDeleteUnauthorized { + return &AccountHeaderDeleteUnauthorized{} +} + +/* +AccountHeaderDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountHeaderDeleteUnauthorized struct { +} + +// IsSuccess returns true when this account header delete unauthorized response has a 2xx status code +func (o *AccountHeaderDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete unauthorized response has a 3xx status code +func (o *AccountHeaderDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete unauthorized response has a 4xx status code +func (o *AccountHeaderDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete unauthorized response has a 5xx status code +func (o *AccountHeaderDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete unauthorized response a status code equal to that given +func (o *AccountHeaderDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account header delete unauthorized response +func (o *AccountHeaderDeleteUnauthorized) Code() int { + return 401 +} + +func (o *AccountHeaderDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteUnauthorized", 401) +} + +func (o *AccountHeaderDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteUnauthorized", 401) +} + +func (o *AccountHeaderDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteForbidden creates a AccountHeaderDeleteForbidden with default headers values +func NewAccountHeaderDeleteForbidden() *AccountHeaderDeleteForbidden { + return &AccountHeaderDeleteForbidden{} +} + +/* +AccountHeaderDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AccountHeaderDeleteForbidden struct { +} + +// IsSuccess returns true when this account header delete forbidden response has a 2xx status code +func (o *AccountHeaderDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete forbidden response has a 3xx status code +func (o *AccountHeaderDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete forbidden response has a 4xx status code +func (o *AccountHeaderDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete forbidden response has a 5xx status code +func (o *AccountHeaderDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete forbidden response a status code equal to that given +func (o *AccountHeaderDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the account header delete forbidden response +func (o *AccountHeaderDeleteForbidden) Code() int { + return 403 +} + +func (o *AccountHeaderDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteForbidden", 403) +} + +func (o *AccountHeaderDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteForbidden", 403) +} + +func (o *AccountHeaderDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteNotAcceptable creates a AccountHeaderDeleteNotAcceptable with default headers values +func NewAccountHeaderDeleteNotAcceptable() *AccountHeaderDeleteNotAcceptable { + return &AccountHeaderDeleteNotAcceptable{} +} + +/* +AccountHeaderDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountHeaderDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this account header delete not acceptable response has a 2xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete not acceptable response has a 3xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete not acceptable response has a 4xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account header delete not acceptable response has a 5xx status code +func (o *AccountHeaderDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account header delete not acceptable response a status code equal to that given +func (o *AccountHeaderDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account header delete not acceptable response +func (o *AccountHeaderDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountHeaderDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteNotAcceptable", 406) +} + +func (o *AccountHeaderDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteNotAcceptable", 406) +} + +func (o *AccountHeaderDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountHeaderDeleteInternalServerError creates a AccountHeaderDeleteInternalServerError with default headers values +func NewAccountHeaderDeleteInternalServerError() *AccountHeaderDeleteInternalServerError { + return &AccountHeaderDeleteInternalServerError{} +} + +/* +AccountHeaderDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountHeaderDeleteInternalServerError struct { +} + +// IsSuccess returns true when this account header delete internal server error response has a 2xx status code +func (o *AccountHeaderDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account header delete internal server error response has a 3xx status code +func (o *AccountHeaderDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account header delete internal server error response has a 4xx status code +func (o *AccountHeaderDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account header delete internal server error response has a 5xx status code +func (o *AccountHeaderDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account header delete internal server error response a status code equal to that given +func (o *AccountHeaderDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account header delete internal server error response +func (o *AccountHeaderDeleteInternalServerError) Code() int { + return 500 +} + +func (o *AccountHeaderDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteInternalServerError", 500) +} + +func (o *AccountHeaderDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/profile/header][%d] accountHeaderDeleteInternalServerError", 500) +} + +func (o *AccountHeaderDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_lists_parameters.go b/client/accounts/account_lists_parameters.go new file mode 100644 index 0000000..f2baab2 --- /dev/null +++ b/client/accounts/account_lists_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewAccountListsParams creates a new AccountListsParams 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 NewAccountListsParams() *AccountListsParams { + return &AccountListsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountListsParamsWithTimeout creates a new AccountListsParams object +// with the ability to set a timeout on a request. +func NewAccountListsParamsWithTimeout(timeout time.Duration) *AccountListsParams { + return &AccountListsParams{ + timeout: timeout, + } +} + +// NewAccountListsParamsWithContext creates a new AccountListsParams object +// with the ability to set a context for a request. +func NewAccountListsParamsWithContext(ctx context.Context) *AccountListsParams { + return &AccountListsParams{ + Context: ctx, + } +} + +// NewAccountListsParamsWithHTTPClient creates a new AccountListsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountListsParamsWithHTTPClient(client *http.Client) *AccountListsParams { + return &AccountListsParams{ + HTTPClient: client, + } +} + +/* +AccountListsParams contains all the parameters to send to the API endpoint + + for the account lists operation. + + Typically these are written to a http.Request. +*/ +type AccountListsParams struct { + + /* ID. + + Account ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountListsParams) WithDefaults() *AccountListsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountListsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account lists params +func (o *AccountListsParams) WithTimeout(timeout time.Duration) *AccountListsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account lists params +func (o *AccountListsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account lists params +func (o *AccountListsParams) WithContext(ctx context.Context) *AccountListsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account lists params +func (o *AccountListsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account lists params +func (o *AccountListsParams) WithHTTPClient(client *http.Client) *AccountListsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account lists params +func (o *AccountListsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account lists params +func (o *AccountListsParams) WithID(id string) *AccountListsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account lists params +func (o *AccountListsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountListsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_lists_responses.go b/client/accounts/account_lists_responses.go new file mode 100644 index 0000000..06f2da8 --- /dev/null +++ b/client/accounts/account_lists_responses.go @@ -0,0 +1,414 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountListsReader is a Reader for the AccountLists structure. +type AccountListsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountListsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountListsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountListsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountListsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountListsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountListsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountListsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/lists] accountLists", response, response.Code()) + } +} + +// NewAccountListsOK creates a AccountListsOK with default headers values +func NewAccountListsOK() *AccountListsOK { + return &AccountListsOK{} +} + +/* +AccountListsOK describes a response with status code 200, with default header values. + +Array of all lists containing this account. +*/ +type AccountListsOK struct { + Payload []*models.List +} + +// IsSuccess returns true when this account lists o k response has a 2xx status code +func (o *AccountListsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account lists o k response has a 3xx status code +func (o *AccountListsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists o k response has a 4xx status code +func (o *AccountListsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lists o k response has a 5xx status code +func (o *AccountListsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists o k response a status code equal to that given +func (o *AccountListsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account lists o k response +func (o *AccountListsOK) Code() int { + return 200 +} + +func (o *AccountListsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsOK %s", 200, payload) +} + +func (o *AccountListsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsOK %s", 200, payload) +} + +func (o *AccountListsOK) GetPayload() []*models.List { + return o.Payload +} + +func (o *AccountListsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountListsBadRequest creates a AccountListsBadRequest with default headers values +func NewAccountListsBadRequest() *AccountListsBadRequest { + return &AccountListsBadRequest{} +} + +/* +AccountListsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountListsBadRequest struct { +} + +// IsSuccess returns true when this account lists bad request response has a 2xx status code +func (o *AccountListsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists bad request response has a 3xx status code +func (o *AccountListsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists bad request response has a 4xx status code +func (o *AccountListsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists bad request response has a 5xx status code +func (o *AccountListsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists bad request response a status code equal to that given +func (o *AccountListsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account lists bad request response +func (o *AccountListsBadRequest) Code() int { + return 400 +} + +func (o *AccountListsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsBadRequest", 400) +} + +func (o *AccountListsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsBadRequest", 400) +} + +func (o *AccountListsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsUnauthorized creates a AccountListsUnauthorized with default headers values +func NewAccountListsUnauthorized() *AccountListsUnauthorized { + return &AccountListsUnauthorized{} +} + +/* +AccountListsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountListsUnauthorized struct { +} + +// IsSuccess returns true when this account lists unauthorized response has a 2xx status code +func (o *AccountListsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists unauthorized response has a 3xx status code +func (o *AccountListsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists unauthorized response has a 4xx status code +func (o *AccountListsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists unauthorized response has a 5xx status code +func (o *AccountListsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists unauthorized response a status code equal to that given +func (o *AccountListsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account lists unauthorized response +func (o *AccountListsUnauthorized) Code() int { + return 401 +} + +func (o *AccountListsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsUnauthorized", 401) +} + +func (o *AccountListsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsUnauthorized", 401) +} + +func (o *AccountListsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsNotFound creates a AccountListsNotFound with default headers values +func NewAccountListsNotFound() *AccountListsNotFound { + return &AccountListsNotFound{} +} + +/* +AccountListsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountListsNotFound struct { +} + +// IsSuccess returns true when this account lists not found response has a 2xx status code +func (o *AccountListsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists not found response has a 3xx status code +func (o *AccountListsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists not found response has a 4xx status code +func (o *AccountListsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists not found response has a 5xx status code +func (o *AccountListsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists not found response a status code equal to that given +func (o *AccountListsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account lists not found response +func (o *AccountListsNotFound) Code() int { + return 404 +} + +func (o *AccountListsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotFound", 404) +} + +func (o *AccountListsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotFound", 404) +} + +func (o *AccountListsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsNotAcceptable creates a AccountListsNotAcceptable with default headers values +func NewAccountListsNotAcceptable() *AccountListsNotAcceptable { + return &AccountListsNotAcceptable{} +} + +/* +AccountListsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountListsNotAcceptable struct { +} + +// IsSuccess returns true when this account lists not acceptable response has a 2xx status code +func (o *AccountListsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists not acceptable response has a 3xx status code +func (o *AccountListsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists not acceptable response has a 4xx status code +func (o *AccountListsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lists not acceptable response has a 5xx status code +func (o *AccountListsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account lists not acceptable response a status code equal to that given +func (o *AccountListsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account lists not acceptable response +func (o *AccountListsNotAcceptable) Code() int { + return 406 +} + +func (o *AccountListsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotAcceptable", 406) +} + +func (o *AccountListsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsNotAcceptable", 406) +} + +func (o *AccountListsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountListsInternalServerError creates a AccountListsInternalServerError with default headers values +func NewAccountListsInternalServerError() *AccountListsInternalServerError { + return &AccountListsInternalServerError{} +} + +/* +AccountListsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountListsInternalServerError struct { +} + +// IsSuccess returns true when this account lists internal server error response has a 2xx status code +func (o *AccountListsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lists internal server error response has a 3xx status code +func (o *AccountListsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lists internal server error response has a 4xx status code +func (o *AccountListsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lists internal server error response has a 5xx status code +func (o *AccountListsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account lists internal server error response a status code equal to that given +func (o *AccountListsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account lists internal server error response +func (o *AccountListsInternalServerError) Code() int { + return 500 +} + +func (o *AccountListsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsInternalServerError", 500) +} + +func (o *AccountListsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/lists][%d] accountListsInternalServerError", 500) +} + +func (o *AccountListsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_lookup_get_parameters.go b/client/accounts/account_lookup_get_parameters.go new file mode 100644 index 0000000..be84cb7 --- /dev/null +++ b/client/accounts/account_lookup_get_parameters.go @@ -0,0 +1,156 @@ +// 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" +) + +// NewAccountLookupGetParams creates a new AccountLookupGetParams 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 NewAccountLookupGetParams() *AccountLookupGetParams { + return &AccountLookupGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountLookupGetParamsWithTimeout creates a new AccountLookupGetParams object +// with the ability to set a timeout on a request. +func NewAccountLookupGetParamsWithTimeout(timeout time.Duration) *AccountLookupGetParams { + return &AccountLookupGetParams{ + timeout: timeout, + } +} + +// NewAccountLookupGetParamsWithContext creates a new AccountLookupGetParams object +// with the ability to set a context for a request. +func NewAccountLookupGetParamsWithContext(ctx context.Context) *AccountLookupGetParams { + return &AccountLookupGetParams{ + Context: ctx, + } +} + +// NewAccountLookupGetParamsWithHTTPClient creates a new AccountLookupGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountLookupGetParamsWithHTTPClient(client *http.Client) *AccountLookupGetParams { + return &AccountLookupGetParams{ + HTTPClient: client, + } +} + +/* +AccountLookupGetParams contains all the parameters to send to the API endpoint + + for the account lookup get operation. + + Typically these are written to a http.Request. +*/ +type AccountLookupGetParams struct { + + /* Acct. + + The username or Webfinger address to lookup. + */ + Acct string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account lookup get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountLookupGetParams) WithDefaults() *AccountLookupGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account lookup get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountLookupGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account lookup get params +func (o *AccountLookupGetParams) WithTimeout(timeout time.Duration) *AccountLookupGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account lookup get params +func (o *AccountLookupGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account lookup get params +func (o *AccountLookupGetParams) WithContext(ctx context.Context) *AccountLookupGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account lookup get params +func (o *AccountLookupGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account lookup get params +func (o *AccountLookupGetParams) WithHTTPClient(client *http.Client) *AccountLookupGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account lookup get params +func (o *AccountLookupGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAcct adds the acct to the account lookup get params +func (o *AccountLookupGetParams) WithAcct(acct string) *AccountLookupGetParams { + o.SetAcct(acct) + return o +} + +// SetAcct adds the acct to the account lookup get params +func (o *AccountLookupGetParams) SetAcct(acct string) { + o.Acct = acct +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountLookupGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param acct + qrAcct := o.Acct + qAcct := qrAcct + if qAcct != "" { + + if err := r.SetQueryParam("acct", qAcct); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_lookup_get_responses.go b/client/accounts/account_lookup_get_responses.go new file mode 100644 index 0000000..3a8bec4 --- /dev/null +++ b/client/accounts/account_lookup_get_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountLookupGetReader is a Reader for the AccountLookupGet structure. +type AccountLookupGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountLookupGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountLookupGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountLookupGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountLookupGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountLookupGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountLookupGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountLookupGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/lookup] accountLookupGet", response, response.Code()) + } +} + +// NewAccountLookupGetOK creates a AccountLookupGetOK with default headers values +func NewAccountLookupGetOK() *AccountLookupGetOK { + return &AccountLookupGetOK{} +} + +/* +AccountLookupGetOK describes a response with status code 200, with default header values. + +Result of the lookup. +*/ +type AccountLookupGetOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account lookup get o k response has a 2xx status code +func (o *AccountLookupGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account lookup get o k response has a 3xx status code +func (o *AccountLookupGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get o k response has a 4xx status code +func (o *AccountLookupGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lookup get o k response has a 5xx status code +func (o *AccountLookupGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get o k response a status code equal to that given +func (o *AccountLookupGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account lookup get o k response +func (o *AccountLookupGetOK) Code() int { + return 200 +} + +func (o *AccountLookupGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetOK %s", 200, payload) +} + +func (o *AccountLookupGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetOK %s", 200, payload) +} + +func (o *AccountLookupGetOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountLookupGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountLookupGetBadRequest creates a AccountLookupGetBadRequest with default headers values +func NewAccountLookupGetBadRequest() *AccountLookupGetBadRequest { + return &AccountLookupGetBadRequest{} +} + +/* +AccountLookupGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountLookupGetBadRequest struct { +} + +// IsSuccess returns true when this account lookup get bad request response has a 2xx status code +func (o *AccountLookupGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get bad request response has a 3xx status code +func (o *AccountLookupGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get bad request response has a 4xx status code +func (o *AccountLookupGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get bad request response has a 5xx status code +func (o *AccountLookupGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get bad request response a status code equal to that given +func (o *AccountLookupGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account lookup get bad request response +func (o *AccountLookupGetBadRequest) Code() int { + return 400 +} + +func (o *AccountLookupGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetBadRequest", 400) +} + +func (o *AccountLookupGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetBadRequest", 400) +} + +func (o *AccountLookupGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetUnauthorized creates a AccountLookupGetUnauthorized with default headers values +func NewAccountLookupGetUnauthorized() *AccountLookupGetUnauthorized { + return &AccountLookupGetUnauthorized{} +} + +/* +AccountLookupGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountLookupGetUnauthorized struct { +} + +// IsSuccess returns true when this account lookup get unauthorized response has a 2xx status code +func (o *AccountLookupGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get unauthorized response has a 3xx status code +func (o *AccountLookupGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get unauthorized response has a 4xx status code +func (o *AccountLookupGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get unauthorized response has a 5xx status code +func (o *AccountLookupGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get unauthorized response a status code equal to that given +func (o *AccountLookupGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account lookup get unauthorized response +func (o *AccountLookupGetUnauthorized) Code() int { + return 401 +} + +func (o *AccountLookupGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetUnauthorized", 401) +} + +func (o *AccountLookupGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetUnauthorized", 401) +} + +func (o *AccountLookupGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetNotFound creates a AccountLookupGetNotFound with default headers values +func NewAccountLookupGetNotFound() *AccountLookupGetNotFound { + return &AccountLookupGetNotFound{} +} + +/* +AccountLookupGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountLookupGetNotFound struct { +} + +// IsSuccess returns true when this account lookup get not found response has a 2xx status code +func (o *AccountLookupGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get not found response has a 3xx status code +func (o *AccountLookupGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get not found response has a 4xx status code +func (o *AccountLookupGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get not found response has a 5xx status code +func (o *AccountLookupGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get not found response a status code equal to that given +func (o *AccountLookupGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account lookup get not found response +func (o *AccountLookupGetNotFound) Code() int { + return 404 +} + +func (o *AccountLookupGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotFound", 404) +} + +func (o *AccountLookupGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotFound", 404) +} + +func (o *AccountLookupGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetNotAcceptable creates a AccountLookupGetNotAcceptable with default headers values +func NewAccountLookupGetNotAcceptable() *AccountLookupGetNotAcceptable { + return &AccountLookupGetNotAcceptable{} +} + +/* +AccountLookupGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountLookupGetNotAcceptable struct { +} + +// IsSuccess returns true when this account lookup get not acceptable response has a 2xx status code +func (o *AccountLookupGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get not acceptable response has a 3xx status code +func (o *AccountLookupGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get not acceptable response has a 4xx status code +func (o *AccountLookupGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account lookup get not acceptable response has a 5xx status code +func (o *AccountLookupGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account lookup get not acceptable response a status code equal to that given +func (o *AccountLookupGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account lookup get not acceptable response +func (o *AccountLookupGetNotAcceptable) Code() int { + return 406 +} + +func (o *AccountLookupGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotAcceptable", 406) +} + +func (o *AccountLookupGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetNotAcceptable", 406) +} + +func (o *AccountLookupGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountLookupGetInternalServerError creates a AccountLookupGetInternalServerError with default headers values +func NewAccountLookupGetInternalServerError() *AccountLookupGetInternalServerError { + return &AccountLookupGetInternalServerError{} +} + +/* +AccountLookupGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountLookupGetInternalServerError struct { +} + +// IsSuccess returns true when this account lookup get internal server error response has a 2xx status code +func (o *AccountLookupGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account lookup get internal server error response has a 3xx status code +func (o *AccountLookupGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account lookup get internal server error response has a 4xx status code +func (o *AccountLookupGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account lookup get internal server error response has a 5xx status code +func (o *AccountLookupGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account lookup get internal server error response a status code equal to that given +func (o *AccountLookupGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account lookup get internal server error response +func (o *AccountLookupGetInternalServerError) Code() int { + return 500 +} + +func (o *AccountLookupGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetInternalServerError", 500) +} + +func (o *AccountLookupGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/lookup][%d] accountLookupGetInternalServerError", 500) +} + +func (o *AccountLookupGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_move_parameters.go b/client/accounts/account_move_parameters.go new file mode 100644 index 0000000..5b77e0b --- /dev/null +++ b/client/accounts/account_move_parameters.go @@ -0,0 +1,181 @@ +// 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" +) + +// NewAccountMoveParams creates a new AccountMoveParams 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 NewAccountMoveParams() *AccountMoveParams { + return &AccountMoveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountMoveParamsWithTimeout creates a new AccountMoveParams object +// with the ability to set a timeout on a request. +func NewAccountMoveParamsWithTimeout(timeout time.Duration) *AccountMoveParams { + return &AccountMoveParams{ + timeout: timeout, + } +} + +// NewAccountMoveParamsWithContext creates a new AccountMoveParams object +// with the ability to set a context for a request. +func NewAccountMoveParamsWithContext(ctx context.Context) *AccountMoveParams { + return &AccountMoveParams{ + Context: ctx, + } +} + +// NewAccountMoveParamsWithHTTPClient creates a new AccountMoveParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountMoveParamsWithHTTPClient(client *http.Client) *AccountMoveParams { + return &AccountMoveParams{ + HTTPClient: client, + } +} + +/* +AccountMoveParams contains all the parameters to send to the API endpoint + + for the account move operation. + + Typically these are written to a http.Request. +*/ +type AccountMoveParams struct { + + /* MovedToURI. + + ActivityPub URI/ID of the target account. Eg., `https://example.org/users/some_account`. The target account must be alsoKnownAs the requesting account in order for the move to be successful. + */ + MovedToURI string + + /* Password. + + Password of the account user, for confirmation. + */ + Password string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account move params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountMoveParams) WithDefaults() *AccountMoveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account move params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountMoveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account move params +func (o *AccountMoveParams) WithTimeout(timeout time.Duration) *AccountMoveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account move params +func (o *AccountMoveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account move params +func (o *AccountMoveParams) WithContext(ctx context.Context) *AccountMoveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account move params +func (o *AccountMoveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account move params +func (o *AccountMoveParams) WithHTTPClient(client *http.Client) *AccountMoveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account move params +func (o *AccountMoveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMovedToURI adds the movedToURI to the account move params +func (o *AccountMoveParams) WithMovedToURI(movedToURI string) *AccountMoveParams { + o.SetMovedToURI(movedToURI) + return o +} + +// SetMovedToURI adds the movedToUri to the account move params +func (o *AccountMoveParams) SetMovedToURI(movedToURI string) { + o.MovedToURI = movedToURI +} + +// WithPassword adds the password to the account move params +func (o *AccountMoveParams) WithPassword(password string) *AccountMoveParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the account move params +func (o *AccountMoveParams) SetPassword(password string) { + o.Password = password +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountMoveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param moved_to_uri + frMovedToURI := o.MovedToURI + fMovedToURI := frMovedToURI + if fMovedToURI != "" { + if err := r.SetFormParam("moved_to_uri", fMovedToURI); err != nil { + return err + } + } + + // form param password + frPassword := o.Password + fPassword := frPassword + if fPassword != "" { + if err := r.SetFormParam("password", fPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_move_responses.go b/client/accounts/account_move_responses.go new file mode 100644 index 0000000..6c8a909 --- /dev/null +++ b/client/accounts/account_move_responses.go @@ -0,0 +1,460 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// AccountMoveReader is a Reader for the AccountMove structure. +type AccountMoveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountMoveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewAccountMoveAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountMoveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountMoveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountMoveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountMoveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewAccountMoveUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountMoveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/move] accountMove", response, response.Code()) + } +} + +// NewAccountMoveAccepted creates a AccountMoveAccepted with default headers values +func NewAccountMoveAccepted() *AccountMoveAccepted { + return &AccountMoveAccepted{} +} + +/* +AccountMoveAccepted describes a response with status code 202, with default header values. + +The account move has been accepted and the account will be moved. +*/ +type AccountMoveAccepted struct { +} + +// IsSuccess returns true when this account move accepted response has a 2xx status code +func (o *AccountMoveAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account move accepted response has a 3xx status code +func (o *AccountMoveAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move accepted response has a 4xx status code +func (o *AccountMoveAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this account move accepted response has a 5xx status code +func (o *AccountMoveAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this account move accepted response a status code equal to that given +func (o *AccountMoveAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the account move accepted response +func (o *AccountMoveAccepted) Code() int { + return 202 +} + +func (o *AccountMoveAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveAccepted", 202) +} + +func (o *AccountMoveAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveAccepted", 202) +} + +func (o *AccountMoveAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveBadRequest creates a AccountMoveBadRequest with default headers values +func NewAccountMoveBadRequest() *AccountMoveBadRequest { + return &AccountMoveBadRequest{} +} + +/* +AccountMoveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountMoveBadRequest struct { +} + +// IsSuccess returns true when this account move bad request response has a 2xx status code +func (o *AccountMoveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move bad request response has a 3xx status code +func (o *AccountMoveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move bad request response has a 4xx status code +func (o *AccountMoveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move bad request response has a 5xx status code +func (o *AccountMoveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account move bad request response a status code equal to that given +func (o *AccountMoveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account move bad request response +func (o *AccountMoveBadRequest) Code() int { + return 400 +} + +func (o *AccountMoveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveBadRequest", 400) +} + +func (o *AccountMoveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveBadRequest", 400) +} + +func (o *AccountMoveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveUnauthorized creates a AccountMoveUnauthorized with default headers values +func NewAccountMoveUnauthorized() *AccountMoveUnauthorized { + return &AccountMoveUnauthorized{} +} + +/* +AccountMoveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountMoveUnauthorized struct { +} + +// IsSuccess returns true when this account move unauthorized response has a 2xx status code +func (o *AccountMoveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move unauthorized response has a 3xx status code +func (o *AccountMoveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move unauthorized response has a 4xx status code +func (o *AccountMoveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move unauthorized response has a 5xx status code +func (o *AccountMoveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account move unauthorized response a status code equal to that given +func (o *AccountMoveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account move unauthorized response +func (o *AccountMoveUnauthorized) Code() int { + return 401 +} + +func (o *AccountMoveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnauthorized", 401) +} + +func (o *AccountMoveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnauthorized", 401) +} + +func (o *AccountMoveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveNotFound creates a AccountMoveNotFound with default headers values +func NewAccountMoveNotFound() *AccountMoveNotFound { + return &AccountMoveNotFound{} +} + +/* +AccountMoveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountMoveNotFound struct { +} + +// IsSuccess returns true when this account move not found response has a 2xx status code +func (o *AccountMoveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move not found response has a 3xx status code +func (o *AccountMoveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move not found response has a 4xx status code +func (o *AccountMoveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move not found response has a 5xx status code +func (o *AccountMoveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account move not found response a status code equal to that given +func (o *AccountMoveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account move not found response +func (o *AccountMoveNotFound) Code() int { + return 404 +} + +func (o *AccountMoveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotFound", 404) +} + +func (o *AccountMoveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotFound", 404) +} + +func (o *AccountMoveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveNotAcceptable creates a AccountMoveNotAcceptable with default headers values +func NewAccountMoveNotAcceptable() *AccountMoveNotAcceptable { + return &AccountMoveNotAcceptable{} +} + +/* +AccountMoveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountMoveNotAcceptable struct { +} + +// IsSuccess returns true when this account move not acceptable response has a 2xx status code +func (o *AccountMoveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move not acceptable response has a 3xx status code +func (o *AccountMoveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move not acceptable response has a 4xx status code +func (o *AccountMoveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move not acceptable response has a 5xx status code +func (o *AccountMoveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account move not acceptable response a status code equal to that given +func (o *AccountMoveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account move not acceptable response +func (o *AccountMoveNotAcceptable) Code() int { + return 406 +} + +func (o *AccountMoveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotAcceptable", 406) +} + +func (o *AccountMoveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveNotAcceptable", 406) +} + +func (o *AccountMoveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveUnprocessableEntity creates a AccountMoveUnprocessableEntity with default headers values +func NewAccountMoveUnprocessableEntity() *AccountMoveUnprocessableEntity { + return &AccountMoveUnprocessableEntity{} +} + +/* +AccountMoveUnprocessableEntity describes a response with status code 422, with default header values. + +Unprocessable. Check the response body for more details. +*/ +type AccountMoveUnprocessableEntity struct { +} + +// IsSuccess returns true when this account move unprocessable entity response has a 2xx status code +func (o *AccountMoveUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move unprocessable entity response has a 3xx status code +func (o *AccountMoveUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move unprocessable entity response has a 4xx status code +func (o *AccountMoveUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this account move unprocessable entity response has a 5xx status code +func (o *AccountMoveUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this account move unprocessable entity response a status code equal to that given +func (o *AccountMoveUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the account move unprocessable entity response +func (o *AccountMoveUnprocessableEntity) Code() int { + return 422 +} + +func (o *AccountMoveUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnprocessableEntity", 422) +} + +func (o *AccountMoveUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveUnprocessableEntity", 422) +} + +func (o *AccountMoveUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMoveInternalServerError creates a AccountMoveInternalServerError with default headers values +func NewAccountMoveInternalServerError() *AccountMoveInternalServerError { + return &AccountMoveInternalServerError{} +} + +/* +AccountMoveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountMoveInternalServerError struct { +} + +// IsSuccess returns true when this account move internal server error response has a 2xx status code +func (o *AccountMoveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account move internal server error response has a 3xx status code +func (o *AccountMoveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account move internal server error response has a 4xx status code +func (o *AccountMoveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account move internal server error response has a 5xx status code +func (o *AccountMoveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account move internal server error response a status code equal to that given +func (o *AccountMoveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account move internal server error response +func (o *AccountMoveInternalServerError) Code() int { + return 500 +} + +func (o *AccountMoveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveInternalServerError", 500) +} + +func (o *AccountMoveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/move][%d] accountMoveInternalServerError", 500) +} + +func (o *AccountMoveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_mute_parameters.go b/client/accounts/account_mute_parameters.go new file mode 100644 index 0000000..8d2c138 --- /dev/null +++ b/client/accounts/account_mute_parameters.go @@ -0,0 +1,230 @@ +// 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 +} diff --git a/client/accounts/account_mute_responses.go b/client/accounts/account_mute_responses.go new file mode 100644 index 0000000..1a6a9f8 --- /dev/null +++ b/client/accounts/account_mute_responses.go @@ -0,0 +1,478 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountMuteReader is a Reader for the AccountMute structure. +type AccountMuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountMuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountMuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountMuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountMuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAccountMuteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountMuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountMuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountMuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/mute] accountMute", response, response.Code()) + } +} + +// NewAccountMuteOK creates a AccountMuteOK with default headers values +func NewAccountMuteOK() *AccountMuteOK { + return &AccountMuteOK{} +} + +/* +AccountMuteOK describes a response with status code 200, with default header values. + +Your relationship to the account. +*/ +type AccountMuteOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account mute o k response has a 2xx status code +func (o *AccountMuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account mute o k response has a 3xx status code +func (o *AccountMuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute o k response has a 4xx status code +func (o *AccountMuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account mute o k response has a 5xx status code +func (o *AccountMuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute o k response a status code equal to that given +func (o *AccountMuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account mute o k response +func (o *AccountMuteOK) Code() int { + return 200 +} + +func (o *AccountMuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteOK %s", 200, payload) +} + +func (o *AccountMuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteOK %s", 200, payload) +} + +func (o *AccountMuteOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountMuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountMuteBadRequest creates a AccountMuteBadRequest with default headers values +func NewAccountMuteBadRequest() *AccountMuteBadRequest { + return &AccountMuteBadRequest{} +} + +/* +AccountMuteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountMuteBadRequest struct { +} + +// IsSuccess returns true when this account mute bad request response has a 2xx status code +func (o *AccountMuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute bad request response has a 3xx status code +func (o *AccountMuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute bad request response has a 4xx status code +func (o *AccountMuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute bad request response has a 5xx status code +func (o *AccountMuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute bad request response a status code equal to that given +func (o *AccountMuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account mute bad request response +func (o *AccountMuteBadRequest) Code() int { + return 400 +} + +func (o *AccountMuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteBadRequest", 400) +} + +func (o *AccountMuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteBadRequest", 400) +} + +func (o *AccountMuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteUnauthorized creates a AccountMuteUnauthorized with default headers values +func NewAccountMuteUnauthorized() *AccountMuteUnauthorized { + return &AccountMuteUnauthorized{} +} + +/* +AccountMuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountMuteUnauthorized struct { +} + +// IsSuccess returns true when this account mute unauthorized response has a 2xx status code +func (o *AccountMuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute unauthorized response has a 3xx status code +func (o *AccountMuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute unauthorized response has a 4xx status code +func (o *AccountMuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute unauthorized response has a 5xx status code +func (o *AccountMuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute unauthorized response a status code equal to that given +func (o *AccountMuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account mute unauthorized response +func (o *AccountMuteUnauthorized) Code() int { + return 401 +} + +func (o *AccountMuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteUnauthorized", 401) +} + +func (o *AccountMuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteUnauthorized", 401) +} + +func (o *AccountMuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteForbidden creates a AccountMuteForbidden with default headers values +func NewAccountMuteForbidden() *AccountMuteForbidden { + return &AccountMuteForbidden{} +} + +/* +AccountMuteForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type AccountMuteForbidden struct { +} + +// IsSuccess returns true when this account mute forbidden response has a 2xx status code +func (o *AccountMuteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute forbidden response has a 3xx status code +func (o *AccountMuteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute forbidden response has a 4xx status code +func (o *AccountMuteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute forbidden response has a 5xx status code +func (o *AccountMuteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute forbidden response a status code equal to that given +func (o *AccountMuteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the account mute forbidden response +func (o *AccountMuteForbidden) Code() int { + return 403 +} + +func (o *AccountMuteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteForbidden", 403) +} + +func (o *AccountMuteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteForbidden", 403) +} + +func (o *AccountMuteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteNotFound creates a AccountMuteNotFound with default headers values +func NewAccountMuteNotFound() *AccountMuteNotFound { + return &AccountMuteNotFound{} +} + +/* +AccountMuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountMuteNotFound struct { +} + +// IsSuccess returns true when this account mute not found response has a 2xx status code +func (o *AccountMuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute not found response has a 3xx status code +func (o *AccountMuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute not found response has a 4xx status code +func (o *AccountMuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute not found response has a 5xx status code +func (o *AccountMuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute not found response a status code equal to that given +func (o *AccountMuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account mute not found response +func (o *AccountMuteNotFound) Code() int { + return 404 +} + +func (o *AccountMuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotFound", 404) +} + +func (o *AccountMuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotFound", 404) +} + +func (o *AccountMuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteNotAcceptable creates a AccountMuteNotAcceptable with default headers values +func NewAccountMuteNotAcceptable() *AccountMuteNotAcceptable { + return &AccountMuteNotAcceptable{} +} + +/* +AccountMuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountMuteNotAcceptable struct { +} + +// IsSuccess returns true when this account mute not acceptable response has a 2xx status code +func (o *AccountMuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute not acceptable response has a 3xx status code +func (o *AccountMuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute not acceptable response has a 4xx status code +func (o *AccountMuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account mute not acceptable response has a 5xx status code +func (o *AccountMuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account mute not acceptable response a status code equal to that given +func (o *AccountMuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account mute not acceptable response +func (o *AccountMuteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountMuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotAcceptable", 406) +} + +func (o *AccountMuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteNotAcceptable", 406) +} + +func (o *AccountMuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountMuteInternalServerError creates a AccountMuteInternalServerError with default headers values +func NewAccountMuteInternalServerError() *AccountMuteInternalServerError { + return &AccountMuteInternalServerError{} +} + +/* +AccountMuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountMuteInternalServerError struct { +} + +// IsSuccess returns true when this account mute internal server error response has a 2xx status code +func (o *AccountMuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account mute internal server error response has a 3xx status code +func (o *AccountMuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account mute internal server error response has a 4xx status code +func (o *AccountMuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account mute internal server error response has a 5xx status code +func (o *AccountMuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account mute internal server error response a status code equal to that given +func (o *AccountMuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account mute internal server error response +func (o *AccountMuteInternalServerError) Code() int { + return 500 +} + +func (o *AccountMuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteInternalServerError", 500) +} + +func (o *AccountMuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/mute][%d] accountMuteInternalServerError", 500) +} + +func (o *AccountMuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_note_parameters.go b/client/accounts/account_note_parameters.go new file mode 100644 index 0000000..a14b8b3 --- /dev/null +++ b/client/accounts/account_note_parameters.go @@ -0,0 +1,194 @@ +// 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" +) + +// NewAccountNoteParams creates a new AccountNoteParams 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 NewAccountNoteParams() *AccountNoteParams { + return &AccountNoteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountNoteParamsWithTimeout creates a new AccountNoteParams object +// with the ability to set a timeout on a request. +func NewAccountNoteParamsWithTimeout(timeout time.Duration) *AccountNoteParams { + return &AccountNoteParams{ + timeout: timeout, + } +} + +// NewAccountNoteParamsWithContext creates a new AccountNoteParams object +// with the ability to set a context for a request. +func NewAccountNoteParamsWithContext(ctx context.Context) *AccountNoteParams { + return &AccountNoteParams{ + Context: ctx, + } +} + +// NewAccountNoteParamsWithHTTPClient creates a new AccountNoteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountNoteParamsWithHTTPClient(client *http.Client) *AccountNoteParams { + return &AccountNoteParams{ + HTTPClient: client, + } +} + +/* +AccountNoteParams contains all the parameters to send to the API endpoint + + for the account note operation. + + Typically these are written to a http.Request. +*/ +type AccountNoteParams struct { + + /* Comment. + + The text of the note. Omit this parameter or send an empty string to clear the note. + */ + Comment *string + + /* ID. + + The id of the account for which to set a note. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account note params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountNoteParams) WithDefaults() *AccountNoteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account note params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountNoteParams) SetDefaults() { + var ( + commentDefault = string("") + ) + + val := AccountNoteParams{ + Comment: &commentDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account note params +func (o *AccountNoteParams) WithTimeout(timeout time.Duration) *AccountNoteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account note params +func (o *AccountNoteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account note params +func (o *AccountNoteParams) WithContext(ctx context.Context) *AccountNoteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account note params +func (o *AccountNoteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account note params +func (o *AccountNoteParams) WithHTTPClient(client *http.Client) *AccountNoteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account note params +func (o *AccountNoteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithComment adds the comment to the account note params +func (o *AccountNoteParams) WithComment(comment *string) *AccountNoteParams { + o.SetComment(comment) + return o +} + +// SetComment adds the comment to the account note params +func (o *AccountNoteParams) SetComment(comment *string) { + o.Comment = comment +} + +// WithID adds the id to the account note params +func (o *AccountNoteParams) WithID(id string) *AccountNoteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account note params +func (o *AccountNoteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountNoteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + 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 + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_note_responses.go b/client/accounts/account_note_responses.go new file mode 100644 index 0000000..d79a178 --- /dev/null +++ b/client/accounts/account_note_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountNoteReader is a Reader for the AccountNote structure. +type AccountNoteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountNoteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountNoteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountNoteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountNoteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountNoteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountNoteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountNoteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/note] accountNote", response, response.Code()) + } +} + +// NewAccountNoteOK creates a AccountNoteOK with default headers values +func NewAccountNoteOK() *AccountNoteOK { + return &AccountNoteOK{} +} + +/* +AccountNoteOK describes a response with status code 200, with default header values. + +Your relationship to the account. +*/ +type AccountNoteOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account note o k response has a 2xx status code +func (o *AccountNoteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account note o k response has a 3xx status code +func (o *AccountNoteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note o k response has a 4xx status code +func (o *AccountNoteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account note o k response has a 5xx status code +func (o *AccountNoteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account note o k response a status code equal to that given +func (o *AccountNoteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account note o k response +func (o *AccountNoteOK) Code() int { + return 200 +} + +func (o *AccountNoteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteOK %s", 200, payload) +} + +func (o *AccountNoteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteOK %s", 200, payload) +} + +func (o *AccountNoteOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountNoteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountNoteBadRequest creates a AccountNoteBadRequest with default headers values +func NewAccountNoteBadRequest() *AccountNoteBadRequest { + return &AccountNoteBadRequest{} +} + +/* +AccountNoteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountNoteBadRequest struct { +} + +// IsSuccess returns true when this account note bad request response has a 2xx status code +func (o *AccountNoteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note bad request response has a 3xx status code +func (o *AccountNoteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note bad request response has a 4xx status code +func (o *AccountNoteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note bad request response has a 5xx status code +func (o *AccountNoteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account note bad request response a status code equal to that given +func (o *AccountNoteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account note bad request response +func (o *AccountNoteBadRequest) Code() int { + return 400 +} + +func (o *AccountNoteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteBadRequest", 400) +} + +func (o *AccountNoteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteBadRequest", 400) +} + +func (o *AccountNoteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteUnauthorized creates a AccountNoteUnauthorized with default headers values +func NewAccountNoteUnauthorized() *AccountNoteUnauthorized { + return &AccountNoteUnauthorized{} +} + +/* +AccountNoteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountNoteUnauthorized struct { +} + +// IsSuccess returns true when this account note unauthorized response has a 2xx status code +func (o *AccountNoteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note unauthorized response has a 3xx status code +func (o *AccountNoteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note unauthorized response has a 4xx status code +func (o *AccountNoteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note unauthorized response has a 5xx status code +func (o *AccountNoteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account note unauthorized response a status code equal to that given +func (o *AccountNoteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account note unauthorized response +func (o *AccountNoteUnauthorized) Code() int { + return 401 +} + +func (o *AccountNoteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteUnauthorized", 401) +} + +func (o *AccountNoteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteUnauthorized", 401) +} + +func (o *AccountNoteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteNotFound creates a AccountNoteNotFound with default headers values +func NewAccountNoteNotFound() *AccountNoteNotFound { + return &AccountNoteNotFound{} +} + +/* +AccountNoteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountNoteNotFound struct { +} + +// IsSuccess returns true when this account note not found response has a 2xx status code +func (o *AccountNoteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note not found response has a 3xx status code +func (o *AccountNoteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note not found response has a 4xx status code +func (o *AccountNoteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note not found response has a 5xx status code +func (o *AccountNoteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account note not found response a status code equal to that given +func (o *AccountNoteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account note not found response +func (o *AccountNoteNotFound) Code() int { + return 404 +} + +func (o *AccountNoteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotFound", 404) +} + +func (o *AccountNoteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotFound", 404) +} + +func (o *AccountNoteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteNotAcceptable creates a AccountNoteNotAcceptable with default headers values +func NewAccountNoteNotAcceptable() *AccountNoteNotAcceptable { + return &AccountNoteNotAcceptable{} +} + +/* +AccountNoteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountNoteNotAcceptable struct { +} + +// IsSuccess returns true when this account note not acceptable response has a 2xx status code +func (o *AccountNoteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note not acceptable response has a 3xx status code +func (o *AccountNoteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note not acceptable response has a 4xx status code +func (o *AccountNoteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account note not acceptable response has a 5xx status code +func (o *AccountNoteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account note not acceptable response a status code equal to that given +func (o *AccountNoteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account note not acceptable response +func (o *AccountNoteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountNoteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotAcceptable", 406) +} + +func (o *AccountNoteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteNotAcceptable", 406) +} + +func (o *AccountNoteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountNoteInternalServerError creates a AccountNoteInternalServerError with default headers values +func NewAccountNoteInternalServerError() *AccountNoteInternalServerError { + return &AccountNoteInternalServerError{} +} + +/* +AccountNoteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountNoteInternalServerError struct { +} + +// IsSuccess returns true when this account note internal server error response has a 2xx status code +func (o *AccountNoteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account note internal server error response has a 3xx status code +func (o *AccountNoteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account note internal server error response has a 4xx status code +func (o *AccountNoteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account note internal server error response has a 5xx status code +func (o *AccountNoteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account note internal server error response a status code equal to that given +func (o *AccountNoteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account note internal server error response +func (o *AccountNoteInternalServerError) Code() int { + return 500 +} + +func (o *AccountNoteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteInternalServerError", 500) +} + +func (o *AccountNoteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/note][%d] accountNoteInternalServerError", 500) +} + +func (o *AccountNoteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_relationships_parameters.go b/client/accounts/account_relationships_parameters.go new file mode 100644 index 0000000..af44769 --- /dev/null +++ b/client/accounts/account_relationships_parameters.go @@ -0,0 +1,175 @@ +// 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" +) + +// NewAccountRelationshipsParams creates a new AccountRelationshipsParams 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 NewAccountRelationshipsParams() *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountRelationshipsParamsWithTimeout creates a new AccountRelationshipsParams object +// with the ability to set a timeout on a request. +func NewAccountRelationshipsParamsWithTimeout(timeout time.Duration) *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + timeout: timeout, + } +} + +// NewAccountRelationshipsParamsWithContext creates a new AccountRelationshipsParams object +// with the ability to set a context for a request. +func NewAccountRelationshipsParamsWithContext(ctx context.Context) *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + Context: ctx, + } +} + +// NewAccountRelationshipsParamsWithHTTPClient creates a new AccountRelationshipsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountRelationshipsParamsWithHTTPClient(client *http.Client) *AccountRelationshipsParams { + return &AccountRelationshipsParams{ + HTTPClient: client, + } +} + +/* +AccountRelationshipsParams contains all the parameters to send to the API endpoint + + for the account relationships operation. + + Typically these are written to a http.Request. +*/ +type AccountRelationshipsParams struct { + + /* ID. + + Account IDs. + */ + ID []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountRelationshipsParams) WithDefaults() *AccountRelationshipsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account relationships params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountRelationshipsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account relationships params +func (o *AccountRelationshipsParams) WithTimeout(timeout time.Duration) *AccountRelationshipsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account relationships params +func (o *AccountRelationshipsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account relationships params +func (o *AccountRelationshipsParams) WithContext(ctx context.Context) *AccountRelationshipsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account relationships params +func (o *AccountRelationshipsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account relationships params +func (o *AccountRelationshipsParams) WithHTTPClient(client *http.Client) *AccountRelationshipsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account relationships params +func (o *AccountRelationshipsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account relationships params +func (o *AccountRelationshipsParams) WithID(id []string) *AccountRelationshipsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account relationships params +func (o *AccountRelationshipsParams) SetID(id []string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountRelationshipsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ID != nil { + + // binding items for id[] + joinedID := o.bindParamID(reg) + + // query array param id[] + if err := r.SetQueryParam("id[]", joinedID...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamAccountRelationships binds the parameter id[] +func (o *AccountRelationshipsParams) bindParamID(formats strfmt.Registry) []string { + iDIR := o.ID + + var iDIC []string + for _, iDIIR := range iDIR { // explode []string + + iDIIV := iDIIR // string as string + iDIC = append(iDIC, iDIIV) + } + + // items.CollectionFormat: "multi" + iDIS := swag.JoinByFormat(iDIC, "multi") + + return iDIS +} diff --git a/client/accounts/account_relationships_responses.go b/client/accounts/account_relationships_responses.go new file mode 100644 index 0000000..481c53e --- /dev/null +++ b/client/accounts/account_relationships_responses.go @@ -0,0 +1,414 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountRelationshipsReader is a Reader for the AccountRelationships structure. +type AccountRelationshipsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountRelationshipsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountRelationshipsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountRelationshipsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountRelationshipsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountRelationshipsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountRelationshipsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountRelationshipsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/relationships] accountRelationships", response, response.Code()) + } +} + +// NewAccountRelationshipsOK creates a AccountRelationshipsOK with default headers values +func NewAccountRelationshipsOK() *AccountRelationshipsOK { + return &AccountRelationshipsOK{} +} + +/* +AccountRelationshipsOK describes a response with status code 200, with default header values. + +Array of account relationships. +*/ +type AccountRelationshipsOK struct { + Payload []*models.Relationship +} + +// IsSuccess returns true when this account relationships o k response has a 2xx status code +func (o *AccountRelationshipsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account relationships o k response has a 3xx status code +func (o *AccountRelationshipsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships o k response has a 4xx status code +func (o *AccountRelationshipsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account relationships o k response has a 5xx status code +func (o *AccountRelationshipsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships o k response a status code equal to that given +func (o *AccountRelationshipsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account relationships o k response +func (o *AccountRelationshipsOK) Code() int { + return 200 +} + +func (o *AccountRelationshipsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsOK %s", 200, payload) +} + +func (o *AccountRelationshipsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsOK %s", 200, payload) +} + +func (o *AccountRelationshipsOK) GetPayload() []*models.Relationship { + return o.Payload +} + +func (o *AccountRelationshipsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountRelationshipsBadRequest creates a AccountRelationshipsBadRequest with default headers values +func NewAccountRelationshipsBadRequest() *AccountRelationshipsBadRequest { + return &AccountRelationshipsBadRequest{} +} + +/* +AccountRelationshipsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountRelationshipsBadRequest struct { +} + +// IsSuccess returns true when this account relationships bad request response has a 2xx status code +func (o *AccountRelationshipsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships bad request response has a 3xx status code +func (o *AccountRelationshipsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships bad request response has a 4xx status code +func (o *AccountRelationshipsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships bad request response has a 5xx status code +func (o *AccountRelationshipsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships bad request response a status code equal to that given +func (o *AccountRelationshipsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account relationships bad request response +func (o *AccountRelationshipsBadRequest) Code() int { + return 400 +} + +func (o *AccountRelationshipsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsBadRequest", 400) +} + +func (o *AccountRelationshipsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsBadRequest", 400) +} + +func (o *AccountRelationshipsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsUnauthorized creates a AccountRelationshipsUnauthorized with default headers values +func NewAccountRelationshipsUnauthorized() *AccountRelationshipsUnauthorized { + return &AccountRelationshipsUnauthorized{} +} + +/* +AccountRelationshipsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountRelationshipsUnauthorized struct { +} + +// IsSuccess returns true when this account relationships unauthorized response has a 2xx status code +func (o *AccountRelationshipsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships unauthorized response has a 3xx status code +func (o *AccountRelationshipsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships unauthorized response has a 4xx status code +func (o *AccountRelationshipsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships unauthorized response has a 5xx status code +func (o *AccountRelationshipsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships unauthorized response a status code equal to that given +func (o *AccountRelationshipsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account relationships unauthorized response +func (o *AccountRelationshipsUnauthorized) Code() int { + return 401 +} + +func (o *AccountRelationshipsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsUnauthorized", 401) +} + +func (o *AccountRelationshipsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsUnauthorized", 401) +} + +func (o *AccountRelationshipsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsNotFound creates a AccountRelationshipsNotFound with default headers values +func NewAccountRelationshipsNotFound() *AccountRelationshipsNotFound { + return &AccountRelationshipsNotFound{} +} + +/* +AccountRelationshipsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountRelationshipsNotFound struct { +} + +// IsSuccess returns true when this account relationships not found response has a 2xx status code +func (o *AccountRelationshipsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships not found response has a 3xx status code +func (o *AccountRelationshipsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships not found response has a 4xx status code +func (o *AccountRelationshipsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships not found response has a 5xx status code +func (o *AccountRelationshipsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships not found response a status code equal to that given +func (o *AccountRelationshipsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account relationships not found response +func (o *AccountRelationshipsNotFound) Code() int { + return 404 +} + +func (o *AccountRelationshipsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotFound", 404) +} + +func (o *AccountRelationshipsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotFound", 404) +} + +func (o *AccountRelationshipsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsNotAcceptable creates a AccountRelationshipsNotAcceptable with default headers values +func NewAccountRelationshipsNotAcceptable() *AccountRelationshipsNotAcceptable { + return &AccountRelationshipsNotAcceptable{} +} + +/* +AccountRelationshipsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountRelationshipsNotAcceptable struct { +} + +// IsSuccess returns true when this account relationships not acceptable response has a 2xx status code +func (o *AccountRelationshipsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships not acceptable response has a 3xx status code +func (o *AccountRelationshipsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships not acceptable response has a 4xx status code +func (o *AccountRelationshipsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account relationships not acceptable response has a 5xx status code +func (o *AccountRelationshipsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account relationships not acceptable response a status code equal to that given +func (o *AccountRelationshipsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account relationships not acceptable response +func (o *AccountRelationshipsNotAcceptable) Code() int { + return 406 +} + +func (o *AccountRelationshipsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotAcceptable", 406) +} + +func (o *AccountRelationshipsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsNotAcceptable", 406) +} + +func (o *AccountRelationshipsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountRelationshipsInternalServerError creates a AccountRelationshipsInternalServerError with default headers values +func NewAccountRelationshipsInternalServerError() *AccountRelationshipsInternalServerError { + return &AccountRelationshipsInternalServerError{} +} + +/* +AccountRelationshipsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountRelationshipsInternalServerError struct { +} + +// IsSuccess returns true when this account relationships internal server error response has a 2xx status code +func (o *AccountRelationshipsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account relationships internal server error response has a 3xx status code +func (o *AccountRelationshipsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account relationships internal server error response has a 4xx status code +func (o *AccountRelationshipsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account relationships internal server error response has a 5xx status code +func (o *AccountRelationshipsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account relationships internal server error response a status code equal to that given +func (o *AccountRelationshipsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account relationships internal server error response +func (o *AccountRelationshipsInternalServerError) Code() int { + return 500 +} + +func (o *AccountRelationshipsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsInternalServerError", 500) +} + +func (o *AccountRelationshipsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/relationships][%d] accountRelationshipsInternalServerError", 500) +} + +func (o *AccountRelationshipsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_search_get_parameters.go b/client/accounts/account_search_get_parameters.go new file mode 100644 index 0000000..7f5ab6c --- /dev/null +++ b/client/accounts/account_search_get_parameters.go @@ -0,0 +1,318 @@ +// 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" +) + +// NewAccountSearchGetParams creates a new AccountSearchGetParams 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 NewAccountSearchGetParams() *AccountSearchGetParams { + return &AccountSearchGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountSearchGetParamsWithTimeout creates a new AccountSearchGetParams object +// with the ability to set a timeout on a request. +func NewAccountSearchGetParamsWithTimeout(timeout time.Duration) *AccountSearchGetParams { + return &AccountSearchGetParams{ + timeout: timeout, + } +} + +// NewAccountSearchGetParamsWithContext creates a new AccountSearchGetParams object +// with the ability to set a context for a request. +func NewAccountSearchGetParamsWithContext(ctx context.Context) *AccountSearchGetParams { + return &AccountSearchGetParams{ + Context: ctx, + } +} + +// NewAccountSearchGetParamsWithHTTPClient creates a new AccountSearchGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountSearchGetParamsWithHTTPClient(client *http.Client) *AccountSearchGetParams { + return &AccountSearchGetParams{ + HTTPClient: client, + } +} + +/* +AccountSearchGetParams contains all the parameters to send to the API endpoint + + for the account search get operation. + + Typically these are written to a http.Request. +*/ +type AccountSearchGetParams struct { + + /* Following. + + Show only accounts that the requesting account follows. If this is set to `true`, then the GoToSocial instance will enhance the search by also searching within account notes, not just in usernames and display names. + */ + Following *bool + + /* Limit. + + Number of results to try to return. + + Default: 40 + */ + Limit *int64 + + /* Offset. + + Page number of results to return (starts at 0). This parameter is currently not used, offsets over 0 will always return 0 results. + */ + Offset *int64 + + /* Q. + + Query string to search for. This can be in the following forms: + - `@[username]` -- search for an account with the given username on any domain. Can return multiple results. + - `@[username]@[domain]` -- search for a remote account with exact username and domain. Will only ever return 1 result at most. + - any arbitrary string -- search for accounts containing the given string in their username or display name. Can return multiple results. + */ + Q string + + /* Resolve. + + If query is for `@[username]@[domain]`, or a URL, allow the GoToSocial instance to resolve the search by making calls to remote instances (webfinger, ActivityPub, etc). + */ + Resolve *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountSearchGetParams) WithDefaults() *AccountSearchGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountSearchGetParams) SetDefaults() { + var ( + followingDefault = bool(false) + + limitDefault = int64(40) + + offsetDefault = int64(0) + + resolveDefault = bool(false) + ) + + val := AccountSearchGetParams{ + Following: &followingDefault, + Limit: &limitDefault, + Offset: &offsetDefault, + Resolve: &resolveDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account search get params +func (o *AccountSearchGetParams) WithTimeout(timeout time.Duration) *AccountSearchGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account search get params +func (o *AccountSearchGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account search get params +func (o *AccountSearchGetParams) WithContext(ctx context.Context) *AccountSearchGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account search get params +func (o *AccountSearchGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account search get params +func (o *AccountSearchGetParams) WithHTTPClient(client *http.Client) *AccountSearchGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account search get params +func (o *AccountSearchGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFollowing adds the following to the account search get params +func (o *AccountSearchGetParams) WithFollowing(following *bool) *AccountSearchGetParams { + o.SetFollowing(following) + return o +} + +// SetFollowing adds the following to the account search get params +func (o *AccountSearchGetParams) SetFollowing(following *bool) { + o.Following = following +} + +// WithLimit adds the limit to the account search get params +func (o *AccountSearchGetParams) WithLimit(limit *int64) *AccountSearchGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account search get params +func (o *AccountSearchGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithOffset adds the offset to the account search get params +func (o *AccountSearchGetParams) WithOffset(offset *int64) *AccountSearchGetParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the account search get params +func (o *AccountSearchGetParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithQ adds the q to the account search get params +func (o *AccountSearchGetParams) WithQ(q string) *AccountSearchGetParams { + o.SetQ(q) + return o +} + +// SetQ adds the q to the account search get params +func (o *AccountSearchGetParams) SetQ(q string) { + o.Q = q +} + +// WithResolve adds the resolve to the account search get params +func (o *AccountSearchGetParams) WithResolve(resolve *bool) *AccountSearchGetParams { + o.SetResolve(resolve) + return o +} + +// SetResolve adds the resolve to the account search get params +func (o *AccountSearchGetParams) SetResolve(resolve *bool) { + o.Resolve = resolve +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountSearchGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Following != nil { + + // query param following + var qrFollowing bool + + if o.Following != nil { + qrFollowing = *o.Following + } + qFollowing := swag.FormatBool(qrFollowing) + if qFollowing != "" { + + if err := r.SetQueryParam("following", qFollowing); err != nil { + return err + } + } + } + + 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.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + // query param q + qrQ := o.Q + qQ := qrQ + if qQ != "" { + + if err := r.SetQueryParam("q", qQ); err != nil { + return err + } + } + + if o.Resolve != nil { + + // query param resolve + var qrResolve bool + + if o.Resolve != nil { + qrResolve = *o.Resolve + } + qResolve := swag.FormatBool(qrResolve) + if qResolve != "" { + + if err := r.SetQueryParam("resolve", qResolve); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_search_get_responses.go b/client/accounts/account_search_get_responses.go new file mode 100644 index 0000000..1d65bd8 --- /dev/null +++ b/client/accounts/account_search_get_responses.go @@ -0,0 +1,414 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountSearchGetReader is a Reader for the AccountSearchGet structure. +type AccountSearchGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountSearchGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountSearchGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountSearchGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountSearchGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountSearchGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountSearchGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountSearchGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/search] accountSearchGet", response, response.Code()) + } +} + +// NewAccountSearchGetOK creates a AccountSearchGetOK with default headers values +func NewAccountSearchGetOK() *AccountSearchGetOK { + return &AccountSearchGetOK{} +} + +/* +AccountSearchGetOK describes a response with status code 200, with default header values. + +Results of the search. +*/ +type AccountSearchGetOK struct { + Payload []*models.Account +} + +// IsSuccess returns true when this account search get o k response has a 2xx status code +func (o *AccountSearchGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account search get o k response has a 3xx status code +func (o *AccountSearchGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get o k response has a 4xx status code +func (o *AccountSearchGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account search get o k response has a 5xx status code +func (o *AccountSearchGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get o k response a status code equal to that given +func (o *AccountSearchGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account search get o k response +func (o *AccountSearchGetOK) Code() int { + return 200 +} + +func (o *AccountSearchGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetOK %s", 200, payload) +} + +func (o *AccountSearchGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetOK %s", 200, payload) +} + +func (o *AccountSearchGetOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *AccountSearchGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountSearchGetBadRequest creates a AccountSearchGetBadRequest with default headers values +func NewAccountSearchGetBadRequest() *AccountSearchGetBadRequest { + return &AccountSearchGetBadRequest{} +} + +/* +AccountSearchGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountSearchGetBadRequest struct { +} + +// IsSuccess returns true when this account search get bad request response has a 2xx status code +func (o *AccountSearchGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get bad request response has a 3xx status code +func (o *AccountSearchGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get bad request response has a 4xx status code +func (o *AccountSearchGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get bad request response has a 5xx status code +func (o *AccountSearchGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get bad request response a status code equal to that given +func (o *AccountSearchGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account search get bad request response +func (o *AccountSearchGetBadRequest) Code() int { + return 400 +} + +func (o *AccountSearchGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetBadRequest", 400) +} + +func (o *AccountSearchGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetBadRequest", 400) +} + +func (o *AccountSearchGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetUnauthorized creates a AccountSearchGetUnauthorized with default headers values +func NewAccountSearchGetUnauthorized() *AccountSearchGetUnauthorized { + return &AccountSearchGetUnauthorized{} +} + +/* +AccountSearchGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountSearchGetUnauthorized struct { +} + +// IsSuccess returns true when this account search get unauthorized response has a 2xx status code +func (o *AccountSearchGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get unauthorized response has a 3xx status code +func (o *AccountSearchGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get unauthorized response has a 4xx status code +func (o *AccountSearchGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get unauthorized response has a 5xx status code +func (o *AccountSearchGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get unauthorized response a status code equal to that given +func (o *AccountSearchGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account search get unauthorized response +func (o *AccountSearchGetUnauthorized) Code() int { + return 401 +} + +func (o *AccountSearchGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetUnauthorized", 401) +} + +func (o *AccountSearchGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetUnauthorized", 401) +} + +func (o *AccountSearchGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetNotFound creates a AccountSearchGetNotFound with default headers values +func NewAccountSearchGetNotFound() *AccountSearchGetNotFound { + return &AccountSearchGetNotFound{} +} + +/* +AccountSearchGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountSearchGetNotFound struct { +} + +// IsSuccess returns true when this account search get not found response has a 2xx status code +func (o *AccountSearchGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get not found response has a 3xx status code +func (o *AccountSearchGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get not found response has a 4xx status code +func (o *AccountSearchGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get not found response has a 5xx status code +func (o *AccountSearchGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get not found response a status code equal to that given +func (o *AccountSearchGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account search get not found response +func (o *AccountSearchGetNotFound) Code() int { + return 404 +} + +func (o *AccountSearchGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotFound", 404) +} + +func (o *AccountSearchGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotFound", 404) +} + +func (o *AccountSearchGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetNotAcceptable creates a AccountSearchGetNotAcceptable with default headers values +func NewAccountSearchGetNotAcceptable() *AccountSearchGetNotAcceptable { + return &AccountSearchGetNotAcceptable{} +} + +/* +AccountSearchGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountSearchGetNotAcceptable struct { +} + +// IsSuccess returns true when this account search get not acceptable response has a 2xx status code +func (o *AccountSearchGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get not acceptable response has a 3xx status code +func (o *AccountSearchGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get not acceptable response has a 4xx status code +func (o *AccountSearchGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account search get not acceptable response has a 5xx status code +func (o *AccountSearchGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account search get not acceptable response a status code equal to that given +func (o *AccountSearchGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account search get not acceptable response +func (o *AccountSearchGetNotAcceptable) Code() int { + return 406 +} + +func (o *AccountSearchGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotAcceptable", 406) +} + +func (o *AccountSearchGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetNotAcceptable", 406) +} + +func (o *AccountSearchGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountSearchGetInternalServerError creates a AccountSearchGetInternalServerError with default headers values +func NewAccountSearchGetInternalServerError() *AccountSearchGetInternalServerError { + return &AccountSearchGetInternalServerError{} +} + +/* +AccountSearchGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountSearchGetInternalServerError struct { +} + +// IsSuccess returns true when this account search get internal server error response has a 2xx status code +func (o *AccountSearchGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account search get internal server error response has a 3xx status code +func (o *AccountSearchGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account search get internal server error response has a 4xx status code +func (o *AccountSearchGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account search get internal server error response has a 5xx status code +func (o *AccountSearchGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account search get internal server error response a status code equal to that given +func (o *AccountSearchGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account search get internal server error response +func (o *AccountSearchGetInternalServerError) Code() int { + return 500 +} + +func (o *AccountSearchGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetInternalServerError", 500) +} + +func (o *AccountSearchGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/search][%d] accountSearchGetInternalServerError", 500) +} + +func (o *AccountSearchGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_statuses_parameters.go b/client/accounts/account_statuses_parameters.go new file mode 100644 index 0000000..dd8920a --- /dev/null +++ b/client/accounts/account_statuses_parameters.go @@ -0,0 +1,452 @@ +// 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" +) + +// NewAccountStatusesParams creates a new AccountStatusesParams 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 NewAccountStatusesParams() *AccountStatusesParams { + return &AccountStatusesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountStatusesParamsWithTimeout creates a new AccountStatusesParams object +// with the ability to set a timeout on a request. +func NewAccountStatusesParamsWithTimeout(timeout time.Duration) *AccountStatusesParams { + return &AccountStatusesParams{ + timeout: timeout, + } +} + +// NewAccountStatusesParamsWithContext creates a new AccountStatusesParams object +// with the ability to set a context for a request. +func NewAccountStatusesParamsWithContext(ctx context.Context) *AccountStatusesParams { + return &AccountStatusesParams{ + Context: ctx, + } +} + +// NewAccountStatusesParamsWithHTTPClient creates a new AccountStatusesParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountStatusesParamsWithHTTPClient(client *http.Client) *AccountStatusesParams { + return &AccountStatusesParams{ + HTTPClient: client, + } +} + +/* +AccountStatusesParams contains all the parameters to send to the API endpoint + + for the account statuses operation. + + Typically these are written to a http.Request. +*/ +type AccountStatusesParams struct { + + /* ExcludeReblogs. + + Exclude statuses that are a reblog/boost of another status. + */ + ExcludeReblogs *bool + + /* ExcludeReplies. + + Exclude statuses that are a reply to another status. + */ + ExcludeReplies *bool + + /* ID. + + Account ID. + */ + ID string + + /* Limit. + + Number of statuses to return. + + Default: 30 + */ + Limit *int64 + + /* 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 *NEWER* than the given min status ID. The status with the specified ID will not be included in the response. + */ + MinID *string + + /* OnlyMedia. + + Show only statuses with media attachments. + */ + OnlyMedia *bool + + /* OnlyPublic. + + Show only statuses with a privacy setting of 'public'. + */ + OnlyPublic *bool + + /* Pinned. + + Show only pinned statuses. In other words, exclude statuses that are not pinned to the given account ID. + */ + Pinned *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account statuses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountStatusesParams) WithDefaults() *AccountStatusesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account statuses params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountStatusesParams) SetDefaults() { + var ( + excludeReblogsDefault = bool(false) + + excludeRepliesDefault = bool(false) + + limitDefault = int64(30) + + onlyMediaDefault = bool(false) + + onlyPublicDefault = bool(false) + + pinnedDefault = bool(false) + ) + + val := AccountStatusesParams{ + ExcludeReblogs: &excludeReblogsDefault, + ExcludeReplies: &excludeRepliesDefault, + Limit: &limitDefault, + OnlyMedia: &onlyMediaDefault, + OnlyPublic: &onlyPublicDefault, + Pinned: &pinnedDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the account statuses params +func (o *AccountStatusesParams) WithTimeout(timeout time.Duration) *AccountStatusesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account statuses params +func (o *AccountStatusesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account statuses params +func (o *AccountStatusesParams) WithContext(ctx context.Context) *AccountStatusesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account statuses params +func (o *AccountStatusesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account statuses params +func (o *AccountStatusesParams) WithHTTPClient(client *http.Client) *AccountStatusesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account statuses params +func (o *AccountStatusesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExcludeReblogs adds the excludeReblogs to the account statuses params +func (o *AccountStatusesParams) WithExcludeReblogs(excludeReblogs *bool) *AccountStatusesParams { + o.SetExcludeReblogs(excludeReblogs) + return o +} + +// SetExcludeReblogs adds the excludeReblogs to the account statuses params +func (o *AccountStatusesParams) SetExcludeReblogs(excludeReblogs *bool) { + o.ExcludeReblogs = excludeReblogs +} + +// WithExcludeReplies adds the excludeReplies to the account statuses params +func (o *AccountStatusesParams) WithExcludeReplies(excludeReplies *bool) *AccountStatusesParams { + o.SetExcludeReplies(excludeReplies) + return o +} + +// SetExcludeReplies adds the excludeReplies to the account statuses params +func (o *AccountStatusesParams) SetExcludeReplies(excludeReplies *bool) { + o.ExcludeReplies = excludeReplies +} + +// WithID adds the id to the account statuses params +func (o *AccountStatusesParams) WithID(id string) *AccountStatusesParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account statuses params +func (o *AccountStatusesParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the account statuses params +func (o *AccountStatusesParams) WithLimit(limit *int64) *AccountStatusesParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the account statuses params +func (o *AccountStatusesParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the account statuses params +func (o *AccountStatusesParams) WithMaxID(maxID *string) *AccountStatusesParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the account statuses params +func (o *AccountStatusesParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the account statuses params +func (o *AccountStatusesParams) WithMinID(minID *string) *AccountStatusesParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the account statuses params +func (o *AccountStatusesParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOnlyMedia adds the onlyMedia to the account statuses params +func (o *AccountStatusesParams) WithOnlyMedia(onlyMedia *bool) *AccountStatusesParams { + o.SetOnlyMedia(onlyMedia) + return o +} + +// SetOnlyMedia adds the onlyMedia to the account statuses params +func (o *AccountStatusesParams) SetOnlyMedia(onlyMedia *bool) { + o.OnlyMedia = onlyMedia +} + +// WithOnlyPublic adds the onlyPublic to the account statuses params +func (o *AccountStatusesParams) WithOnlyPublic(onlyPublic *bool) *AccountStatusesParams { + o.SetOnlyPublic(onlyPublic) + return o +} + +// SetOnlyPublic adds the onlyPublic to the account statuses params +func (o *AccountStatusesParams) SetOnlyPublic(onlyPublic *bool) { + o.OnlyPublic = onlyPublic +} + +// WithPinned adds the pinned to the account statuses params +func (o *AccountStatusesParams) WithPinned(pinned *bool) *AccountStatusesParams { + o.SetPinned(pinned) + return o +} + +// SetPinned adds the pinned to the account statuses params +func (o *AccountStatusesParams) SetPinned(pinned *bool) { + o.Pinned = pinned +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountStatusesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ExcludeReblogs != nil { + + // query param exclude_reblogs + var qrExcludeReblogs bool + + if o.ExcludeReblogs != nil { + qrExcludeReblogs = *o.ExcludeReblogs + } + qExcludeReblogs := swag.FormatBool(qrExcludeReblogs) + if qExcludeReblogs != "" { + + if err := r.SetQueryParam("exclude_reblogs", qExcludeReblogs); err != nil { + return err + } + } + } + + if o.ExcludeReplies != nil { + + // query param exclude_replies + var qrExcludeReplies bool + + if o.ExcludeReplies != nil { + qrExcludeReplies = *o.ExcludeReplies + } + qExcludeReplies := swag.FormatBool(qrExcludeReplies) + if qExcludeReplies != "" { + + if err := r.SetQueryParam("exclude_replies", qExcludeReplies); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + 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.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.OnlyMedia != nil { + + // query param only_media + var qrOnlyMedia bool + + if o.OnlyMedia != nil { + qrOnlyMedia = *o.OnlyMedia + } + qOnlyMedia := swag.FormatBool(qrOnlyMedia) + if qOnlyMedia != "" { + + if err := r.SetQueryParam("only_media", qOnlyMedia); err != nil { + return err + } + } + } + + if o.OnlyPublic != nil { + + // query param only_public + var qrOnlyPublic bool + + if o.OnlyPublic != nil { + qrOnlyPublic = *o.OnlyPublic + } + qOnlyPublic := swag.FormatBool(qrOnlyPublic) + if qOnlyPublic != "" { + + if err := r.SetQueryParam("only_public", qOnlyPublic); err != nil { + return err + } + } + } + + if o.Pinned != nil { + + // query param pinned + var qrPinned bool + + if o.Pinned != nil { + qrPinned = *o.Pinned + } + qPinned := swag.FormatBool(qrPinned) + if qPinned != "" { + + if err := r.SetQueryParam("pinned", qPinned); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_statuses_responses.go b/client/accounts/account_statuses_responses.go new file mode 100644 index 0000000..90e98c2 --- /dev/null +++ b/client/accounts/account_statuses_responses.go @@ -0,0 +1,426 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountStatusesReader is a Reader for the AccountStatuses structure. +type AccountStatusesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountStatusesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountStatusesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountStatusesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountStatusesUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountStatusesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountStatusesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountStatusesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/{id}/statuses] accountStatuses", response, response.Code()) + } +} + +// NewAccountStatusesOK creates a AccountStatusesOK with default headers values +func NewAccountStatusesOK() *AccountStatusesOK { + return &AccountStatusesOK{} +} + +/* +AccountStatusesOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type AccountStatusesOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this account statuses o k response has a 2xx status code +func (o *AccountStatusesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account statuses o k response has a 3xx status code +func (o *AccountStatusesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses o k response has a 4xx status code +func (o *AccountStatusesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account statuses o k response has a 5xx status code +func (o *AccountStatusesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses o k response a status code equal to that given +func (o *AccountStatusesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account statuses o k response +func (o *AccountStatusesOK) Code() int { + return 200 +} + +func (o *AccountStatusesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesOK %s", 200, payload) +} + +func (o *AccountStatusesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesOK %s", 200, payload) +} + +func (o *AccountStatusesOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *AccountStatusesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountStatusesBadRequest creates a AccountStatusesBadRequest with default headers values +func NewAccountStatusesBadRequest() *AccountStatusesBadRequest { + return &AccountStatusesBadRequest{} +} + +/* +AccountStatusesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountStatusesBadRequest struct { +} + +// IsSuccess returns true when this account statuses bad request response has a 2xx status code +func (o *AccountStatusesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses bad request response has a 3xx status code +func (o *AccountStatusesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses bad request response has a 4xx status code +func (o *AccountStatusesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses bad request response has a 5xx status code +func (o *AccountStatusesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses bad request response a status code equal to that given +func (o *AccountStatusesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account statuses bad request response +func (o *AccountStatusesBadRequest) Code() int { + return 400 +} + +func (o *AccountStatusesBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesBadRequest", 400) +} + +func (o *AccountStatusesBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesBadRequest", 400) +} + +func (o *AccountStatusesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesUnauthorized creates a AccountStatusesUnauthorized with default headers values +func NewAccountStatusesUnauthorized() *AccountStatusesUnauthorized { + return &AccountStatusesUnauthorized{} +} + +/* +AccountStatusesUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountStatusesUnauthorized struct { +} + +// IsSuccess returns true when this account statuses unauthorized response has a 2xx status code +func (o *AccountStatusesUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses unauthorized response has a 3xx status code +func (o *AccountStatusesUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses unauthorized response has a 4xx status code +func (o *AccountStatusesUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses unauthorized response has a 5xx status code +func (o *AccountStatusesUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses unauthorized response a status code equal to that given +func (o *AccountStatusesUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account statuses unauthorized response +func (o *AccountStatusesUnauthorized) Code() int { + return 401 +} + +func (o *AccountStatusesUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesUnauthorized", 401) +} + +func (o *AccountStatusesUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesUnauthorized", 401) +} + +func (o *AccountStatusesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesNotFound creates a AccountStatusesNotFound with default headers values +func NewAccountStatusesNotFound() *AccountStatusesNotFound { + return &AccountStatusesNotFound{} +} + +/* +AccountStatusesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountStatusesNotFound struct { +} + +// IsSuccess returns true when this account statuses not found response has a 2xx status code +func (o *AccountStatusesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses not found response has a 3xx status code +func (o *AccountStatusesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses not found response has a 4xx status code +func (o *AccountStatusesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses not found response has a 5xx status code +func (o *AccountStatusesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses not found response a status code equal to that given +func (o *AccountStatusesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account statuses not found response +func (o *AccountStatusesNotFound) Code() int { + return 404 +} + +func (o *AccountStatusesNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotFound", 404) +} + +func (o *AccountStatusesNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotFound", 404) +} + +func (o *AccountStatusesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesNotAcceptable creates a AccountStatusesNotAcceptable with default headers values +func NewAccountStatusesNotAcceptable() *AccountStatusesNotAcceptable { + return &AccountStatusesNotAcceptable{} +} + +/* +AccountStatusesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountStatusesNotAcceptable struct { +} + +// IsSuccess returns true when this account statuses not acceptable response has a 2xx status code +func (o *AccountStatusesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses not acceptable response has a 3xx status code +func (o *AccountStatusesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses not acceptable response has a 4xx status code +func (o *AccountStatusesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account statuses not acceptable response has a 5xx status code +func (o *AccountStatusesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account statuses not acceptable response a status code equal to that given +func (o *AccountStatusesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account statuses not acceptable response +func (o *AccountStatusesNotAcceptable) Code() int { + return 406 +} + +func (o *AccountStatusesNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotAcceptable", 406) +} + +func (o *AccountStatusesNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesNotAcceptable", 406) +} + +func (o *AccountStatusesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountStatusesInternalServerError creates a AccountStatusesInternalServerError with default headers values +func NewAccountStatusesInternalServerError() *AccountStatusesInternalServerError { + return &AccountStatusesInternalServerError{} +} + +/* +AccountStatusesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountStatusesInternalServerError struct { +} + +// IsSuccess returns true when this account statuses internal server error response has a 2xx status code +func (o *AccountStatusesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account statuses internal server error response has a 3xx status code +func (o *AccountStatusesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account statuses internal server error response has a 4xx status code +func (o *AccountStatusesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account statuses internal server error response has a 5xx status code +func (o *AccountStatusesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account statuses internal server error response a status code equal to that given +func (o *AccountStatusesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account statuses internal server error response +func (o *AccountStatusesInternalServerError) Code() int { + return 500 +} + +func (o *AccountStatusesInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesInternalServerError", 500) +} + +func (o *AccountStatusesInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/{id}/statuses][%d] accountStatusesInternalServerError", 500) +} + +func (o *AccountStatusesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_themes_parameters.go b/client/accounts/account_themes_parameters.go new file mode 100644 index 0000000..cc79bd1 --- /dev/null +++ b/client/accounts/account_themes_parameters.go @@ -0,0 +1,128 @@ +// 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" +) + +// NewAccountThemesParams creates a new AccountThemesParams 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 NewAccountThemesParams() *AccountThemesParams { + return &AccountThemesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountThemesParamsWithTimeout creates a new AccountThemesParams object +// with the ability to set a timeout on a request. +func NewAccountThemesParamsWithTimeout(timeout time.Duration) *AccountThemesParams { + return &AccountThemesParams{ + timeout: timeout, + } +} + +// NewAccountThemesParamsWithContext creates a new AccountThemesParams object +// with the ability to set a context for a request. +func NewAccountThemesParamsWithContext(ctx context.Context) *AccountThemesParams { + return &AccountThemesParams{ + Context: ctx, + } +} + +// NewAccountThemesParamsWithHTTPClient creates a new AccountThemesParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountThemesParamsWithHTTPClient(client *http.Client) *AccountThemesParams { + return &AccountThemesParams{ + HTTPClient: client, + } +} + +/* +AccountThemesParams contains all the parameters to send to the API endpoint + + for the account themes operation. + + Typically these are written to a http.Request. +*/ +type AccountThemesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account themes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountThemesParams) WithDefaults() *AccountThemesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account themes params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountThemesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account themes params +func (o *AccountThemesParams) WithTimeout(timeout time.Duration) *AccountThemesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account themes params +func (o *AccountThemesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account themes params +func (o *AccountThemesParams) WithContext(ctx context.Context) *AccountThemesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account themes params +func (o *AccountThemesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account themes params +func (o *AccountThemesParams) WithHTTPClient(client *http.Client) *AccountThemesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account themes params +func (o *AccountThemesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountThemesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_themes_responses.go b/client/accounts/account_themes_responses.go new file mode 100644 index 0000000..55620f4 --- /dev/null +++ b/client/accounts/account_themes_responses.go @@ -0,0 +1,414 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountThemesReader is a Reader for the AccountThemes structure. +type AccountThemesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountThemesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountThemesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountThemesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountThemesUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountThemesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountThemesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountThemesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/themes] accountThemes", response, response.Code()) + } +} + +// NewAccountThemesOK creates a AccountThemesOK with default headers values +func NewAccountThemesOK() *AccountThemesOK { + return &AccountThemesOK{} +} + +/* +AccountThemesOK describes a response with status code 200, with default header values. + +Array of themes. +*/ +type AccountThemesOK struct { + Payload []*models.Theme +} + +// IsSuccess returns true when this account themes o k response has a 2xx status code +func (o *AccountThemesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account themes o k response has a 3xx status code +func (o *AccountThemesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes o k response has a 4xx status code +func (o *AccountThemesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account themes o k response has a 5xx status code +func (o *AccountThemesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes o k response a status code equal to that given +func (o *AccountThemesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account themes o k response +func (o *AccountThemesOK) Code() int { + return 200 +} + +func (o *AccountThemesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesOK %s", 200, payload) +} + +func (o *AccountThemesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesOK %s", 200, payload) +} + +func (o *AccountThemesOK) GetPayload() []*models.Theme { + return o.Payload +} + +func (o *AccountThemesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountThemesBadRequest creates a AccountThemesBadRequest with default headers values +func NewAccountThemesBadRequest() *AccountThemesBadRequest { + return &AccountThemesBadRequest{} +} + +/* +AccountThemesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountThemesBadRequest struct { +} + +// IsSuccess returns true when this account themes bad request response has a 2xx status code +func (o *AccountThemesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes bad request response has a 3xx status code +func (o *AccountThemesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes bad request response has a 4xx status code +func (o *AccountThemesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes bad request response has a 5xx status code +func (o *AccountThemesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes bad request response a status code equal to that given +func (o *AccountThemesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account themes bad request response +func (o *AccountThemesBadRequest) Code() int { + return 400 +} + +func (o *AccountThemesBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesBadRequest", 400) +} + +func (o *AccountThemesBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesBadRequest", 400) +} + +func (o *AccountThemesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesUnauthorized creates a AccountThemesUnauthorized with default headers values +func NewAccountThemesUnauthorized() *AccountThemesUnauthorized { + return &AccountThemesUnauthorized{} +} + +/* +AccountThemesUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountThemesUnauthorized struct { +} + +// IsSuccess returns true when this account themes unauthorized response has a 2xx status code +func (o *AccountThemesUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes unauthorized response has a 3xx status code +func (o *AccountThemesUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes unauthorized response has a 4xx status code +func (o *AccountThemesUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes unauthorized response has a 5xx status code +func (o *AccountThemesUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes unauthorized response a status code equal to that given +func (o *AccountThemesUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account themes unauthorized response +func (o *AccountThemesUnauthorized) Code() int { + return 401 +} + +func (o *AccountThemesUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesUnauthorized", 401) +} + +func (o *AccountThemesUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesUnauthorized", 401) +} + +func (o *AccountThemesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesNotFound creates a AccountThemesNotFound with default headers values +func NewAccountThemesNotFound() *AccountThemesNotFound { + return &AccountThemesNotFound{} +} + +/* +AccountThemesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountThemesNotFound struct { +} + +// IsSuccess returns true when this account themes not found response has a 2xx status code +func (o *AccountThemesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes not found response has a 3xx status code +func (o *AccountThemesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes not found response has a 4xx status code +func (o *AccountThemesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes not found response has a 5xx status code +func (o *AccountThemesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes not found response a status code equal to that given +func (o *AccountThemesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account themes not found response +func (o *AccountThemesNotFound) Code() int { + return 404 +} + +func (o *AccountThemesNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotFound", 404) +} + +func (o *AccountThemesNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotFound", 404) +} + +func (o *AccountThemesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesNotAcceptable creates a AccountThemesNotAcceptable with default headers values +func NewAccountThemesNotAcceptable() *AccountThemesNotAcceptable { + return &AccountThemesNotAcceptable{} +} + +/* +AccountThemesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountThemesNotAcceptable struct { +} + +// IsSuccess returns true when this account themes not acceptable response has a 2xx status code +func (o *AccountThemesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes not acceptable response has a 3xx status code +func (o *AccountThemesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes not acceptable response has a 4xx status code +func (o *AccountThemesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account themes not acceptable response has a 5xx status code +func (o *AccountThemesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account themes not acceptable response a status code equal to that given +func (o *AccountThemesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account themes not acceptable response +func (o *AccountThemesNotAcceptable) Code() int { + return 406 +} + +func (o *AccountThemesNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotAcceptable", 406) +} + +func (o *AccountThemesNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesNotAcceptable", 406) +} + +func (o *AccountThemesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountThemesInternalServerError creates a AccountThemesInternalServerError with default headers values +func NewAccountThemesInternalServerError() *AccountThemesInternalServerError { + return &AccountThemesInternalServerError{} +} + +/* +AccountThemesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountThemesInternalServerError struct { +} + +// IsSuccess returns true when this account themes internal server error response has a 2xx status code +func (o *AccountThemesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account themes internal server error response has a 3xx status code +func (o *AccountThemesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account themes internal server error response has a 4xx status code +func (o *AccountThemesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account themes internal server error response has a 5xx status code +func (o *AccountThemesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account themes internal server error response a status code equal to that given +func (o *AccountThemesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account themes internal server error response +func (o *AccountThemesInternalServerError) Code() int { + return 500 +} + +func (o *AccountThemesInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesInternalServerError", 500) +} + +func (o *AccountThemesInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/themes][%d] accountThemesInternalServerError", 500) +} + +func (o *AccountThemesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_unblock_parameters.go b/client/accounts/account_unblock_parameters.go new file mode 100644 index 0000000..379bdf2 --- /dev/null +++ b/client/accounts/account_unblock_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewAccountUnblockParams creates a new AccountUnblockParams 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 NewAccountUnblockParams() *AccountUnblockParams { + return &AccountUnblockParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUnblockParamsWithTimeout creates a new AccountUnblockParams object +// with the ability to set a timeout on a request. +func NewAccountUnblockParamsWithTimeout(timeout time.Duration) *AccountUnblockParams { + return &AccountUnblockParams{ + timeout: timeout, + } +} + +// NewAccountUnblockParamsWithContext creates a new AccountUnblockParams object +// with the ability to set a context for a request. +func NewAccountUnblockParamsWithContext(ctx context.Context) *AccountUnblockParams { + return &AccountUnblockParams{ + Context: ctx, + } +} + +// NewAccountUnblockParamsWithHTTPClient creates a new AccountUnblockParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUnblockParamsWithHTTPClient(client *http.Client) *AccountUnblockParams { + return &AccountUnblockParams{ + HTTPClient: client, + } +} + +/* +AccountUnblockParams contains all the parameters to send to the API endpoint + + for the account unblock operation. + + Typically these are written to a http.Request. +*/ +type AccountUnblockParams struct { + + /* ID. + + The id of the account to unblock. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account unblock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnblockParams) WithDefaults() *AccountUnblockParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account unblock params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnblockParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account unblock params +func (o *AccountUnblockParams) WithTimeout(timeout time.Duration) *AccountUnblockParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account unblock params +func (o *AccountUnblockParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account unblock params +func (o *AccountUnblockParams) WithContext(ctx context.Context) *AccountUnblockParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account unblock params +func (o *AccountUnblockParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account unblock params +func (o *AccountUnblockParams) WithHTTPClient(client *http.Client) *AccountUnblockParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account unblock params +func (o *AccountUnblockParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account unblock params +func (o *AccountUnblockParams) WithID(id string) *AccountUnblockParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account unblock params +func (o *AccountUnblockParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUnblockParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_unblock_responses.go b/client/accounts/account_unblock_responses.go new file mode 100644 index 0000000..bc0f27b --- /dev/null +++ b/client/accounts/account_unblock_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUnblockReader is a Reader for the AccountUnblock structure. +type AccountUnblockReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUnblockReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUnblockOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUnblockBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUnblockUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUnblockNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUnblockNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUnblockInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/unblock] accountUnblock", response, response.Code()) + } +} + +// NewAccountUnblockOK creates a AccountUnblockOK with default headers values +func NewAccountUnblockOK() *AccountUnblockOK { + return &AccountUnblockOK{} +} + +/* +AccountUnblockOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountUnblockOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account unblock o k response has a 2xx status code +func (o *AccountUnblockOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account unblock o k response has a 3xx status code +func (o *AccountUnblockOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock o k response has a 4xx status code +func (o *AccountUnblockOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unblock o k response has a 5xx status code +func (o *AccountUnblockOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock o k response a status code equal to that given +func (o *AccountUnblockOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account unblock o k response +func (o *AccountUnblockOK) Code() int { + return 200 +} + +func (o *AccountUnblockOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockOK %s", 200, payload) +} + +func (o *AccountUnblockOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockOK %s", 200, payload) +} + +func (o *AccountUnblockOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountUnblockOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUnblockBadRequest creates a AccountUnblockBadRequest with default headers values +func NewAccountUnblockBadRequest() *AccountUnblockBadRequest { + return &AccountUnblockBadRequest{} +} + +/* +AccountUnblockBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUnblockBadRequest struct { +} + +// IsSuccess returns true when this account unblock bad request response has a 2xx status code +func (o *AccountUnblockBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock bad request response has a 3xx status code +func (o *AccountUnblockBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock bad request response has a 4xx status code +func (o *AccountUnblockBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock bad request response has a 5xx status code +func (o *AccountUnblockBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock bad request response a status code equal to that given +func (o *AccountUnblockBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account unblock bad request response +func (o *AccountUnblockBadRequest) Code() int { + return 400 +} + +func (o *AccountUnblockBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockBadRequest", 400) +} + +func (o *AccountUnblockBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockBadRequest", 400) +} + +func (o *AccountUnblockBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockUnauthorized creates a AccountUnblockUnauthorized with default headers values +func NewAccountUnblockUnauthorized() *AccountUnblockUnauthorized { + return &AccountUnblockUnauthorized{} +} + +/* +AccountUnblockUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUnblockUnauthorized struct { +} + +// IsSuccess returns true when this account unblock unauthorized response has a 2xx status code +func (o *AccountUnblockUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock unauthorized response has a 3xx status code +func (o *AccountUnblockUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock unauthorized response has a 4xx status code +func (o *AccountUnblockUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock unauthorized response has a 5xx status code +func (o *AccountUnblockUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock unauthorized response a status code equal to that given +func (o *AccountUnblockUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account unblock unauthorized response +func (o *AccountUnblockUnauthorized) Code() int { + return 401 +} + +func (o *AccountUnblockUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockUnauthorized", 401) +} + +func (o *AccountUnblockUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockUnauthorized", 401) +} + +func (o *AccountUnblockUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockNotFound creates a AccountUnblockNotFound with default headers values +func NewAccountUnblockNotFound() *AccountUnblockNotFound { + return &AccountUnblockNotFound{} +} + +/* +AccountUnblockNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUnblockNotFound struct { +} + +// IsSuccess returns true when this account unblock not found response has a 2xx status code +func (o *AccountUnblockNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock not found response has a 3xx status code +func (o *AccountUnblockNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock not found response has a 4xx status code +func (o *AccountUnblockNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock not found response has a 5xx status code +func (o *AccountUnblockNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock not found response a status code equal to that given +func (o *AccountUnblockNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account unblock not found response +func (o *AccountUnblockNotFound) Code() int { + return 404 +} + +func (o *AccountUnblockNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotFound", 404) +} + +func (o *AccountUnblockNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotFound", 404) +} + +func (o *AccountUnblockNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockNotAcceptable creates a AccountUnblockNotAcceptable with default headers values +func NewAccountUnblockNotAcceptable() *AccountUnblockNotAcceptable { + return &AccountUnblockNotAcceptable{} +} + +/* +AccountUnblockNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUnblockNotAcceptable struct { +} + +// IsSuccess returns true when this account unblock not acceptable response has a 2xx status code +func (o *AccountUnblockNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock not acceptable response has a 3xx status code +func (o *AccountUnblockNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock not acceptable response has a 4xx status code +func (o *AccountUnblockNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unblock not acceptable response has a 5xx status code +func (o *AccountUnblockNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account unblock not acceptable response a status code equal to that given +func (o *AccountUnblockNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account unblock not acceptable response +func (o *AccountUnblockNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUnblockNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotAcceptable", 406) +} + +func (o *AccountUnblockNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockNotAcceptable", 406) +} + +func (o *AccountUnblockNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnblockInternalServerError creates a AccountUnblockInternalServerError with default headers values +func NewAccountUnblockInternalServerError() *AccountUnblockInternalServerError { + return &AccountUnblockInternalServerError{} +} + +/* +AccountUnblockInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUnblockInternalServerError struct { +} + +// IsSuccess returns true when this account unblock internal server error response has a 2xx status code +func (o *AccountUnblockInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unblock internal server error response has a 3xx status code +func (o *AccountUnblockInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unblock internal server error response has a 4xx status code +func (o *AccountUnblockInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unblock internal server error response has a 5xx status code +func (o *AccountUnblockInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account unblock internal server error response a status code equal to that given +func (o *AccountUnblockInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account unblock internal server error response +func (o *AccountUnblockInternalServerError) Code() int { + return 500 +} + +func (o *AccountUnblockInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockInternalServerError", 500) +} + +func (o *AccountUnblockInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unblock][%d] accountUnblockInternalServerError", 500) +} + +func (o *AccountUnblockInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_unfollow_parameters.go b/client/accounts/account_unfollow_parameters.go new file mode 100644 index 0000000..cd88514 --- /dev/null +++ b/client/accounts/account_unfollow_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewAccountUnfollowParams creates a new AccountUnfollowParams 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 NewAccountUnfollowParams() *AccountUnfollowParams { + return &AccountUnfollowParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUnfollowParamsWithTimeout creates a new AccountUnfollowParams object +// with the ability to set a timeout on a request. +func NewAccountUnfollowParamsWithTimeout(timeout time.Duration) *AccountUnfollowParams { + return &AccountUnfollowParams{ + timeout: timeout, + } +} + +// NewAccountUnfollowParamsWithContext creates a new AccountUnfollowParams object +// with the ability to set a context for a request. +func NewAccountUnfollowParamsWithContext(ctx context.Context) *AccountUnfollowParams { + return &AccountUnfollowParams{ + Context: ctx, + } +} + +// NewAccountUnfollowParamsWithHTTPClient creates a new AccountUnfollowParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUnfollowParamsWithHTTPClient(client *http.Client) *AccountUnfollowParams { + return &AccountUnfollowParams{ + HTTPClient: client, + } +} + +/* +AccountUnfollowParams contains all the parameters to send to the API endpoint + + for the account unfollow operation. + + Typically these are written to a http.Request. +*/ +type AccountUnfollowParams struct { + + /* ID. + + The id of the account to unfollow. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account unfollow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnfollowParams) WithDefaults() *AccountUnfollowParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account unfollow params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnfollowParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account unfollow params +func (o *AccountUnfollowParams) WithTimeout(timeout time.Duration) *AccountUnfollowParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account unfollow params +func (o *AccountUnfollowParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account unfollow params +func (o *AccountUnfollowParams) WithContext(ctx context.Context) *AccountUnfollowParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account unfollow params +func (o *AccountUnfollowParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account unfollow params +func (o *AccountUnfollowParams) WithHTTPClient(client *http.Client) *AccountUnfollowParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account unfollow params +func (o *AccountUnfollowParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account unfollow params +func (o *AccountUnfollowParams) WithID(id string) *AccountUnfollowParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account unfollow params +func (o *AccountUnfollowParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUnfollowParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_unfollow_responses.go b/client/accounts/account_unfollow_responses.go new file mode 100644 index 0000000..03e6d9c --- /dev/null +++ b/client/accounts/account_unfollow_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUnfollowReader is a Reader for the AccountUnfollow structure. +type AccountUnfollowReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUnfollowReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUnfollowOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUnfollowBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUnfollowUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUnfollowNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUnfollowNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUnfollowInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/unfollow] accountUnfollow", response, response.Code()) + } +} + +// NewAccountUnfollowOK creates a AccountUnfollowOK with default headers values +func NewAccountUnfollowOK() *AccountUnfollowOK { + return &AccountUnfollowOK{} +} + +/* +AccountUnfollowOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountUnfollowOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account unfollow o k response has a 2xx status code +func (o *AccountUnfollowOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account unfollow o k response has a 3xx status code +func (o *AccountUnfollowOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow o k response has a 4xx status code +func (o *AccountUnfollowOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unfollow o k response has a 5xx status code +func (o *AccountUnfollowOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow o k response a status code equal to that given +func (o *AccountUnfollowOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account unfollow o k response +func (o *AccountUnfollowOK) Code() int { + return 200 +} + +func (o *AccountUnfollowOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowOK %s", 200, payload) +} + +func (o *AccountUnfollowOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowOK %s", 200, payload) +} + +func (o *AccountUnfollowOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountUnfollowOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUnfollowBadRequest creates a AccountUnfollowBadRequest with default headers values +func NewAccountUnfollowBadRequest() *AccountUnfollowBadRequest { + return &AccountUnfollowBadRequest{} +} + +/* +AccountUnfollowBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUnfollowBadRequest struct { +} + +// IsSuccess returns true when this account unfollow bad request response has a 2xx status code +func (o *AccountUnfollowBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow bad request response has a 3xx status code +func (o *AccountUnfollowBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow bad request response has a 4xx status code +func (o *AccountUnfollowBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow bad request response has a 5xx status code +func (o *AccountUnfollowBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow bad request response a status code equal to that given +func (o *AccountUnfollowBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account unfollow bad request response +func (o *AccountUnfollowBadRequest) Code() int { + return 400 +} + +func (o *AccountUnfollowBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowBadRequest", 400) +} + +func (o *AccountUnfollowBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowBadRequest", 400) +} + +func (o *AccountUnfollowBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowUnauthorized creates a AccountUnfollowUnauthorized with default headers values +func NewAccountUnfollowUnauthorized() *AccountUnfollowUnauthorized { + return &AccountUnfollowUnauthorized{} +} + +/* +AccountUnfollowUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUnfollowUnauthorized struct { +} + +// IsSuccess returns true when this account unfollow unauthorized response has a 2xx status code +func (o *AccountUnfollowUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow unauthorized response has a 3xx status code +func (o *AccountUnfollowUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow unauthorized response has a 4xx status code +func (o *AccountUnfollowUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow unauthorized response has a 5xx status code +func (o *AccountUnfollowUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow unauthorized response a status code equal to that given +func (o *AccountUnfollowUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account unfollow unauthorized response +func (o *AccountUnfollowUnauthorized) Code() int { + return 401 +} + +func (o *AccountUnfollowUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowUnauthorized", 401) +} + +func (o *AccountUnfollowUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowUnauthorized", 401) +} + +func (o *AccountUnfollowUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowNotFound creates a AccountUnfollowNotFound with default headers values +func NewAccountUnfollowNotFound() *AccountUnfollowNotFound { + return &AccountUnfollowNotFound{} +} + +/* +AccountUnfollowNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUnfollowNotFound struct { +} + +// IsSuccess returns true when this account unfollow not found response has a 2xx status code +func (o *AccountUnfollowNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow not found response has a 3xx status code +func (o *AccountUnfollowNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow not found response has a 4xx status code +func (o *AccountUnfollowNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow not found response has a 5xx status code +func (o *AccountUnfollowNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow not found response a status code equal to that given +func (o *AccountUnfollowNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account unfollow not found response +func (o *AccountUnfollowNotFound) Code() int { + return 404 +} + +func (o *AccountUnfollowNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotFound", 404) +} + +func (o *AccountUnfollowNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotFound", 404) +} + +func (o *AccountUnfollowNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowNotAcceptable creates a AccountUnfollowNotAcceptable with default headers values +func NewAccountUnfollowNotAcceptable() *AccountUnfollowNotAcceptable { + return &AccountUnfollowNotAcceptable{} +} + +/* +AccountUnfollowNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUnfollowNotAcceptable struct { +} + +// IsSuccess returns true when this account unfollow not acceptable response has a 2xx status code +func (o *AccountUnfollowNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow not acceptable response has a 3xx status code +func (o *AccountUnfollowNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow not acceptable response has a 4xx status code +func (o *AccountUnfollowNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unfollow not acceptable response has a 5xx status code +func (o *AccountUnfollowNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account unfollow not acceptable response a status code equal to that given +func (o *AccountUnfollowNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account unfollow not acceptable response +func (o *AccountUnfollowNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUnfollowNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotAcceptable", 406) +} + +func (o *AccountUnfollowNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowNotAcceptable", 406) +} + +func (o *AccountUnfollowNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnfollowInternalServerError creates a AccountUnfollowInternalServerError with default headers values +func NewAccountUnfollowInternalServerError() *AccountUnfollowInternalServerError { + return &AccountUnfollowInternalServerError{} +} + +/* +AccountUnfollowInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUnfollowInternalServerError struct { +} + +// IsSuccess returns true when this account unfollow internal server error response has a 2xx status code +func (o *AccountUnfollowInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unfollow internal server error response has a 3xx status code +func (o *AccountUnfollowInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unfollow internal server error response has a 4xx status code +func (o *AccountUnfollowInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unfollow internal server error response has a 5xx status code +func (o *AccountUnfollowInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account unfollow internal server error response a status code equal to that given +func (o *AccountUnfollowInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account unfollow internal server error response +func (o *AccountUnfollowInternalServerError) Code() int { + return 500 +} + +func (o *AccountUnfollowInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowInternalServerError", 500) +} + +func (o *AccountUnfollowInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unfollow][%d] accountUnfollowInternalServerError", 500) +} + +func (o *AccountUnfollowInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_unmute_parameters.go b/client/accounts/account_unmute_parameters.go new file mode 100644 index 0000000..0e30c9e --- /dev/null +++ b/client/accounts/account_unmute_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewAccountUnmuteParams creates a new AccountUnmuteParams 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 NewAccountUnmuteParams() *AccountUnmuteParams { + return &AccountUnmuteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUnmuteParamsWithTimeout creates a new AccountUnmuteParams object +// with the ability to set a timeout on a request. +func NewAccountUnmuteParamsWithTimeout(timeout time.Duration) *AccountUnmuteParams { + return &AccountUnmuteParams{ + timeout: timeout, + } +} + +// NewAccountUnmuteParamsWithContext creates a new AccountUnmuteParams object +// with the ability to set a context for a request. +func NewAccountUnmuteParamsWithContext(ctx context.Context) *AccountUnmuteParams { + return &AccountUnmuteParams{ + Context: ctx, + } +} + +// NewAccountUnmuteParamsWithHTTPClient creates a new AccountUnmuteParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUnmuteParamsWithHTTPClient(client *http.Client) *AccountUnmuteParams { + return &AccountUnmuteParams{ + HTTPClient: client, + } +} + +/* +AccountUnmuteParams contains all the parameters to send to the API endpoint + + for the account unmute operation. + + Typically these are written to a http.Request. +*/ +type AccountUnmuteParams struct { + + /* ID. + + The ID of the account to unmute. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnmuteParams) WithDefaults() *AccountUnmuteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUnmuteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account unmute params +func (o *AccountUnmuteParams) WithTimeout(timeout time.Duration) *AccountUnmuteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account unmute params +func (o *AccountUnmuteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account unmute params +func (o *AccountUnmuteParams) WithContext(ctx context.Context) *AccountUnmuteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account unmute params +func (o *AccountUnmuteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account unmute params +func (o *AccountUnmuteParams) WithHTTPClient(client *http.Client) *AccountUnmuteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account unmute params +func (o *AccountUnmuteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the account unmute params +func (o *AccountUnmuteParams) WithID(id string) *AccountUnmuteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the account unmute params +func (o *AccountUnmuteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUnmuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_unmute_responses.go b/client/accounts/account_unmute_responses.go new file mode 100644 index 0000000..a2371a3 --- /dev/null +++ b/client/accounts/account_unmute_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUnmuteReader is a Reader for the AccountUnmute structure. +type AccountUnmuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUnmuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUnmuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUnmuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUnmuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUnmuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUnmuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUnmuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/accounts/{id}/unmute] accountUnmute", response, response.Code()) + } +} + +// NewAccountUnmuteOK creates a AccountUnmuteOK with default headers values +func NewAccountUnmuteOK() *AccountUnmuteOK { + return &AccountUnmuteOK{} +} + +/* +AccountUnmuteOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AccountUnmuteOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this account unmute o k response has a 2xx status code +func (o *AccountUnmuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account unmute o k response has a 3xx status code +func (o *AccountUnmuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute o k response has a 4xx status code +func (o *AccountUnmuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unmute o k response has a 5xx status code +func (o *AccountUnmuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute o k response a status code equal to that given +func (o *AccountUnmuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account unmute o k response +func (o *AccountUnmuteOK) Code() int { + return 200 +} + +func (o *AccountUnmuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteOK %s", 200, payload) +} + +func (o *AccountUnmuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteOK %s", 200, payload) +} + +func (o *AccountUnmuteOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AccountUnmuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUnmuteBadRequest creates a AccountUnmuteBadRequest with default headers values +func NewAccountUnmuteBadRequest() *AccountUnmuteBadRequest { + return &AccountUnmuteBadRequest{} +} + +/* +AccountUnmuteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUnmuteBadRequest struct { +} + +// IsSuccess returns true when this account unmute bad request response has a 2xx status code +func (o *AccountUnmuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute bad request response has a 3xx status code +func (o *AccountUnmuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute bad request response has a 4xx status code +func (o *AccountUnmuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute bad request response has a 5xx status code +func (o *AccountUnmuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute bad request response a status code equal to that given +func (o *AccountUnmuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account unmute bad request response +func (o *AccountUnmuteBadRequest) Code() int { + return 400 +} + +func (o *AccountUnmuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteBadRequest", 400) +} + +func (o *AccountUnmuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteBadRequest", 400) +} + +func (o *AccountUnmuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteUnauthorized creates a AccountUnmuteUnauthorized with default headers values +func NewAccountUnmuteUnauthorized() *AccountUnmuteUnauthorized { + return &AccountUnmuteUnauthorized{} +} + +/* +AccountUnmuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUnmuteUnauthorized struct { +} + +// IsSuccess returns true when this account unmute unauthorized response has a 2xx status code +func (o *AccountUnmuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute unauthorized response has a 3xx status code +func (o *AccountUnmuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute unauthorized response has a 4xx status code +func (o *AccountUnmuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute unauthorized response has a 5xx status code +func (o *AccountUnmuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute unauthorized response a status code equal to that given +func (o *AccountUnmuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account unmute unauthorized response +func (o *AccountUnmuteUnauthorized) Code() int { + return 401 +} + +func (o *AccountUnmuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteUnauthorized", 401) +} + +func (o *AccountUnmuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteUnauthorized", 401) +} + +func (o *AccountUnmuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteNotFound creates a AccountUnmuteNotFound with default headers values +func NewAccountUnmuteNotFound() *AccountUnmuteNotFound { + return &AccountUnmuteNotFound{} +} + +/* +AccountUnmuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUnmuteNotFound struct { +} + +// IsSuccess returns true when this account unmute not found response has a 2xx status code +func (o *AccountUnmuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute not found response has a 3xx status code +func (o *AccountUnmuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute not found response has a 4xx status code +func (o *AccountUnmuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute not found response has a 5xx status code +func (o *AccountUnmuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute not found response a status code equal to that given +func (o *AccountUnmuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account unmute not found response +func (o *AccountUnmuteNotFound) Code() int { + return 404 +} + +func (o *AccountUnmuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotFound", 404) +} + +func (o *AccountUnmuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotFound", 404) +} + +func (o *AccountUnmuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteNotAcceptable creates a AccountUnmuteNotAcceptable with default headers values +func NewAccountUnmuteNotAcceptable() *AccountUnmuteNotAcceptable { + return &AccountUnmuteNotAcceptable{} +} + +/* +AccountUnmuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUnmuteNotAcceptable struct { +} + +// IsSuccess returns true when this account unmute not acceptable response has a 2xx status code +func (o *AccountUnmuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute not acceptable response has a 3xx status code +func (o *AccountUnmuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute not acceptable response has a 4xx status code +func (o *AccountUnmuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account unmute not acceptable response has a 5xx status code +func (o *AccountUnmuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account unmute not acceptable response a status code equal to that given +func (o *AccountUnmuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account unmute not acceptable response +func (o *AccountUnmuteNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUnmuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotAcceptable", 406) +} + +func (o *AccountUnmuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteNotAcceptable", 406) +} + +func (o *AccountUnmuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUnmuteInternalServerError creates a AccountUnmuteInternalServerError with default headers values +func NewAccountUnmuteInternalServerError() *AccountUnmuteInternalServerError { + return &AccountUnmuteInternalServerError{} +} + +/* +AccountUnmuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUnmuteInternalServerError struct { +} + +// IsSuccess returns true when this account unmute internal server error response has a 2xx status code +func (o *AccountUnmuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account unmute internal server error response has a 3xx status code +func (o *AccountUnmuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account unmute internal server error response has a 4xx status code +func (o *AccountUnmuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account unmute internal server error response has a 5xx status code +func (o *AccountUnmuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account unmute internal server error response a status code equal to that given +func (o *AccountUnmuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account unmute internal server error response +func (o *AccountUnmuteInternalServerError) Code() int { + return 500 +} + +func (o *AccountUnmuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteInternalServerError", 500) +} + +func (o *AccountUnmuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/accounts/{id}/unmute][%d] accountUnmuteInternalServerError", 500) +} + +func (o *AccountUnmuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_update_parameters.go b/client/accounts/account_update_parameters.go new file mode 100644 index 0000000..a149197 --- /dev/null +++ b/client/accounts/account_update_parameters.go @@ -0,0 +1,1016 @@ +// 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" +) + +// NewAccountUpdateParams creates a new AccountUpdateParams 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 NewAccountUpdateParams() *AccountUpdateParams { + return &AccountUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountUpdateParamsWithTimeout creates a new AccountUpdateParams object +// with the ability to set a timeout on a request. +func NewAccountUpdateParamsWithTimeout(timeout time.Duration) *AccountUpdateParams { + return &AccountUpdateParams{ + timeout: timeout, + } +} + +// NewAccountUpdateParamsWithContext creates a new AccountUpdateParams object +// with the ability to set a context for a request. +func NewAccountUpdateParamsWithContext(ctx context.Context) *AccountUpdateParams { + return &AccountUpdateParams{ + Context: ctx, + } +} + +// NewAccountUpdateParamsWithHTTPClient creates a new AccountUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountUpdateParamsWithHTTPClient(client *http.Client) *AccountUpdateParams { + return &AccountUpdateParams{ + HTTPClient: client, + } +} + +/* +AccountUpdateParams contains all the parameters to send to the API endpoint + + for the account update operation. + + Typically these are written to a http.Request. +*/ +type AccountUpdateParams struct { + + /* Avatar. + + Avatar of the user. + */ + Avatar runtime.NamedReadCloser + + /* AvatarDescription. + + Description of avatar image, for alt-text. + */ + AvatarDescription string + + /* Bot. + + Account is flagged as a bot. + */ + Bot *bool + + /* CustomCSS. + + Custom CSS to use when rendering this account's profile or statuses. String must be no more than 5,000 characters (~5kb). + */ + CustomCSS *string + + /* Discoverable. + + Account should be made discoverable and shown in the profile directory (if enabled). + */ + Discoverable *bool + + /* DisplayName. + + The display name to use for the account. + */ + DisplayName string + + /* EnableRss. + + Enable RSS feed for this account's Public posts at `/[username]/feed.rss` + */ + EnableRss *bool + + /* FieldsAttributes0Name. + + Name of 1st profile field to be added to this account's profile. (The index may be any string; add more indexes to send more fields.) + */ + FieldsAttributes0Name *string + + /* FieldsAttributes0Value. + + Value of 1st profile field to be added to this account's profile. (The index may be any string; add more indexes to send more fields.) + */ + FieldsAttributes0Value *string + + /* FieldsAttributes1Name. + + Name of 2nd profile field to be added to this account's profile. + */ + FieldsAttributes1Name *string + + /* FieldsAttributes1Value. + + Value of 2nd profile field to be added to this account's profile. + */ + FieldsAttributes1Value *string + + /* FieldsAttributes2Name. + + Name of 3rd profile field to be added to this account's profile. + */ + FieldsAttributes2Name *string + + /* FieldsAttributes2Value. + + Value of 3rd profile field to be added to this account's profile. + */ + FieldsAttributes2Value *string + + /* FieldsAttributes3Name. + + Name of 4th profile field to be added to this account's profile. + */ + FieldsAttributes3Name *string + + /* FieldsAttributes3Value. + + Value of 4th profile field to be added to this account's profile. + */ + FieldsAttributes3Value *string + + /* FieldsAttributes4Name. + + Name of 5th profile field to be added to this account's profile. + */ + FieldsAttributes4Name *string + + /* FieldsAttributes4Value. + + Value of 5th profile field to be added to this account's profile. + */ + FieldsAttributes4Value *string + + /* FieldsAttributes5Name. + + Name of 6th profile field to be added to this account's profile. + */ + FieldsAttributes5Name *string + + /* FieldsAttributes5Value. + + Value of 6th profile field to be added to this account's profile. + */ + FieldsAttributes5Value *string + + /* Header. + + Header of the user. + */ + Header runtime.NamedReadCloser + + /* HeaderDescription. + + Description of header image, for alt-text. + */ + HeaderDescription string + + /* HideCollections. + + Hide the account's following/followers collections. + */ + HideCollections *bool + + /* Locked. + + Require manual approval of follow requests. + */ + Locked *bool + + /* Note. + + Bio/description of this account. + */ + Note string + + /* SourceLanguage. + + Default language to use for authored statuses (ISO 6391). + */ + SourceLanguage *string + + /* SourcePrivacy. + + Default post privacy for authored statuses. + */ + SourcePrivacy *string + + /* SourceSensitive. + + Mark authored statuses as sensitive by default. + */ + SourceSensitive *bool + + /* SourceStatusContentType. + + Default content type to use for authored statuses (text/plain or text/markdown). + */ + SourceStatusContentType *string + + /* Theme. + + FileName of the theme to use when rendering this account's profile or statuses. The theme must exist on this server, as indicated by /api/v1/accounts/themes. Empty string unsets theme and returns to the default GoToSocial theme. + */ + Theme *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUpdateParams) WithDefaults() *AccountUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account update params +func (o *AccountUpdateParams) WithTimeout(timeout time.Duration) *AccountUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account update params +func (o *AccountUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account update params +func (o *AccountUpdateParams) WithContext(ctx context.Context) *AccountUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account update params +func (o *AccountUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account update params +func (o *AccountUpdateParams) WithHTTPClient(client *http.Client) *AccountUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account update params +func (o *AccountUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAvatar adds the avatar to the account update params +func (o *AccountUpdateParams) WithAvatar(avatar runtime.NamedReadCloser) *AccountUpdateParams { + o.SetAvatar(avatar) + return o +} + +// SetAvatar adds the avatar to the account update params +func (o *AccountUpdateParams) SetAvatar(avatar runtime.NamedReadCloser) { + o.Avatar = avatar +} + +// WithAvatarDescription adds the avatarDescription to the account update params +func (o *AccountUpdateParams) WithAvatarDescription(avatarDescription string) *AccountUpdateParams { + o.SetAvatarDescription(avatarDescription) + return o +} + +// SetAvatarDescription adds the avatarDescription to the account update params +func (o *AccountUpdateParams) SetAvatarDescription(avatarDescription string) { + o.AvatarDescription = avatarDescription +} + +// WithBot adds the bot to the account update params +func (o *AccountUpdateParams) WithBot(bot *bool) *AccountUpdateParams { + o.SetBot(bot) + return o +} + +// SetBot adds the bot to the account update params +func (o *AccountUpdateParams) SetBot(bot *bool) { + o.Bot = bot +} + +// WithCustomCSS adds the customCSS to the account update params +func (o *AccountUpdateParams) WithCustomCSS(customCSS *string) *AccountUpdateParams { + o.SetCustomCSS(customCSS) + return o +} + +// SetCustomCSS adds the customCss to the account update params +func (o *AccountUpdateParams) SetCustomCSS(customCSS *string) { + o.CustomCSS = customCSS +} + +// WithDiscoverable adds the discoverable to the account update params +func (o *AccountUpdateParams) WithDiscoverable(discoverable *bool) *AccountUpdateParams { + o.SetDiscoverable(discoverable) + return o +} + +// SetDiscoverable adds the discoverable to the account update params +func (o *AccountUpdateParams) SetDiscoverable(discoverable *bool) { + o.Discoverable = discoverable +} + +// WithDisplayName adds the displayName to the account update params +func (o *AccountUpdateParams) WithDisplayName(displayName string) *AccountUpdateParams { + o.SetDisplayName(displayName) + return o +} + +// SetDisplayName adds the displayName to the account update params +func (o *AccountUpdateParams) SetDisplayName(displayName string) { + o.DisplayName = displayName +} + +// WithEnableRss adds the enableRss to the account update params +func (o *AccountUpdateParams) WithEnableRss(enableRss *bool) *AccountUpdateParams { + o.SetEnableRss(enableRss) + return o +} + +// SetEnableRss adds the enableRss to the account update params +func (o *AccountUpdateParams) SetEnableRss(enableRss *bool) { + o.EnableRss = enableRss +} + +// WithFieldsAttributes0Name adds the fieldsAttributes0Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes0Name(fieldsAttributes0Name *string) *AccountUpdateParams { + o.SetFieldsAttributes0Name(fieldsAttributes0Name) + return o +} + +// SetFieldsAttributes0Name adds the fieldsAttributes0Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes0Name(fieldsAttributes0Name *string) { + o.FieldsAttributes0Name = fieldsAttributes0Name +} + +// WithFieldsAttributes0Value adds the fieldsAttributes0Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes0Value(fieldsAttributes0Value *string) *AccountUpdateParams { + o.SetFieldsAttributes0Value(fieldsAttributes0Value) + return o +} + +// SetFieldsAttributes0Value adds the fieldsAttributes0Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes0Value(fieldsAttributes0Value *string) { + o.FieldsAttributes0Value = fieldsAttributes0Value +} + +// WithFieldsAttributes1Name adds the fieldsAttributes1Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes1Name(fieldsAttributes1Name *string) *AccountUpdateParams { + o.SetFieldsAttributes1Name(fieldsAttributes1Name) + return o +} + +// SetFieldsAttributes1Name adds the fieldsAttributes1Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes1Name(fieldsAttributes1Name *string) { + o.FieldsAttributes1Name = fieldsAttributes1Name +} + +// WithFieldsAttributes1Value adds the fieldsAttributes1Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes1Value(fieldsAttributes1Value *string) *AccountUpdateParams { + o.SetFieldsAttributes1Value(fieldsAttributes1Value) + return o +} + +// SetFieldsAttributes1Value adds the fieldsAttributes1Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes1Value(fieldsAttributes1Value *string) { + o.FieldsAttributes1Value = fieldsAttributes1Value +} + +// WithFieldsAttributes2Name adds the fieldsAttributes2Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes2Name(fieldsAttributes2Name *string) *AccountUpdateParams { + o.SetFieldsAttributes2Name(fieldsAttributes2Name) + return o +} + +// SetFieldsAttributes2Name adds the fieldsAttributes2Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes2Name(fieldsAttributes2Name *string) { + o.FieldsAttributes2Name = fieldsAttributes2Name +} + +// WithFieldsAttributes2Value adds the fieldsAttributes2Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes2Value(fieldsAttributes2Value *string) *AccountUpdateParams { + o.SetFieldsAttributes2Value(fieldsAttributes2Value) + return o +} + +// SetFieldsAttributes2Value adds the fieldsAttributes2Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes2Value(fieldsAttributes2Value *string) { + o.FieldsAttributes2Value = fieldsAttributes2Value +} + +// WithFieldsAttributes3Name adds the fieldsAttributes3Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes3Name(fieldsAttributes3Name *string) *AccountUpdateParams { + o.SetFieldsAttributes3Name(fieldsAttributes3Name) + return o +} + +// SetFieldsAttributes3Name adds the fieldsAttributes3Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes3Name(fieldsAttributes3Name *string) { + o.FieldsAttributes3Name = fieldsAttributes3Name +} + +// WithFieldsAttributes3Value adds the fieldsAttributes3Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes3Value(fieldsAttributes3Value *string) *AccountUpdateParams { + o.SetFieldsAttributes3Value(fieldsAttributes3Value) + return o +} + +// SetFieldsAttributes3Value adds the fieldsAttributes3Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes3Value(fieldsAttributes3Value *string) { + o.FieldsAttributes3Value = fieldsAttributes3Value +} + +// WithFieldsAttributes4Name adds the fieldsAttributes4Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes4Name(fieldsAttributes4Name *string) *AccountUpdateParams { + o.SetFieldsAttributes4Name(fieldsAttributes4Name) + return o +} + +// SetFieldsAttributes4Name adds the fieldsAttributes4Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes4Name(fieldsAttributes4Name *string) { + o.FieldsAttributes4Name = fieldsAttributes4Name +} + +// WithFieldsAttributes4Value adds the fieldsAttributes4Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes4Value(fieldsAttributes4Value *string) *AccountUpdateParams { + o.SetFieldsAttributes4Value(fieldsAttributes4Value) + return o +} + +// SetFieldsAttributes4Value adds the fieldsAttributes4Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes4Value(fieldsAttributes4Value *string) { + o.FieldsAttributes4Value = fieldsAttributes4Value +} + +// WithFieldsAttributes5Name adds the fieldsAttributes5Name to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes5Name(fieldsAttributes5Name *string) *AccountUpdateParams { + o.SetFieldsAttributes5Name(fieldsAttributes5Name) + return o +} + +// SetFieldsAttributes5Name adds the fieldsAttributes5Name to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes5Name(fieldsAttributes5Name *string) { + o.FieldsAttributes5Name = fieldsAttributes5Name +} + +// WithFieldsAttributes5Value adds the fieldsAttributes5Value to the account update params +func (o *AccountUpdateParams) WithFieldsAttributes5Value(fieldsAttributes5Value *string) *AccountUpdateParams { + o.SetFieldsAttributes5Value(fieldsAttributes5Value) + return o +} + +// SetFieldsAttributes5Value adds the fieldsAttributes5Value to the account update params +func (o *AccountUpdateParams) SetFieldsAttributes5Value(fieldsAttributes5Value *string) { + o.FieldsAttributes5Value = fieldsAttributes5Value +} + +// WithHeader adds the header to the account update params +func (o *AccountUpdateParams) WithHeader(header runtime.NamedReadCloser) *AccountUpdateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the account update params +func (o *AccountUpdateParams) SetHeader(header runtime.NamedReadCloser) { + o.Header = header +} + +// WithHeaderDescription adds the headerDescription to the account update params +func (o *AccountUpdateParams) WithHeaderDescription(headerDescription string) *AccountUpdateParams { + o.SetHeaderDescription(headerDescription) + return o +} + +// SetHeaderDescription adds the headerDescription to the account update params +func (o *AccountUpdateParams) SetHeaderDescription(headerDescription string) { + o.HeaderDescription = headerDescription +} + +// WithHideCollections adds the hideCollections to the account update params +func (o *AccountUpdateParams) WithHideCollections(hideCollections *bool) *AccountUpdateParams { + o.SetHideCollections(hideCollections) + return o +} + +// SetHideCollections adds the hideCollections to the account update params +func (o *AccountUpdateParams) SetHideCollections(hideCollections *bool) { + o.HideCollections = hideCollections +} + +// WithLocked adds the locked to the account update params +func (o *AccountUpdateParams) WithLocked(locked *bool) *AccountUpdateParams { + o.SetLocked(locked) + return o +} + +// SetLocked adds the locked to the account update params +func (o *AccountUpdateParams) SetLocked(locked *bool) { + o.Locked = locked +} + +// WithNote adds the note to the account update params +func (o *AccountUpdateParams) WithNote(note string) *AccountUpdateParams { + o.SetNote(note) + return o +} + +// SetNote adds the note to the account update params +func (o *AccountUpdateParams) SetNote(note string) { + o.Note = note +} + +// WithSourceLanguage adds the sourceLanguage to the account update params +func (o *AccountUpdateParams) WithSourceLanguage(sourceLanguage *string) *AccountUpdateParams { + o.SetSourceLanguage(sourceLanguage) + return o +} + +// SetSourceLanguage adds the sourceLanguage to the account update params +func (o *AccountUpdateParams) SetSourceLanguage(sourceLanguage *string) { + o.SourceLanguage = sourceLanguage +} + +// WithSourcePrivacy adds the sourcePrivacy to the account update params +func (o *AccountUpdateParams) WithSourcePrivacy(sourcePrivacy *string) *AccountUpdateParams { + o.SetSourcePrivacy(sourcePrivacy) + return o +} + +// SetSourcePrivacy adds the sourcePrivacy to the account update params +func (o *AccountUpdateParams) SetSourcePrivacy(sourcePrivacy *string) { + o.SourcePrivacy = sourcePrivacy +} + +// WithSourceSensitive adds the sourceSensitive to the account update params +func (o *AccountUpdateParams) WithSourceSensitive(sourceSensitive *bool) *AccountUpdateParams { + o.SetSourceSensitive(sourceSensitive) + return o +} + +// SetSourceSensitive adds the sourceSensitive to the account update params +func (o *AccountUpdateParams) SetSourceSensitive(sourceSensitive *bool) { + o.SourceSensitive = sourceSensitive +} + +// WithSourceStatusContentType adds the sourceStatusContentType to the account update params +func (o *AccountUpdateParams) WithSourceStatusContentType(sourceStatusContentType *string) *AccountUpdateParams { + o.SetSourceStatusContentType(sourceStatusContentType) + return o +} + +// SetSourceStatusContentType adds the sourceStatusContentType to the account update params +func (o *AccountUpdateParams) SetSourceStatusContentType(sourceStatusContentType *string) { + o.SourceStatusContentType = sourceStatusContentType +} + +// WithTheme adds the theme to the account update params +func (o *AccountUpdateParams) WithTheme(theme *string) *AccountUpdateParams { + o.SetTheme(theme) + return o +} + +// SetTheme adds the theme to the account update params +func (o *AccountUpdateParams) SetTheme(theme *string) { + o.Theme = theme +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Avatar != nil { + + if o.Avatar != nil { + // form file param avatar + if err := r.SetFileParam("avatar", o.Avatar); err != nil { + return err + } + } + } + + // form param avatar_description + frAvatarDescription := o.AvatarDescription + fAvatarDescription := frAvatarDescription + if err := r.SetFormParam("avatar_description", fAvatarDescription); err != nil { + return err + } + + if o.Bot != nil { + + // form param bot + var frBot bool + if o.Bot != nil { + frBot = *o.Bot + } + fBot := swag.FormatBool(frBot) + if fBot != "" { + if err := r.SetFormParam("bot", fBot); err != nil { + return err + } + } + } + + if o.CustomCSS != nil { + + // form param custom_css + var frCustomCSS string + if o.CustomCSS != nil { + frCustomCSS = *o.CustomCSS + } + fCustomCSS := frCustomCSS + if fCustomCSS != "" { + if err := r.SetFormParam("custom_css", fCustomCSS); err != nil { + return err + } + } + } + + if o.Discoverable != nil { + + // form param discoverable + var frDiscoverable bool + if o.Discoverable != nil { + frDiscoverable = *o.Discoverable + } + fDiscoverable := swag.FormatBool(frDiscoverable) + if fDiscoverable != "" { + if err := r.SetFormParam("discoverable", fDiscoverable); err != nil { + return err + } + } + } + + // form param display_name + frDisplayName := o.DisplayName + fDisplayName := frDisplayName + if err := r.SetFormParam("display_name", fDisplayName); err != nil { + return err + } + + if o.EnableRss != nil { + + // form param enable_rss + var frEnableRss bool + if o.EnableRss != nil { + frEnableRss = *o.EnableRss + } + fEnableRss := swag.FormatBool(frEnableRss) + if fEnableRss != "" { + if err := r.SetFormParam("enable_rss", fEnableRss); err != nil { + return err + } + } + } + + if o.FieldsAttributes0Name != nil { + + // form param fields_attributes[0][name] + var frFieldsAttributes0Name string + if o.FieldsAttributes0Name != nil { + frFieldsAttributes0Name = *o.FieldsAttributes0Name + } + fFieldsAttributes0Name := frFieldsAttributes0Name + if fFieldsAttributes0Name != "" { + if err := r.SetFormParam("fields_attributes[0][name]", fFieldsAttributes0Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes0Value != nil { + + // form param fields_attributes[0][value] + var frFieldsAttributes0Value string + if o.FieldsAttributes0Value != nil { + frFieldsAttributes0Value = *o.FieldsAttributes0Value + } + fFieldsAttributes0Value := frFieldsAttributes0Value + if fFieldsAttributes0Value != "" { + if err := r.SetFormParam("fields_attributes[0][value]", fFieldsAttributes0Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes1Name != nil { + + // form param fields_attributes[1][name] + var frFieldsAttributes1Name string + if o.FieldsAttributes1Name != nil { + frFieldsAttributes1Name = *o.FieldsAttributes1Name + } + fFieldsAttributes1Name := frFieldsAttributes1Name + if fFieldsAttributes1Name != "" { + if err := r.SetFormParam("fields_attributes[1][name]", fFieldsAttributes1Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes1Value != nil { + + // form param fields_attributes[1][value] + var frFieldsAttributes1Value string + if o.FieldsAttributes1Value != nil { + frFieldsAttributes1Value = *o.FieldsAttributes1Value + } + fFieldsAttributes1Value := frFieldsAttributes1Value + if fFieldsAttributes1Value != "" { + if err := r.SetFormParam("fields_attributes[1][value]", fFieldsAttributes1Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes2Name != nil { + + // form param fields_attributes[2][name] + var frFieldsAttributes2Name string + if o.FieldsAttributes2Name != nil { + frFieldsAttributes2Name = *o.FieldsAttributes2Name + } + fFieldsAttributes2Name := frFieldsAttributes2Name + if fFieldsAttributes2Name != "" { + if err := r.SetFormParam("fields_attributes[2][name]", fFieldsAttributes2Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes2Value != nil { + + // form param fields_attributes[2][value] + var frFieldsAttributes2Value string + if o.FieldsAttributes2Value != nil { + frFieldsAttributes2Value = *o.FieldsAttributes2Value + } + fFieldsAttributes2Value := frFieldsAttributes2Value + if fFieldsAttributes2Value != "" { + if err := r.SetFormParam("fields_attributes[2][value]", fFieldsAttributes2Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes3Name != nil { + + // form param fields_attributes[3][name] + var frFieldsAttributes3Name string + if o.FieldsAttributes3Name != nil { + frFieldsAttributes3Name = *o.FieldsAttributes3Name + } + fFieldsAttributes3Name := frFieldsAttributes3Name + if fFieldsAttributes3Name != "" { + if err := r.SetFormParam("fields_attributes[3][name]", fFieldsAttributes3Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes3Value != nil { + + // form param fields_attributes[3][value] + var frFieldsAttributes3Value string + if o.FieldsAttributes3Value != nil { + frFieldsAttributes3Value = *o.FieldsAttributes3Value + } + fFieldsAttributes3Value := frFieldsAttributes3Value + if fFieldsAttributes3Value != "" { + if err := r.SetFormParam("fields_attributes[3][value]", fFieldsAttributes3Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes4Name != nil { + + // form param fields_attributes[4][name] + var frFieldsAttributes4Name string + if o.FieldsAttributes4Name != nil { + frFieldsAttributes4Name = *o.FieldsAttributes4Name + } + fFieldsAttributes4Name := frFieldsAttributes4Name + if fFieldsAttributes4Name != "" { + if err := r.SetFormParam("fields_attributes[4][name]", fFieldsAttributes4Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes4Value != nil { + + // form param fields_attributes[4][value] + var frFieldsAttributes4Value string + if o.FieldsAttributes4Value != nil { + frFieldsAttributes4Value = *o.FieldsAttributes4Value + } + fFieldsAttributes4Value := frFieldsAttributes4Value + if fFieldsAttributes4Value != "" { + if err := r.SetFormParam("fields_attributes[4][value]", fFieldsAttributes4Value); err != nil { + return err + } + } + } + + if o.FieldsAttributes5Name != nil { + + // form param fields_attributes[5][name] + var frFieldsAttributes5Name string + if o.FieldsAttributes5Name != nil { + frFieldsAttributes5Name = *o.FieldsAttributes5Name + } + fFieldsAttributes5Name := frFieldsAttributes5Name + if fFieldsAttributes5Name != "" { + if err := r.SetFormParam("fields_attributes[5][name]", fFieldsAttributes5Name); err != nil { + return err + } + } + } + + if o.FieldsAttributes5Value != nil { + + // form param fields_attributes[5][value] + var frFieldsAttributes5Value string + if o.FieldsAttributes5Value != nil { + frFieldsAttributes5Value = *o.FieldsAttributes5Value + } + fFieldsAttributes5Value := frFieldsAttributes5Value + if fFieldsAttributes5Value != "" { + if err := r.SetFormParam("fields_attributes[5][value]", fFieldsAttributes5Value); err != nil { + return err + } + } + } + + if o.Header != nil { + + if o.Header != nil { + // form file param header + if err := r.SetFileParam("header", o.Header); err != nil { + return err + } + } + } + + // form param header_description + frHeaderDescription := o.HeaderDescription + fHeaderDescription := frHeaderDescription + if err := r.SetFormParam("header_description", fHeaderDescription); err != nil { + return err + } + + if o.HideCollections != nil { + + // form param hide_collections + var frHideCollections bool + if o.HideCollections != nil { + frHideCollections = *o.HideCollections + } + fHideCollections := swag.FormatBool(frHideCollections) + if fHideCollections != "" { + if err := r.SetFormParam("hide_collections", fHideCollections); err != nil { + return err + } + } + } + + if o.Locked != nil { + + // form param locked + var frLocked bool + if o.Locked != nil { + frLocked = *o.Locked + } + fLocked := swag.FormatBool(frLocked) + if fLocked != "" { + if err := r.SetFormParam("locked", fLocked); err != nil { + return err + } + } + } + + // form param note + frNote := o.Note + fNote := frNote + if err := r.SetFormParam("note", fNote); err != nil { + return err + } + + if o.SourceLanguage != nil { + + // form param source[language] + var frSourceLanguage string + if o.SourceLanguage != nil { + frSourceLanguage = *o.SourceLanguage + } + fSourceLanguage := frSourceLanguage + if fSourceLanguage != "" { + if err := r.SetFormParam("source[language]", fSourceLanguage); err != nil { + return err + } + } + } + + if o.SourcePrivacy != nil { + + // form param source[privacy] + var frSourcePrivacy string + if o.SourcePrivacy != nil { + frSourcePrivacy = *o.SourcePrivacy + } + fSourcePrivacy := frSourcePrivacy + if fSourcePrivacy != "" { + if err := r.SetFormParam("source[privacy]", fSourcePrivacy); err != nil { + return err + } + } + } + + if o.SourceSensitive != nil { + + // form param source[sensitive] + var frSourceSensitive bool + if o.SourceSensitive != nil { + frSourceSensitive = *o.SourceSensitive + } + fSourceSensitive := swag.FormatBool(frSourceSensitive) + if fSourceSensitive != "" { + if err := r.SetFormParam("source[sensitive]", fSourceSensitive); err != nil { + return err + } + } + } + + if o.SourceStatusContentType != nil { + + // form param source[status_content_type] + var frSourceStatusContentType string + if o.SourceStatusContentType != nil { + frSourceStatusContentType = *o.SourceStatusContentType + } + fSourceStatusContentType := frSourceStatusContentType + if fSourceStatusContentType != "" { + if err := r.SetFormParam("source[status_content_type]", fSourceStatusContentType); err != nil { + return err + } + } + } + + if o.Theme != nil { + + // form param theme + var frTheme string + if o.Theme != nil { + frTheme = *o.Theme + } + fTheme := frTheme + if fTheme != "" { + if err := r.SetFormParam("theme", fTheme); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_update_responses.go b/client/accounts/account_update_responses.go new file mode 100644 index 0000000..51c3400 --- /dev/null +++ b/client/accounts/account_update_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountUpdateReader is a Reader for the AccountUpdate structure. +type AccountUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/accounts/update_credentials] accountUpdate", response, response.Code()) + } +} + +// NewAccountUpdateOK creates a AccountUpdateOK with default headers values +func NewAccountUpdateOK() *AccountUpdateOK { + return &AccountUpdateOK{} +} + +/* +AccountUpdateOK describes a response with status code 200, with default header values. + +The newly updated account. +*/ +type AccountUpdateOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account update o k response has a 2xx status code +func (o *AccountUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account update o k response has a 3xx status code +func (o *AccountUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update o k response has a 4xx status code +func (o *AccountUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account update o k response has a 5xx status code +func (o *AccountUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account update o k response a status code equal to that given +func (o *AccountUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account update o k response +func (o *AccountUpdateOK) Code() int { + return 200 +} + +func (o *AccountUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateOK %s", 200, payload) +} + +func (o *AccountUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateOK %s", 200, payload) +} + +func (o *AccountUpdateOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountUpdateBadRequest creates a AccountUpdateBadRequest with default headers values +func NewAccountUpdateBadRequest() *AccountUpdateBadRequest { + return &AccountUpdateBadRequest{} +} + +/* +AccountUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountUpdateBadRequest struct { +} + +// IsSuccess returns true when this account update bad request response has a 2xx status code +func (o *AccountUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update bad request response has a 3xx status code +func (o *AccountUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update bad request response has a 4xx status code +func (o *AccountUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update bad request response has a 5xx status code +func (o *AccountUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account update bad request response a status code equal to that given +func (o *AccountUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account update bad request response +func (o *AccountUpdateBadRequest) Code() int { + return 400 +} + +func (o *AccountUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateBadRequest", 400) +} + +func (o *AccountUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateBadRequest", 400) +} + +func (o *AccountUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateUnauthorized creates a AccountUpdateUnauthorized with default headers values +func NewAccountUpdateUnauthorized() *AccountUpdateUnauthorized { + return &AccountUpdateUnauthorized{} +} + +/* +AccountUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountUpdateUnauthorized struct { +} + +// IsSuccess returns true when this account update unauthorized response has a 2xx status code +func (o *AccountUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update unauthorized response has a 3xx status code +func (o *AccountUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update unauthorized response has a 4xx status code +func (o *AccountUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update unauthorized response has a 5xx status code +func (o *AccountUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account update unauthorized response a status code equal to that given +func (o *AccountUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account update unauthorized response +func (o *AccountUpdateUnauthorized) Code() int { + return 401 +} + +func (o *AccountUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateUnauthorized", 401) +} + +func (o *AccountUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateUnauthorized", 401) +} + +func (o *AccountUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateNotFound creates a AccountUpdateNotFound with default headers values +func NewAccountUpdateNotFound() *AccountUpdateNotFound { + return &AccountUpdateNotFound{} +} + +/* +AccountUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountUpdateNotFound struct { +} + +// IsSuccess returns true when this account update not found response has a 2xx status code +func (o *AccountUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update not found response has a 3xx status code +func (o *AccountUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update not found response has a 4xx status code +func (o *AccountUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update not found response has a 5xx status code +func (o *AccountUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account update not found response a status code equal to that given +func (o *AccountUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account update not found response +func (o *AccountUpdateNotFound) Code() int { + return 404 +} + +func (o *AccountUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotFound", 404) +} + +func (o *AccountUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotFound", 404) +} + +func (o *AccountUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateNotAcceptable creates a AccountUpdateNotAcceptable with default headers values +func NewAccountUpdateNotAcceptable() *AccountUpdateNotAcceptable { + return &AccountUpdateNotAcceptable{} +} + +/* +AccountUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this account update not acceptable response has a 2xx status code +func (o *AccountUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update not acceptable response has a 3xx status code +func (o *AccountUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update not acceptable response has a 4xx status code +func (o *AccountUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account update not acceptable response has a 5xx status code +func (o *AccountUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account update not acceptable response a status code equal to that given +func (o *AccountUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account update not acceptable response +func (o *AccountUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *AccountUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotAcceptable", 406) +} + +func (o *AccountUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateNotAcceptable", 406) +} + +func (o *AccountUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountUpdateInternalServerError creates a AccountUpdateInternalServerError with default headers values +func NewAccountUpdateInternalServerError() *AccountUpdateInternalServerError { + return &AccountUpdateInternalServerError{} +} + +/* +AccountUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountUpdateInternalServerError struct { +} + +// IsSuccess returns true when this account update internal server error response has a 2xx status code +func (o *AccountUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account update internal server error response has a 3xx status code +func (o *AccountUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account update internal server error response has a 4xx status code +func (o *AccountUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account update internal server error response has a 5xx status code +func (o *AccountUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account update internal server error response a status code equal to that given +func (o *AccountUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account update internal server error response +func (o *AccountUpdateInternalServerError) Code() int { + return 500 +} + +func (o *AccountUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateInternalServerError", 500) +} + +func (o *AccountUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/accounts/update_credentials][%d] accountUpdateInternalServerError", 500) +} + +func (o *AccountUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/account_verify_parameters.go b/client/accounts/account_verify_parameters.go new file mode 100644 index 0000000..55ebf74 --- /dev/null +++ b/client/accounts/account_verify_parameters.go @@ -0,0 +1,128 @@ +// 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" +) + +// NewAccountVerifyParams creates a new AccountVerifyParams 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 NewAccountVerifyParams() *AccountVerifyParams { + return &AccountVerifyParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAccountVerifyParamsWithTimeout creates a new AccountVerifyParams object +// with the ability to set a timeout on a request. +func NewAccountVerifyParamsWithTimeout(timeout time.Duration) *AccountVerifyParams { + return &AccountVerifyParams{ + timeout: timeout, + } +} + +// NewAccountVerifyParamsWithContext creates a new AccountVerifyParams object +// with the ability to set a context for a request. +func NewAccountVerifyParamsWithContext(ctx context.Context) *AccountVerifyParams { + return &AccountVerifyParams{ + Context: ctx, + } +} + +// NewAccountVerifyParamsWithHTTPClient creates a new AccountVerifyParams object +// with the ability to set a custom HTTPClient for a request. +func NewAccountVerifyParamsWithHTTPClient(client *http.Client) *AccountVerifyParams { + return &AccountVerifyParams{ + HTTPClient: client, + } +} + +/* +AccountVerifyParams contains all the parameters to send to the API endpoint + + for the account verify operation. + + Typically these are written to a http.Request. +*/ +type AccountVerifyParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the account verify params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountVerifyParams) WithDefaults() *AccountVerifyParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the account verify params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AccountVerifyParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the account verify params +func (o *AccountVerifyParams) WithTimeout(timeout time.Duration) *AccountVerifyParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the account verify params +func (o *AccountVerifyParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the account verify params +func (o *AccountVerifyParams) WithContext(ctx context.Context) *AccountVerifyParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the account verify params +func (o *AccountVerifyParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the account verify params +func (o *AccountVerifyParams) WithHTTPClient(client *http.Client) *AccountVerifyParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the account verify params +func (o *AccountVerifyParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AccountVerifyParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/accounts/account_verify_responses.go b/client/accounts/account_verify_responses.go new file mode 100644 index 0000000..d19a829 --- /dev/null +++ b/client/accounts/account_verify_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AccountVerifyReader is a Reader for the AccountVerify structure. +type AccountVerifyReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AccountVerifyReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAccountVerifyOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAccountVerifyBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAccountVerifyUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAccountVerifyNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAccountVerifyNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAccountVerifyInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/accounts/verify_credentials] accountVerify", response, response.Code()) + } +} + +// NewAccountVerifyOK creates a AccountVerifyOK with default headers values +func NewAccountVerifyOK() *AccountVerifyOK { + return &AccountVerifyOK{} +} + +/* +AccountVerifyOK describes a response with status code 200, with default header values. + +AccountVerifyOK account verify o k +*/ +type AccountVerifyOK struct { + Payload *models.Account +} + +// IsSuccess returns true when this account verify o k response has a 2xx status code +func (o *AccountVerifyOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this account verify o k response has a 3xx status code +func (o *AccountVerifyOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify o k response has a 4xx status code +func (o *AccountVerifyOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this account verify o k response has a 5xx status code +func (o *AccountVerifyOK) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify o k response a status code equal to that given +func (o *AccountVerifyOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the account verify o k response +func (o *AccountVerifyOK) Code() int { + return 200 +} + +func (o *AccountVerifyOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyOK %s", 200, payload) +} + +func (o *AccountVerifyOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyOK %s", 200, payload) +} + +func (o *AccountVerifyOK) GetPayload() *models.Account { + return o.Payload +} + +func (o *AccountVerifyOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Account) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAccountVerifyBadRequest creates a AccountVerifyBadRequest with default headers values +func NewAccountVerifyBadRequest() *AccountVerifyBadRequest { + return &AccountVerifyBadRequest{} +} + +/* +AccountVerifyBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AccountVerifyBadRequest struct { +} + +// IsSuccess returns true when this account verify bad request response has a 2xx status code +func (o *AccountVerifyBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify bad request response has a 3xx status code +func (o *AccountVerifyBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify bad request response has a 4xx status code +func (o *AccountVerifyBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify bad request response has a 5xx status code +func (o *AccountVerifyBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify bad request response a status code equal to that given +func (o *AccountVerifyBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the account verify bad request response +func (o *AccountVerifyBadRequest) Code() int { + return 400 +} + +func (o *AccountVerifyBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyBadRequest", 400) +} + +func (o *AccountVerifyBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyBadRequest", 400) +} + +func (o *AccountVerifyBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyUnauthorized creates a AccountVerifyUnauthorized with default headers values +func NewAccountVerifyUnauthorized() *AccountVerifyUnauthorized { + return &AccountVerifyUnauthorized{} +} + +/* +AccountVerifyUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AccountVerifyUnauthorized struct { +} + +// IsSuccess returns true when this account verify unauthorized response has a 2xx status code +func (o *AccountVerifyUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify unauthorized response has a 3xx status code +func (o *AccountVerifyUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify unauthorized response has a 4xx status code +func (o *AccountVerifyUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify unauthorized response has a 5xx status code +func (o *AccountVerifyUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify unauthorized response a status code equal to that given +func (o *AccountVerifyUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the account verify unauthorized response +func (o *AccountVerifyUnauthorized) Code() int { + return 401 +} + +func (o *AccountVerifyUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyUnauthorized", 401) +} + +func (o *AccountVerifyUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyUnauthorized", 401) +} + +func (o *AccountVerifyUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyNotFound creates a AccountVerifyNotFound with default headers values +func NewAccountVerifyNotFound() *AccountVerifyNotFound { + return &AccountVerifyNotFound{} +} + +/* +AccountVerifyNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AccountVerifyNotFound struct { +} + +// IsSuccess returns true when this account verify not found response has a 2xx status code +func (o *AccountVerifyNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify not found response has a 3xx status code +func (o *AccountVerifyNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify not found response has a 4xx status code +func (o *AccountVerifyNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify not found response has a 5xx status code +func (o *AccountVerifyNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify not found response a status code equal to that given +func (o *AccountVerifyNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the account verify not found response +func (o *AccountVerifyNotFound) Code() int { + return 404 +} + +func (o *AccountVerifyNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotFound", 404) +} + +func (o *AccountVerifyNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotFound", 404) +} + +func (o *AccountVerifyNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyNotAcceptable creates a AccountVerifyNotAcceptable with default headers values +func NewAccountVerifyNotAcceptable() *AccountVerifyNotAcceptable { + return &AccountVerifyNotAcceptable{} +} + +/* +AccountVerifyNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AccountVerifyNotAcceptable struct { +} + +// IsSuccess returns true when this account verify not acceptable response has a 2xx status code +func (o *AccountVerifyNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify not acceptable response has a 3xx status code +func (o *AccountVerifyNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify not acceptable response has a 4xx status code +func (o *AccountVerifyNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this account verify not acceptable response has a 5xx status code +func (o *AccountVerifyNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this account verify not acceptable response a status code equal to that given +func (o *AccountVerifyNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the account verify not acceptable response +func (o *AccountVerifyNotAcceptable) Code() int { + return 406 +} + +func (o *AccountVerifyNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotAcceptable", 406) +} + +func (o *AccountVerifyNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyNotAcceptable", 406) +} + +func (o *AccountVerifyNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAccountVerifyInternalServerError creates a AccountVerifyInternalServerError with default headers values +func NewAccountVerifyInternalServerError() *AccountVerifyInternalServerError { + return &AccountVerifyInternalServerError{} +} + +/* +AccountVerifyInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AccountVerifyInternalServerError struct { +} + +// IsSuccess returns true when this account verify internal server error response has a 2xx status code +func (o *AccountVerifyInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this account verify internal server error response has a 3xx status code +func (o *AccountVerifyInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this account verify internal server error response has a 4xx status code +func (o *AccountVerifyInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this account verify internal server error response has a 5xx status code +func (o *AccountVerifyInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this account verify internal server error response a status code equal to that given +func (o *AccountVerifyInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the account verify internal server error response +func (o *AccountVerifyInternalServerError) Code() int { + return 500 +} + +func (o *AccountVerifyInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyInternalServerError", 500) +} + +func (o *AccountVerifyInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/accounts/verify_credentials][%d] accountVerifyInternalServerError", 500) +} + +func (o *AccountVerifyInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/accounts/accounts_client.go b/client/accounts/accounts_client.go new file mode 100644 index 0000000..b57383b --- /dev/null +++ b/client/accounts/accounts_client.go @@ -0,0 +1,1129 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new accounts API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new accounts API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new accounts API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for accounts API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AccountAlias(params *AccountAliasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAliasOK, error) + + AccountAvatarDelete(params *AccountAvatarDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAvatarDeleteOK, error) + + AccountBlock(params *AccountBlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountBlockOK, error) + + AccountCreate(params *AccountCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountCreateOK, error) + + AccountDelete(params *AccountDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountDeleteAccepted, error) + + AccountFollow(params *AccountFollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowOK, error) + + AccountFollowers(params *AccountFollowersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowersOK, error) + + AccountFollowing(params *AccountFollowingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowingOK, error) + + AccountGet(params *AccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountGetOK, error) + + AccountHeaderDelete(params *AccountHeaderDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountHeaderDeleteOK, error) + + AccountLists(params *AccountListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountListsOK, error) + + AccountLookupGet(params *AccountLookupGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountLookupGetOK, error) + + AccountMove(params *AccountMoveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMoveAccepted, error) + + AccountMute(params *AccountMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMuteOK, error) + + AccountNote(params *AccountNoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountNoteOK, error) + + AccountRelationships(params *AccountRelationshipsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountRelationshipsOK, error) + + AccountSearchGet(params *AccountSearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountSearchGetOK, error) + + AccountStatuses(params *AccountStatusesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountStatusesOK, error) + + AccountThemes(params *AccountThemesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountThemesOK, error) + + AccountUnblock(params *AccountUnblockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnblockOK, error) + + AccountUnfollow(params *AccountUnfollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnfollowOK, error) + + AccountUnmute(params *AccountUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnmuteOK, error) + + AccountUpdate(params *AccountUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUpdateOK, error) + + AccountVerify(params *AccountVerifyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountVerifyOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + AccountAlias aliases your account to another account by setting also known as to the given URI + + This is useful when you want to move from another account this this account. + +In such cases, you should set the alsoKnownAs of this account to the URI of +the account you want to move from. +*/ +func (a *Client) AccountAlias(params *AccountAliasParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAliasOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountAliasParams() + } + op := &runtime.ClientOperation{ + ID: "accountAlias", + Method: "POST", + PathPattern: "/api/v1/accounts/alias", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountAliasReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountAliasOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountAlias: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountAvatarDelete deletes the authenticated account s avatar + +If the account doesn't have an avatar, the call succeeds anyway. +*/ +func (a *Client) AccountAvatarDelete(params *AccountAvatarDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountAvatarDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountAvatarDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "accountAvatarDelete", + Method: "DELETE", + PathPattern: "/api/v1/profile/avatar", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountAvatarDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountAvatarDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountAvatarDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountBlock blocks account with id +*/ +func (a *Client) AccountBlock(params *AccountBlockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountBlockOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountBlockParams() + } + op := &runtime.ClientOperation{ + ID: "accountBlock", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/block", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountBlockReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountBlockOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountBlock: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountCreate creates a new account using an application token + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) AccountCreate(params *AccountCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountCreateParams() + } + op := &runtime.ClientOperation{ + ID: "accountCreate", + Method: "POST", + PathPattern: "/api/v1/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountDelete deletes your account +*/ +func (a *Client) AccountDelete(params *AccountDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "accountDelete", + Method: "POST", + PathPattern: "/api/v1/accounts/delete", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountFollow follows account with id + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. + +If you already follow (request) the given account, then the follow (request) will be updated instead using the +`reblogs` and `notify` parameters. +*/ +func (a *Client) AccountFollow(params *AccountFollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountFollowParams() + } + op := &runtime.ClientOperation{ + ID: "accountFollow", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/follow", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountFollowReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountFollowOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountFollow: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountFollowers sees followers of account with given id + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` + +If account `hide_collections` is true, and requesting account != target account, no results will be returned. +*/ +func (a *Client) AccountFollowers(params *AccountFollowersParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowersOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountFollowersParams() + } + op := &runtime.ClientOperation{ + ID: "accountFollowers", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/followers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountFollowersReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountFollowersOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountFollowers: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AccountFollowing sees accounts followed by given account id + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` + +If account `hide_collections` is true, and requesting account != target account, no results will be returned. +*/ +func (a *Client) AccountFollowing(params *AccountFollowingParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountFollowingOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountFollowingParams() + } + op := &runtime.ClientOperation{ + ID: "accountFollowing", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/following", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountFollowingReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountFollowingOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountFollowing: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountGet gets information about an account with the given ID +*/ +func (a *Client) AccountGet(params *AccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountGetParams() + } + op := &runtime.ClientOperation{ + ID: "accountGet", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountHeaderDelete deletes the authenticated account s header + +If the account doesn't have a header, the call succeeds anyway. +*/ +func (a *Client) AccountHeaderDelete(params *AccountHeaderDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountHeaderDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountHeaderDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "accountHeaderDelete", + Method: "DELETE", + PathPattern: "/api/v1/profile/header", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountHeaderDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountHeaderDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountHeaderDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountLists sees all lists of yours that contain requested account +*/ +func (a *Client) AccountLists(params *AccountListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountListsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountListsParams() + } + op := &runtime.ClientOperation{ + ID: "accountLists", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/lists", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountListsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountListsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountLists: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountLookupGet quicklies lookup a username to see if it is available skipping web finger resolution +*/ +func (a *Client) AccountLookupGet(params *AccountLookupGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountLookupGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountLookupGetParams() + } + op := &runtime.ClientOperation{ + ID: "accountLookupGet", + Method: "GET", + PathPattern: "/api/v1/accounts/lookup", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountLookupGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountLookupGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountLookupGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountMove moves your account to another account +*/ +func (a *Client) AccountMove(params *AccountMoveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMoveAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountMoveParams() + } + op := &runtime.ClientOperation{ + ID: "accountMove", + Method: "POST", + PathPattern: "/api/v1/accounts/move", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountMoveReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountMoveAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountMove: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountMute mutes account by ID + +If account was already muted, succeeds anyway. This can be used to update the details of a mute. +*/ +func (a *Client) AccountMute(params *AccountMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountMuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountMuteParams() + } + op := &runtime.ClientOperation{ + ID: "accountMute", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/mute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountMuteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountMuteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountMute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountNote sets a private note for an account with the given id +*/ +func (a *Client) AccountNote(params *AccountNoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountNoteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountNoteParams() + } + op := &runtime.ClientOperation{ + ID: "accountNote", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/note", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountNoteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountNoteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountNote: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountRelationships sees your account s relationships with the given account i ds +*/ +func (a *Client) AccountRelationships(params *AccountRelationshipsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountRelationshipsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountRelationshipsParams() + } + op := &runtime.ClientOperation{ + ID: "accountRelationships", + Method: "GET", + PathPattern: "/api/v1/accounts/relationships", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountRelationshipsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountRelationshipsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountRelationships: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountSearchGet searches for accounts by username and or display name +*/ +func (a *Client) AccountSearchGet(params *AccountSearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountSearchGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountSearchGetParams() + } + op := &runtime.ClientOperation{ + ID: "accountSearchGet", + Method: "GET", + PathPattern: "/api/v1/accounts/search", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountSearchGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountSearchGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountSearchGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountStatuses sees statuses posted by the requested account + +The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). +*/ +func (a *Client) AccountStatuses(params *AccountStatusesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountStatusesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountStatusesParams() + } + op := &runtime.ClientOperation{ + ID: "accountStatuses", + Method: "GET", + PathPattern: "/api/v1/accounts/{id}/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountStatusesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountStatusesOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountStatuses: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountThemes sees preset CSS themes available to accounts on this instance +*/ +func (a *Client) AccountThemes(params *AccountThemesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountThemesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountThemesParams() + } + op := &runtime.ClientOperation{ + ID: "accountThemes", + Method: "GET", + PathPattern: "/api/v1/accounts/themes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountThemesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountThemesOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountThemes: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUnblock unblocks account with ID +*/ +func (a *Client) AccountUnblock(params *AccountUnblockParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnblockOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUnblockParams() + } + op := &runtime.ClientOperation{ + ID: "accountUnblock", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/unblock", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUnblockReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountUnblockOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountUnblock: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUnfollow unfollows account with id +*/ +func (a *Client) AccountUnfollow(params *AccountUnfollowParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnfollowOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUnfollowParams() + } + op := &runtime.ClientOperation{ + ID: "accountUnfollow", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/unfollow", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUnfollowReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountUnfollowOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountUnfollow: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUnmute unmutes account by ID + +If account was already unmuted (or has never been muted), succeeds anyway. +*/ +func (a *Client) AccountUnmute(params *AccountUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUnmuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUnmuteParams() + } + op := &runtime.ClientOperation{ + ID: "accountUnmute", + Method: "POST", + PathPattern: "/api/v1/accounts/{id}/unmute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUnmuteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountUnmuteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountUnmute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountUpdate updates your account +*/ +func (a *Client) AccountUpdate(params *AccountUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "accountUpdate", + Method: "PATCH", + PathPattern: "/api/v1/accounts/update_credentials", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data", "application/x-www-form-urlencoded", "application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountUpdateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AccountVerify verifies a token by returning account details pertaining to it +*/ +func (a *Client) AccountVerify(params *AccountVerifyParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AccountVerifyOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAccountVerifyParams() + } + op := &runtime.ClientOperation{ + ID: "accountVerify", + Method: "GET", + PathPattern: "/api/v1/accounts/verify_credentials", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AccountVerifyReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AccountVerifyOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for accountVerify: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/admin/admin_account_action_parameters.go b/client/admin/admin_account_action_parameters.go new file mode 100644 index 0000000..1f0b393 --- /dev/null +++ b/client/admin/admin_account_action_parameters.go @@ -0,0 +1,209 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminAccountActionParams creates a new AdminAccountActionParams 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 NewAdminAccountActionParams() *AdminAccountActionParams { + return &AdminAccountActionParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountActionParamsWithTimeout creates a new AdminAccountActionParams object +// with the ability to set a timeout on a request. +func NewAdminAccountActionParamsWithTimeout(timeout time.Duration) *AdminAccountActionParams { + return &AdminAccountActionParams{ + timeout: timeout, + } +} + +// NewAdminAccountActionParamsWithContext creates a new AdminAccountActionParams object +// with the ability to set a context for a request. +func NewAdminAccountActionParamsWithContext(ctx context.Context) *AdminAccountActionParams { + return &AdminAccountActionParams{ + Context: ctx, + } +} + +// NewAdminAccountActionParamsWithHTTPClient creates a new AdminAccountActionParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountActionParamsWithHTTPClient(client *http.Client) *AdminAccountActionParams { + return &AdminAccountActionParams{ + HTTPClient: client, + } +} + +/* +AdminAccountActionParams contains all the parameters to send to the API endpoint + + for the admin account action operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountActionParams struct { + + /* ID. + + ID of the account. + */ + ID string + + /* Text. + + Optional text describing why this action was taken. + */ + Text *string + + /* Type. + + Type of action to be taken, currently only supports `suspend`. + */ + Type string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account action params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountActionParams) WithDefaults() *AdminAccountActionParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account action params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountActionParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account action params +func (o *AdminAccountActionParams) WithTimeout(timeout time.Duration) *AdminAccountActionParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account action params +func (o *AdminAccountActionParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account action params +func (o *AdminAccountActionParams) WithContext(ctx context.Context) *AdminAccountActionParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account action params +func (o *AdminAccountActionParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account action params +func (o *AdminAccountActionParams) WithHTTPClient(client *http.Client) *AdminAccountActionParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account action params +func (o *AdminAccountActionParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account action params +func (o *AdminAccountActionParams) WithID(id string) *AdminAccountActionParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account action params +func (o *AdminAccountActionParams) SetID(id string) { + o.ID = id +} + +// WithText adds the text to the admin account action params +func (o *AdminAccountActionParams) WithText(text *string) *AdminAccountActionParams { + o.SetText(text) + return o +} + +// SetText adds the text to the admin account action params +func (o *AdminAccountActionParams) SetText(text *string) { + o.Text = text +} + +// WithType adds the typeVar to the admin account action params +func (o *AdminAccountActionParams) WithType(typeVar string) *AdminAccountActionParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the admin account action params +func (o *AdminAccountActionParams) SetType(typeVar string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountActionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Text != nil { + + // form param text + var frText string + if o.Text != nil { + frText = *o.Text + } + fText := frText + if fText != "" { + if err := r.SetFormParam("text", fText); err != nil { + return err + } + } + } + + // form param type + frType := o.Type + fType := frType + if fType != "" { + if err := r.SetFormParam("type", fType); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_account_action_responses.go b/client/admin/admin_account_action_responses.go new file mode 100644 index 0000000..5a60333 --- /dev/null +++ b/client/admin/admin_account_action_responses.go @@ -0,0 +1,522 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// AdminAccountActionReader is a Reader for the AdminAccountAction structure. +type AdminAccountActionReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountActionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountActionOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountActionBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountActionUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountActionForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountActionNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountActionNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewAdminAccountActionConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountActionInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/accounts/{id}/action] adminAccountAction", response, response.Code()) + } +} + +// NewAdminAccountActionOK creates a AdminAccountActionOK with default headers values +func NewAdminAccountActionOK() *AdminAccountActionOK { + return &AdminAccountActionOK{} +} + +/* +AdminAccountActionOK describes a response with status code 200, with default header values. + +OK +*/ +type AdminAccountActionOK struct { +} + +// IsSuccess returns true when this admin account action o k response has a 2xx status code +func (o *AdminAccountActionOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account action o k response has a 3xx status code +func (o *AdminAccountActionOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action o k response has a 4xx status code +func (o *AdminAccountActionOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account action o k response has a 5xx status code +func (o *AdminAccountActionOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action o k response a status code equal to that given +func (o *AdminAccountActionOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account action o k response +func (o *AdminAccountActionOK) Code() int { + return 200 +} + +func (o *AdminAccountActionOK) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionOK", 200) +} + +func (o *AdminAccountActionOK) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionOK", 200) +} + +func (o *AdminAccountActionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionBadRequest creates a AdminAccountActionBadRequest with default headers values +func NewAdminAccountActionBadRequest() *AdminAccountActionBadRequest { + return &AdminAccountActionBadRequest{} +} + +/* +AdminAccountActionBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountActionBadRequest struct { +} + +// IsSuccess returns true when this admin account action bad request response has a 2xx status code +func (o *AdminAccountActionBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action bad request response has a 3xx status code +func (o *AdminAccountActionBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action bad request response has a 4xx status code +func (o *AdminAccountActionBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action bad request response has a 5xx status code +func (o *AdminAccountActionBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action bad request response a status code equal to that given +func (o *AdminAccountActionBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account action bad request response +func (o *AdminAccountActionBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountActionBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionBadRequest", 400) +} + +func (o *AdminAccountActionBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionBadRequest", 400) +} + +func (o *AdminAccountActionBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionUnauthorized creates a AdminAccountActionUnauthorized with default headers values +func NewAdminAccountActionUnauthorized() *AdminAccountActionUnauthorized { + return &AdminAccountActionUnauthorized{} +} + +/* +AdminAccountActionUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountActionUnauthorized struct { +} + +// IsSuccess returns true when this admin account action unauthorized response has a 2xx status code +func (o *AdminAccountActionUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action unauthorized response has a 3xx status code +func (o *AdminAccountActionUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action unauthorized response has a 4xx status code +func (o *AdminAccountActionUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action unauthorized response has a 5xx status code +func (o *AdminAccountActionUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action unauthorized response a status code equal to that given +func (o *AdminAccountActionUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account action unauthorized response +func (o *AdminAccountActionUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountActionUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionUnauthorized", 401) +} + +func (o *AdminAccountActionUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionUnauthorized", 401) +} + +func (o *AdminAccountActionUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionForbidden creates a AdminAccountActionForbidden with default headers values +func NewAdminAccountActionForbidden() *AdminAccountActionForbidden { + return &AdminAccountActionForbidden{} +} + +/* +AdminAccountActionForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountActionForbidden struct { +} + +// IsSuccess returns true when this admin account action forbidden response has a 2xx status code +func (o *AdminAccountActionForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action forbidden response has a 3xx status code +func (o *AdminAccountActionForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action forbidden response has a 4xx status code +func (o *AdminAccountActionForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action forbidden response has a 5xx status code +func (o *AdminAccountActionForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action forbidden response a status code equal to that given +func (o *AdminAccountActionForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account action forbidden response +func (o *AdminAccountActionForbidden) Code() int { + return 403 +} + +func (o *AdminAccountActionForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionForbidden", 403) +} + +func (o *AdminAccountActionForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionForbidden", 403) +} + +func (o *AdminAccountActionForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionNotFound creates a AdminAccountActionNotFound with default headers values +func NewAdminAccountActionNotFound() *AdminAccountActionNotFound { + return &AdminAccountActionNotFound{} +} + +/* +AdminAccountActionNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountActionNotFound struct { +} + +// IsSuccess returns true when this admin account action not found response has a 2xx status code +func (o *AdminAccountActionNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action not found response has a 3xx status code +func (o *AdminAccountActionNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action not found response has a 4xx status code +func (o *AdminAccountActionNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action not found response has a 5xx status code +func (o *AdminAccountActionNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action not found response a status code equal to that given +func (o *AdminAccountActionNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account action not found response +func (o *AdminAccountActionNotFound) Code() int { + return 404 +} + +func (o *AdminAccountActionNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotFound", 404) +} + +func (o *AdminAccountActionNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotFound", 404) +} + +func (o *AdminAccountActionNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionNotAcceptable creates a AdminAccountActionNotAcceptable with default headers values +func NewAdminAccountActionNotAcceptable() *AdminAccountActionNotAcceptable { + return &AdminAccountActionNotAcceptable{} +} + +/* +AdminAccountActionNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountActionNotAcceptable struct { +} + +// IsSuccess returns true when this admin account action not acceptable response has a 2xx status code +func (o *AdminAccountActionNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action not acceptable response has a 3xx status code +func (o *AdminAccountActionNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action not acceptable response has a 4xx status code +func (o *AdminAccountActionNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action not acceptable response has a 5xx status code +func (o *AdminAccountActionNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action not acceptable response a status code equal to that given +func (o *AdminAccountActionNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account action not acceptable response +func (o *AdminAccountActionNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountActionNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotAcceptable", 406) +} + +func (o *AdminAccountActionNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionNotAcceptable", 406) +} + +func (o *AdminAccountActionNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionConflict creates a AdminAccountActionConflict with default headers values +func NewAdminAccountActionConflict() *AdminAccountActionConflict { + return &AdminAccountActionConflict{} +} + +/* +AdminAccountActionConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type AdminAccountActionConflict struct { +} + +// IsSuccess returns true when this admin account action conflict response has a 2xx status code +func (o *AdminAccountActionConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action conflict response has a 3xx status code +func (o *AdminAccountActionConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action conflict response has a 4xx status code +func (o *AdminAccountActionConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account action conflict response has a 5xx status code +func (o *AdminAccountActionConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account action conflict response a status code equal to that given +func (o *AdminAccountActionConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the admin account action conflict response +func (o *AdminAccountActionConflict) Code() int { + return 409 +} + +func (o *AdminAccountActionConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionConflict", 409) +} + +func (o *AdminAccountActionConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionConflict", 409) +} + +func (o *AdminAccountActionConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountActionInternalServerError creates a AdminAccountActionInternalServerError with default headers values +func NewAdminAccountActionInternalServerError() *AdminAccountActionInternalServerError { + return &AdminAccountActionInternalServerError{} +} + +/* +AdminAccountActionInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountActionInternalServerError struct { +} + +// IsSuccess returns true when this admin account action internal server error response has a 2xx status code +func (o *AdminAccountActionInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account action internal server error response has a 3xx status code +func (o *AdminAccountActionInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account action internal server error response has a 4xx status code +func (o *AdminAccountActionInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account action internal server error response has a 5xx status code +func (o *AdminAccountActionInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account action internal server error response a status code equal to that given +func (o *AdminAccountActionInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account action internal server error response +func (o *AdminAccountActionInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountActionInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionInternalServerError", 500) +} + +func (o *AdminAccountActionInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/action][%d] adminAccountActionInternalServerError", 500) +} + +func (o *AdminAccountActionInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_account_approve_parameters.go b/client/admin/admin_account_approve_parameters.go new file mode 100644 index 0000000..4da97e6 --- /dev/null +++ b/client/admin/admin_account_approve_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminAccountApproveParams creates a new AdminAccountApproveParams 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 NewAdminAccountApproveParams() *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountApproveParamsWithTimeout creates a new AdminAccountApproveParams object +// with the ability to set a timeout on a request. +func NewAdminAccountApproveParamsWithTimeout(timeout time.Duration) *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + timeout: timeout, + } +} + +// NewAdminAccountApproveParamsWithContext creates a new AdminAccountApproveParams object +// with the ability to set a context for a request. +func NewAdminAccountApproveParamsWithContext(ctx context.Context) *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + Context: ctx, + } +} + +// NewAdminAccountApproveParamsWithHTTPClient creates a new AdminAccountApproveParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountApproveParamsWithHTTPClient(client *http.Client) *AdminAccountApproveParams { + return &AdminAccountApproveParams{ + HTTPClient: client, + } +} + +/* +AdminAccountApproveParams contains all the parameters to send to the API endpoint + + for the admin account approve operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountApproveParams struct { + + /* ID. + + ID of the account. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account approve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountApproveParams) WithDefaults() *AdminAccountApproveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account approve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountApproveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account approve params +func (o *AdminAccountApproveParams) WithTimeout(timeout time.Duration) *AdminAccountApproveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account approve params +func (o *AdminAccountApproveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account approve params +func (o *AdminAccountApproveParams) WithContext(ctx context.Context) *AdminAccountApproveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account approve params +func (o *AdminAccountApproveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account approve params +func (o *AdminAccountApproveParams) WithHTTPClient(client *http.Client) *AdminAccountApproveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account approve params +func (o *AdminAccountApproveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account approve params +func (o *AdminAccountApproveParams) WithID(id string) *AdminAccountApproveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account approve params +func (o *AdminAccountApproveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountApproveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_account_approve_responses.go b/client/admin/admin_account_approve_responses.go new file mode 100644 index 0000000..9b7b7af --- /dev/null +++ b/client/admin/admin_account_approve_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountApproveReader is a Reader for the AdminAccountApprove structure. +type AdminAccountApproveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountApproveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountApproveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountApproveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountApproveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountApproveForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountApproveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountApproveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountApproveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/accounts/{id}/approve] adminAccountApprove", response, response.Code()) + } +} + +// NewAdminAccountApproveOK creates a AdminAccountApproveOK with default headers values +func NewAdminAccountApproveOK() *AdminAccountApproveOK { + return &AdminAccountApproveOK{} +} + +/* +AdminAccountApproveOK describes a response with status code 200, with default header values. + +The now-approved account. +*/ +type AdminAccountApproveOK struct { + Payload *models.AdminAccountInfo +} + +// IsSuccess returns true when this admin account approve o k response has a 2xx status code +func (o *AdminAccountApproveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account approve o k response has a 3xx status code +func (o *AdminAccountApproveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve o k response has a 4xx status code +func (o *AdminAccountApproveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account approve o k response has a 5xx status code +func (o *AdminAccountApproveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve o k response a status code equal to that given +func (o *AdminAccountApproveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account approve o k response +func (o *AdminAccountApproveOK) Code() int { + return 200 +} + +func (o *AdminAccountApproveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveOK %s", 200, payload) +} + +func (o *AdminAccountApproveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveOK %s", 200, payload) +} + +func (o *AdminAccountApproveOK) GetPayload() *models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountApproveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminAccountInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountApproveBadRequest creates a AdminAccountApproveBadRequest with default headers values +func NewAdminAccountApproveBadRequest() *AdminAccountApproveBadRequest { + return &AdminAccountApproveBadRequest{} +} + +/* +AdminAccountApproveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountApproveBadRequest struct { +} + +// IsSuccess returns true when this admin account approve bad request response has a 2xx status code +func (o *AdminAccountApproveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve bad request response has a 3xx status code +func (o *AdminAccountApproveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve bad request response has a 4xx status code +func (o *AdminAccountApproveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve bad request response has a 5xx status code +func (o *AdminAccountApproveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve bad request response a status code equal to that given +func (o *AdminAccountApproveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account approve bad request response +func (o *AdminAccountApproveBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountApproveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveBadRequest", 400) +} + +func (o *AdminAccountApproveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveBadRequest", 400) +} + +func (o *AdminAccountApproveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveUnauthorized creates a AdminAccountApproveUnauthorized with default headers values +func NewAdminAccountApproveUnauthorized() *AdminAccountApproveUnauthorized { + return &AdminAccountApproveUnauthorized{} +} + +/* +AdminAccountApproveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountApproveUnauthorized struct { +} + +// IsSuccess returns true when this admin account approve unauthorized response has a 2xx status code +func (o *AdminAccountApproveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve unauthorized response has a 3xx status code +func (o *AdminAccountApproveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve unauthorized response has a 4xx status code +func (o *AdminAccountApproveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve unauthorized response has a 5xx status code +func (o *AdminAccountApproveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve unauthorized response a status code equal to that given +func (o *AdminAccountApproveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account approve unauthorized response +func (o *AdminAccountApproveUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountApproveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveUnauthorized", 401) +} + +func (o *AdminAccountApproveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveUnauthorized", 401) +} + +func (o *AdminAccountApproveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveForbidden creates a AdminAccountApproveForbidden with default headers values +func NewAdminAccountApproveForbidden() *AdminAccountApproveForbidden { + return &AdminAccountApproveForbidden{} +} + +/* +AdminAccountApproveForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountApproveForbidden struct { +} + +// IsSuccess returns true when this admin account approve forbidden response has a 2xx status code +func (o *AdminAccountApproveForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve forbidden response has a 3xx status code +func (o *AdminAccountApproveForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve forbidden response has a 4xx status code +func (o *AdminAccountApproveForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve forbidden response has a 5xx status code +func (o *AdminAccountApproveForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve forbidden response a status code equal to that given +func (o *AdminAccountApproveForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account approve forbidden response +func (o *AdminAccountApproveForbidden) Code() int { + return 403 +} + +func (o *AdminAccountApproveForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveForbidden", 403) +} + +func (o *AdminAccountApproveForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveForbidden", 403) +} + +func (o *AdminAccountApproveForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveNotFound creates a AdminAccountApproveNotFound with default headers values +func NewAdminAccountApproveNotFound() *AdminAccountApproveNotFound { + return &AdminAccountApproveNotFound{} +} + +/* +AdminAccountApproveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountApproveNotFound struct { +} + +// IsSuccess returns true when this admin account approve not found response has a 2xx status code +func (o *AdminAccountApproveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve not found response has a 3xx status code +func (o *AdminAccountApproveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve not found response has a 4xx status code +func (o *AdminAccountApproveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve not found response has a 5xx status code +func (o *AdminAccountApproveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve not found response a status code equal to that given +func (o *AdminAccountApproveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account approve not found response +func (o *AdminAccountApproveNotFound) Code() int { + return 404 +} + +func (o *AdminAccountApproveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotFound", 404) +} + +func (o *AdminAccountApproveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotFound", 404) +} + +func (o *AdminAccountApproveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveNotAcceptable creates a AdminAccountApproveNotAcceptable with default headers values +func NewAdminAccountApproveNotAcceptable() *AdminAccountApproveNotAcceptable { + return &AdminAccountApproveNotAcceptable{} +} + +/* +AdminAccountApproveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountApproveNotAcceptable struct { +} + +// IsSuccess returns true when this admin account approve not acceptable response has a 2xx status code +func (o *AdminAccountApproveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve not acceptable response has a 3xx status code +func (o *AdminAccountApproveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve not acceptable response has a 4xx status code +func (o *AdminAccountApproveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account approve not acceptable response has a 5xx status code +func (o *AdminAccountApproveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account approve not acceptable response a status code equal to that given +func (o *AdminAccountApproveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account approve not acceptable response +func (o *AdminAccountApproveNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountApproveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotAcceptable", 406) +} + +func (o *AdminAccountApproveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveNotAcceptable", 406) +} + +func (o *AdminAccountApproveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountApproveInternalServerError creates a AdminAccountApproveInternalServerError with default headers values +func NewAdminAccountApproveInternalServerError() *AdminAccountApproveInternalServerError { + return &AdminAccountApproveInternalServerError{} +} + +/* +AdminAccountApproveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountApproveInternalServerError struct { +} + +// IsSuccess returns true when this admin account approve internal server error response has a 2xx status code +func (o *AdminAccountApproveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account approve internal server error response has a 3xx status code +func (o *AdminAccountApproveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account approve internal server error response has a 4xx status code +func (o *AdminAccountApproveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account approve internal server error response has a 5xx status code +func (o *AdminAccountApproveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account approve internal server error response a status code equal to that given +func (o *AdminAccountApproveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account approve internal server error response +func (o *AdminAccountApproveInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountApproveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveInternalServerError", 500) +} + +func (o *AdminAccountApproveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/approve][%d] adminAccountApproveInternalServerError", 500) +} + +func (o *AdminAccountApproveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_account_get_parameters.go b/client/admin/admin_account_get_parameters.go new file mode 100644 index 0000000..6280c0f --- /dev/null +++ b/client/admin/admin_account_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminAccountGetParams creates a new AdminAccountGetParams 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 NewAdminAccountGetParams() *AdminAccountGetParams { + return &AdminAccountGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountGetParamsWithTimeout creates a new AdminAccountGetParams object +// with the ability to set a timeout on a request. +func NewAdminAccountGetParamsWithTimeout(timeout time.Duration) *AdminAccountGetParams { + return &AdminAccountGetParams{ + timeout: timeout, + } +} + +// NewAdminAccountGetParamsWithContext creates a new AdminAccountGetParams object +// with the ability to set a context for a request. +func NewAdminAccountGetParamsWithContext(ctx context.Context) *AdminAccountGetParams { + return &AdminAccountGetParams{ + Context: ctx, + } +} + +// NewAdminAccountGetParamsWithHTTPClient creates a new AdminAccountGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountGetParamsWithHTTPClient(client *http.Client) *AdminAccountGetParams { + return &AdminAccountGetParams{ + HTTPClient: client, + } +} + +/* +AdminAccountGetParams contains all the parameters to send to the API endpoint + + for the admin account get operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountGetParams struct { + + /* ID. + + ID of the account. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountGetParams) WithDefaults() *AdminAccountGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account get params +func (o *AdminAccountGetParams) WithTimeout(timeout time.Duration) *AdminAccountGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account get params +func (o *AdminAccountGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account get params +func (o *AdminAccountGetParams) WithContext(ctx context.Context) *AdminAccountGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account get params +func (o *AdminAccountGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account get params +func (o *AdminAccountGetParams) WithHTTPClient(client *http.Client) *AdminAccountGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account get params +func (o *AdminAccountGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account get params +func (o *AdminAccountGetParams) WithID(id string) *AdminAccountGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account get params +func (o *AdminAccountGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_account_get_responses.go b/client/admin/admin_account_get_responses.go new file mode 100644 index 0000000..4d44c03 --- /dev/null +++ b/client/admin/admin_account_get_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountGetReader is a Reader for the AdminAccountGet structure. +type AdminAccountGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/accounts/{id}] adminAccountGet", response, response.Code()) + } +} + +// NewAdminAccountGetOK creates a AdminAccountGetOK with default headers values +func NewAdminAccountGetOK() *AdminAccountGetOK { + return &AdminAccountGetOK{} +} + +/* +AdminAccountGetOK describes a response with status code 200, with default header values. + +OK +*/ +type AdminAccountGetOK struct { + Payload *models.AdminAccountInfo +} + +// IsSuccess returns true when this admin account get o k response has a 2xx status code +func (o *AdminAccountGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account get o k response has a 3xx status code +func (o *AdminAccountGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get o k response has a 4xx status code +func (o *AdminAccountGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account get o k response has a 5xx status code +func (o *AdminAccountGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get o k response a status code equal to that given +func (o *AdminAccountGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account get o k response +func (o *AdminAccountGetOK) Code() int { + return 200 +} + +func (o *AdminAccountGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetOK %s", 200, payload) +} + +func (o *AdminAccountGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetOK %s", 200, payload) +} + +func (o *AdminAccountGetOK) GetPayload() *models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminAccountInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountGetBadRequest creates a AdminAccountGetBadRequest with default headers values +func NewAdminAccountGetBadRequest() *AdminAccountGetBadRequest { + return &AdminAccountGetBadRequest{} +} + +/* +AdminAccountGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountGetBadRequest struct { +} + +// IsSuccess returns true when this admin account get bad request response has a 2xx status code +func (o *AdminAccountGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get bad request response has a 3xx status code +func (o *AdminAccountGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get bad request response has a 4xx status code +func (o *AdminAccountGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get bad request response has a 5xx status code +func (o *AdminAccountGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get bad request response a status code equal to that given +func (o *AdminAccountGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account get bad request response +func (o *AdminAccountGetBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetBadRequest", 400) +} + +func (o *AdminAccountGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetBadRequest", 400) +} + +func (o *AdminAccountGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetUnauthorized creates a AdminAccountGetUnauthorized with default headers values +func NewAdminAccountGetUnauthorized() *AdminAccountGetUnauthorized { + return &AdminAccountGetUnauthorized{} +} + +/* +AdminAccountGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountGetUnauthorized struct { +} + +// IsSuccess returns true when this admin account get unauthorized response has a 2xx status code +func (o *AdminAccountGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get unauthorized response has a 3xx status code +func (o *AdminAccountGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get unauthorized response has a 4xx status code +func (o *AdminAccountGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get unauthorized response has a 5xx status code +func (o *AdminAccountGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get unauthorized response a status code equal to that given +func (o *AdminAccountGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account get unauthorized response +func (o *AdminAccountGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetUnauthorized", 401) +} + +func (o *AdminAccountGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetUnauthorized", 401) +} + +func (o *AdminAccountGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetForbidden creates a AdminAccountGetForbidden with default headers values +func NewAdminAccountGetForbidden() *AdminAccountGetForbidden { + return &AdminAccountGetForbidden{} +} + +/* +AdminAccountGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountGetForbidden struct { +} + +// IsSuccess returns true when this admin account get forbidden response has a 2xx status code +func (o *AdminAccountGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get forbidden response has a 3xx status code +func (o *AdminAccountGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get forbidden response has a 4xx status code +func (o *AdminAccountGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get forbidden response has a 5xx status code +func (o *AdminAccountGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get forbidden response a status code equal to that given +func (o *AdminAccountGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account get forbidden response +func (o *AdminAccountGetForbidden) Code() int { + return 403 +} + +func (o *AdminAccountGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetForbidden", 403) +} + +func (o *AdminAccountGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetForbidden", 403) +} + +func (o *AdminAccountGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetNotFound creates a AdminAccountGetNotFound with default headers values +func NewAdminAccountGetNotFound() *AdminAccountGetNotFound { + return &AdminAccountGetNotFound{} +} + +/* +AdminAccountGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountGetNotFound struct { +} + +// IsSuccess returns true when this admin account get not found response has a 2xx status code +func (o *AdminAccountGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get not found response has a 3xx status code +func (o *AdminAccountGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get not found response has a 4xx status code +func (o *AdminAccountGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get not found response has a 5xx status code +func (o *AdminAccountGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get not found response a status code equal to that given +func (o *AdminAccountGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account get not found response +func (o *AdminAccountGetNotFound) Code() int { + return 404 +} + +func (o *AdminAccountGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotFound", 404) +} + +func (o *AdminAccountGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotFound", 404) +} + +func (o *AdminAccountGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetNotAcceptable creates a AdminAccountGetNotAcceptable with default headers values +func NewAdminAccountGetNotAcceptable() *AdminAccountGetNotAcceptable { + return &AdminAccountGetNotAcceptable{} +} + +/* +AdminAccountGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountGetNotAcceptable struct { +} + +// IsSuccess returns true when this admin account get not acceptable response has a 2xx status code +func (o *AdminAccountGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get not acceptable response has a 3xx status code +func (o *AdminAccountGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get not acceptable response has a 4xx status code +func (o *AdminAccountGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account get not acceptable response has a 5xx status code +func (o *AdminAccountGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account get not acceptable response a status code equal to that given +func (o *AdminAccountGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account get not acceptable response +func (o *AdminAccountGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotAcceptable", 406) +} + +func (o *AdminAccountGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetNotAcceptable", 406) +} + +func (o *AdminAccountGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountGetInternalServerError creates a AdminAccountGetInternalServerError with default headers values +func NewAdminAccountGetInternalServerError() *AdminAccountGetInternalServerError { + return &AdminAccountGetInternalServerError{} +} + +/* +AdminAccountGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountGetInternalServerError struct { +} + +// IsSuccess returns true when this admin account get internal server error response has a 2xx status code +func (o *AdminAccountGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account get internal server error response has a 3xx status code +func (o *AdminAccountGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account get internal server error response has a 4xx status code +func (o *AdminAccountGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account get internal server error response has a 5xx status code +func (o *AdminAccountGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account get internal server error response a status code equal to that given +func (o *AdminAccountGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account get internal server error response +func (o *AdminAccountGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetInternalServerError", 500) +} + +func (o *AdminAccountGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts/{id}][%d] adminAccountGetInternalServerError", 500) +} + +func (o *AdminAccountGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_account_reject_parameters.go b/client/admin/admin_account_reject_parameters.go new file mode 100644 index 0000000..b11b362 --- /dev/null +++ b/client/admin/admin_account_reject_parameters.go @@ -0,0 +1,248 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminAccountRejectParams creates a new AdminAccountRejectParams 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 NewAdminAccountRejectParams() *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountRejectParamsWithTimeout creates a new AdminAccountRejectParams object +// with the ability to set a timeout on a request. +func NewAdminAccountRejectParamsWithTimeout(timeout time.Duration) *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + timeout: timeout, + } +} + +// NewAdminAccountRejectParamsWithContext creates a new AdminAccountRejectParams object +// with the ability to set a context for a request. +func NewAdminAccountRejectParamsWithContext(ctx context.Context) *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + Context: ctx, + } +} + +// NewAdminAccountRejectParamsWithHTTPClient creates a new AdminAccountRejectParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountRejectParamsWithHTTPClient(client *http.Client) *AdminAccountRejectParams { + return &AdminAccountRejectParams{ + HTTPClient: client, + } +} + +/* +AdminAccountRejectParams contains all the parameters to send to the API endpoint + + for the admin account reject operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountRejectParams struct { + + /* ID. + + ID of the account. + */ + ID string + + /* Message. + + Message to include in email to applicant. Will be included only if send_email is true. + */ + Message *string + + /* PrivateComment. + + Comment to leave on why the account was denied. The comment will be visible to admins only. + */ + PrivateComment *string + + /* SendEmail. + + Send an email to the applicant informing them that their sign-up has been rejected. + */ + SendEmail *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin account reject params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountRejectParams) WithDefaults() *AdminAccountRejectParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin account reject params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountRejectParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin account reject params +func (o *AdminAccountRejectParams) WithTimeout(timeout time.Duration) *AdminAccountRejectParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin account reject params +func (o *AdminAccountRejectParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin account reject params +func (o *AdminAccountRejectParams) WithContext(ctx context.Context) *AdminAccountRejectParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin account reject params +func (o *AdminAccountRejectParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin account reject params +func (o *AdminAccountRejectParams) WithHTTPClient(client *http.Client) *AdminAccountRejectParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin account reject params +func (o *AdminAccountRejectParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin account reject params +func (o *AdminAccountRejectParams) WithID(id string) *AdminAccountRejectParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin account reject params +func (o *AdminAccountRejectParams) SetID(id string) { + o.ID = id +} + +// WithMessage adds the message to the admin account reject params +func (o *AdminAccountRejectParams) WithMessage(message *string) *AdminAccountRejectParams { + o.SetMessage(message) + return o +} + +// SetMessage adds the message to the admin account reject params +func (o *AdminAccountRejectParams) SetMessage(message *string) { + o.Message = message +} + +// WithPrivateComment adds the privateComment to the admin account reject params +func (o *AdminAccountRejectParams) WithPrivateComment(privateComment *string) *AdminAccountRejectParams { + o.SetPrivateComment(privateComment) + return o +} + +// SetPrivateComment adds the privateComment to the admin account reject params +func (o *AdminAccountRejectParams) SetPrivateComment(privateComment *string) { + o.PrivateComment = privateComment +} + +// WithSendEmail adds the sendEmail to the admin account reject params +func (o *AdminAccountRejectParams) WithSendEmail(sendEmail *bool) *AdminAccountRejectParams { + o.SetSendEmail(sendEmail) + return o +} + +// SetSendEmail adds the sendEmail to the admin account reject params +func (o *AdminAccountRejectParams) SetSendEmail(sendEmail *bool) { + o.SendEmail = sendEmail +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountRejectParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Message != nil { + + // form param message + var frMessage string + if o.Message != nil { + frMessage = *o.Message + } + fMessage := frMessage + if fMessage != "" { + if err := r.SetFormParam("message", fMessage); err != nil { + return err + } + } + } + + if o.PrivateComment != nil { + + // form param private_comment + var frPrivateComment string + if o.PrivateComment != nil { + frPrivateComment = *o.PrivateComment + } + fPrivateComment := frPrivateComment + if fPrivateComment != "" { + if err := r.SetFormParam("private_comment", fPrivateComment); err != nil { + return err + } + } + } + + if o.SendEmail != nil { + + // form param send_email + var frSendEmail bool + if o.SendEmail != nil { + frSendEmail = *o.SendEmail + } + fSendEmail := swag.FormatBool(frSendEmail) + if fSendEmail != "" { + if err := r.SetFormParam("send_email", fSendEmail); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_account_reject_responses.go b/client/admin/admin_account_reject_responses.go new file mode 100644 index 0000000..aef9591 --- /dev/null +++ b/client/admin/admin_account_reject_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountRejectReader is a Reader for the AdminAccountReject structure. +type AdminAccountRejectReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountRejectReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountRejectOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountRejectBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountRejectUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountRejectForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountRejectNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountRejectNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountRejectInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/accounts/{id}/reject] adminAccountReject", response, response.Code()) + } +} + +// NewAdminAccountRejectOK creates a AdminAccountRejectOK with default headers values +func NewAdminAccountRejectOK() *AdminAccountRejectOK { + return &AdminAccountRejectOK{} +} + +/* +AdminAccountRejectOK describes a response with status code 200, with default header values. + +The now-rejected account. +*/ +type AdminAccountRejectOK struct { + Payload *models.AdminAccountInfo +} + +// IsSuccess returns true when this admin account reject o k response has a 2xx status code +func (o *AdminAccountRejectOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin account reject o k response has a 3xx status code +func (o *AdminAccountRejectOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject o k response has a 4xx status code +func (o *AdminAccountRejectOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account reject o k response has a 5xx status code +func (o *AdminAccountRejectOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject o k response a status code equal to that given +func (o *AdminAccountRejectOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin account reject o k response +func (o *AdminAccountRejectOK) Code() int { + return 200 +} + +func (o *AdminAccountRejectOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectOK %s", 200, payload) +} + +func (o *AdminAccountRejectOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectOK %s", 200, payload) +} + +func (o *AdminAccountRejectOK) GetPayload() *models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountRejectOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminAccountInfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountRejectBadRequest creates a AdminAccountRejectBadRequest with default headers values +func NewAdminAccountRejectBadRequest() *AdminAccountRejectBadRequest { + return &AdminAccountRejectBadRequest{} +} + +/* +AdminAccountRejectBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountRejectBadRequest struct { +} + +// IsSuccess returns true when this admin account reject bad request response has a 2xx status code +func (o *AdminAccountRejectBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject bad request response has a 3xx status code +func (o *AdminAccountRejectBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject bad request response has a 4xx status code +func (o *AdminAccountRejectBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject bad request response has a 5xx status code +func (o *AdminAccountRejectBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject bad request response a status code equal to that given +func (o *AdminAccountRejectBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin account reject bad request response +func (o *AdminAccountRejectBadRequest) Code() int { + return 400 +} + +func (o *AdminAccountRejectBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectBadRequest", 400) +} + +func (o *AdminAccountRejectBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectBadRequest", 400) +} + +func (o *AdminAccountRejectBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectUnauthorized creates a AdminAccountRejectUnauthorized with default headers values +func NewAdminAccountRejectUnauthorized() *AdminAccountRejectUnauthorized { + return &AdminAccountRejectUnauthorized{} +} + +/* +AdminAccountRejectUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountRejectUnauthorized struct { +} + +// IsSuccess returns true when this admin account reject unauthorized response has a 2xx status code +func (o *AdminAccountRejectUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject unauthorized response has a 3xx status code +func (o *AdminAccountRejectUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject unauthorized response has a 4xx status code +func (o *AdminAccountRejectUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject unauthorized response has a 5xx status code +func (o *AdminAccountRejectUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject unauthorized response a status code equal to that given +func (o *AdminAccountRejectUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin account reject unauthorized response +func (o *AdminAccountRejectUnauthorized) Code() int { + return 401 +} + +func (o *AdminAccountRejectUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectUnauthorized", 401) +} + +func (o *AdminAccountRejectUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectUnauthorized", 401) +} + +func (o *AdminAccountRejectUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectForbidden creates a AdminAccountRejectForbidden with default headers values +func NewAdminAccountRejectForbidden() *AdminAccountRejectForbidden { + return &AdminAccountRejectForbidden{} +} + +/* +AdminAccountRejectForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountRejectForbidden struct { +} + +// IsSuccess returns true when this admin account reject forbidden response has a 2xx status code +func (o *AdminAccountRejectForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject forbidden response has a 3xx status code +func (o *AdminAccountRejectForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject forbidden response has a 4xx status code +func (o *AdminAccountRejectForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject forbidden response has a 5xx status code +func (o *AdminAccountRejectForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject forbidden response a status code equal to that given +func (o *AdminAccountRejectForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin account reject forbidden response +func (o *AdminAccountRejectForbidden) Code() int { + return 403 +} + +func (o *AdminAccountRejectForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectForbidden", 403) +} + +func (o *AdminAccountRejectForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectForbidden", 403) +} + +func (o *AdminAccountRejectForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectNotFound creates a AdminAccountRejectNotFound with default headers values +func NewAdminAccountRejectNotFound() *AdminAccountRejectNotFound { + return &AdminAccountRejectNotFound{} +} + +/* +AdminAccountRejectNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountRejectNotFound struct { +} + +// IsSuccess returns true when this admin account reject not found response has a 2xx status code +func (o *AdminAccountRejectNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject not found response has a 3xx status code +func (o *AdminAccountRejectNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject not found response has a 4xx status code +func (o *AdminAccountRejectNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject not found response has a 5xx status code +func (o *AdminAccountRejectNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject not found response a status code equal to that given +func (o *AdminAccountRejectNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin account reject not found response +func (o *AdminAccountRejectNotFound) Code() int { + return 404 +} + +func (o *AdminAccountRejectNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotFound", 404) +} + +func (o *AdminAccountRejectNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotFound", 404) +} + +func (o *AdminAccountRejectNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectNotAcceptable creates a AdminAccountRejectNotAcceptable with default headers values +func NewAdminAccountRejectNotAcceptable() *AdminAccountRejectNotAcceptable { + return &AdminAccountRejectNotAcceptable{} +} + +/* +AdminAccountRejectNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountRejectNotAcceptable struct { +} + +// IsSuccess returns true when this admin account reject not acceptable response has a 2xx status code +func (o *AdminAccountRejectNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject not acceptable response has a 3xx status code +func (o *AdminAccountRejectNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject not acceptable response has a 4xx status code +func (o *AdminAccountRejectNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin account reject not acceptable response has a 5xx status code +func (o *AdminAccountRejectNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin account reject not acceptable response a status code equal to that given +func (o *AdminAccountRejectNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin account reject not acceptable response +func (o *AdminAccountRejectNotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountRejectNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotAcceptable", 406) +} + +func (o *AdminAccountRejectNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectNotAcceptable", 406) +} + +func (o *AdminAccountRejectNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountRejectInternalServerError creates a AdminAccountRejectInternalServerError with default headers values +func NewAdminAccountRejectInternalServerError() *AdminAccountRejectInternalServerError { + return &AdminAccountRejectInternalServerError{} +} + +/* +AdminAccountRejectInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountRejectInternalServerError struct { +} + +// IsSuccess returns true when this admin account reject internal server error response has a 2xx status code +func (o *AdminAccountRejectInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin account reject internal server error response has a 3xx status code +func (o *AdminAccountRejectInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin account reject internal server error response has a 4xx status code +func (o *AdminAccountRejectInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin account reject internal server error response has a 5xx status code +func (o *AdminAccountRejectInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin account reject internal server error response a status code equal to that given +func (o *AdminAccountRejectInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin account reject internal server error response +func (o *AdminAccountRejectInternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountRejectInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectInternalServerError", 500) +} + +func (o *AdminAccountRejectInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/accounts/{id}/reject][%d] adminAccountRejectInternalServerError", 500) +} + +func (o *AdminAccountRejectInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_accounts_get_v1_parameters.go b/client/admin/admin_accounts_get_v1_parameters.go new file mode 100644 index 0000000..6abafcf --- /dev/null +++ b/client/admin/admin_accounts_get_v1_parameters.go @@ -0,0 +1,748 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminAccountsGetV1Params creates a new AdminAccountsGetV1Params 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 NewAdminAccountsGetV1Params() *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountsGetV1ParamsWithTimeout creates a new AdminAccountsGetV1Params object +// with the ability to set a timeout on a request. +func NewAdminAccountsGetV1ParamsWithTimeout(timeout time.Duration) *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + timeout: timeout, + } +} + +// NewAdminAccountsGetV1ParamsWithContext creates a new AdminAccountsGetV1Params object +// with the ability to set a context for a request. +func NewAdminAccountsGetV1ParamsWithContext(ctx context.Context) *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + Context: ctx, + } +} + +// NewAdminAccountsGetV1ParamsWithHTTPClient creates a new AdminAccountsGetV1Params object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountsGetV1ParamsWithHTTPClient(client *http.Client) *AdminAccountsGetV1Params { + return &AdminAccountsGetV1Params{ + HTTPClient: client, + } +} + +/* +AdminAccountsGetV1Params contains all the parameters to send to the API endpoint + + for the admin accounts get v1 operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountsGetV1Params struct { + + /* Active. + + Filter for currently active accounts. + */ + Active *bool + + /* ByDomain. + + Filter by the given domain. + */ + ByDomain *string + + /* Disabled. + + Filter for currently disabled accounts. + */ + Disabled *bool + + /* DisplayName. + + Search for the given display name. + */ + DisplayName *string + + /* Email. + + Lookup a user with this email. + */ + Email *string + + /* IP. + + Lookup users with this IP address. + */ + IP *string + + /* Limit. + + Maximum number of results to return. + + Default: 50 + */ + Limit *int64 + + /* Local. + + Filter for local accounts. + */ + Local *bool + + /* MaxID. + + max_id in the form `[domain]/@[username]`. All results returned will be later in the alphabet than `[domain]/@[username]`. For example, if max_id = `example.org/@someone` then returned entries might contain `example.org/@someone_else`, `later.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MaxID *string + + /* MinID. + + min_id in the form `[domain]/@[username]`. All results returned will be earlier in the alphabet than `[domain]/@[username]`. For example, if min_id = `example.org/@someone` then returned entries might contain `example.org/@earlier_account`, `earlier.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MinID *string + + /* Pending. + + Filter for currently pending accounts. + */ + Pending *bool + + /* Remote. + + Filter for remote accounts. + */ + Remote *bool + + /* Sensitized. + + Filter for accounts force-marked as sensitive. + */ + Sensitized *bool + + /* Silenced. + + Filter for currently silenced accounts. + */ + Silenced *bool + + /* Staff. + + Filter for staff accounts. + */ + Staff *bool + + /* Suspended. + + Filter for currently suspended accounts. + */ + Suspended *bool + + /* Username. + + Search for the given username. + */ + Username *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin accounts get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV1Params) WithDefaults() *AdminAccountsGetV1Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin accounts get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV1Params) SetDefaults() { + var ( + activeDefault = bool(false) + + disabledDefault = bool(false) + + limitDefault = int64(50) + + localDefault = bool(false) + + pendingDefault = bool(false) + + remoteDefault = bool(false) + + sensitizedDefault = bool(false) + + silencedDefault = bool(false) + + staffDefault = bool(false) + + suspendedDefault = bool(false) + ) + + val := AdminAccountsGetV1Params{ + Active: &activeDefault, + Disabled: &disabledDefault, + Limit: &limitDefault, + Local: &localDefault, + Pending: &pendingDefault, + Remote: &remoteDefault, + Sensitized: &sensitizedDefault, + Silenced: &silencedDefault, + Staff: &staffDefault, + Suspended: &suspendedDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithTimeout(timeout time.Duration) *AdminAccountsGetV1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithContext(ctx context.Context) *AdminAccountsGetV1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithHTTPClient(client *http.Client) *AdminAccountsGetV1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithActive adds the active to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithActive(active *bool) *AdminAccountsGetV1Params { + o.SetActive(active) + return o +} + +// SetActive adds the active to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetActive(active *bool) { + o.Active = active +} + +// WithByDomain adds the byDomain to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithByDomain(byDomain *string) *AdminAccountsGetV1Params { + o.SetByDomain(byDomain) + return o +} + +// SetByDomain adds the byDomain to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetByDomain(byDomain *string) { + o.ByDomain = byDomain +} + +// WithDisabled adds the disabled to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithDisabled(disabled *bool) *AdminAccountsGetV1Params { + o.SetDisabled(disabled) + return o +} + +// SetDisabled adds the disabled to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetDisabled(disabled *bool) { + o.Disabled = disabled +} + +// WithDisplayName adds the displayName to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithDisplayName(displayName *string) *AdminAccountsGetV1Params { + o.SetDisplayName(displayName) + return o +} + +// SetDisplayName adds the displayName to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetDisplayName(displayName *string) { + o.DisplayName = displayName +} + +// WithEmail adds the email to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithEmail(email *string) *AdminAccountsGetV1Params { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetEmail(email *string) { + o.Email = email +} + +// WithIP adds the ip to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithIP(ip *string) *AdminAccountsGetV1Params { + o.SetIP(ip) + return o +} + +// SetIP adds the ip to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetIP(ip *string) { + o.IP = ip +} + +// WithLimit adds the limit to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithLimit(limit *int64) *AdminAccountsGetV1Params { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithLocal adds the local to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithLocal(local *bool) *AdminAccountsGetV1Params { + o.SetLocal(local) + return o +} + +// SetLocal adds the local to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetLocal(local *bool) { + o.Local = local +} + +// WithMaxID adds the maxID to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithMaxID(maxID *string) *AdminAccountsGetV1Params { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithMinID(minID *string) *AdminAccountsGetV1Params { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetMinID(minID *string) { + o.MinID = minID +} + +// WithPending adds the pending to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithPending(pending *bool) *AdminAccountsGetV1Params { + o.SetPending(pending) + return o +} + +// SetPending adds the pending to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetPending(pending *bool) { + o.Pending = pending +} + +// WithRemote adds the remote to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithRemote(remote *bool) *AdminAccountsGetV1Params { + o.SetRemote(remote) + return o +} + +// SetRemote adds the remote to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetRemote(remote *bool) { + o.Remote = remote +} + +// WithSensitized adds the sensitized to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithSensitized(sensitized *bool) *AdminAccountsGetV1Params { + o.SetSensitized(sensitized) + return o +} + +// SetSensitized adds the sensitized to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetSensitized(sensitized *bool) { + o.Sensitized = sensitized +} + +// WithSilenced adds the silenced to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithSilenced(silenced *bool) *AdminAccountsGetV1Params { + o.SetSilenced(silenced) + return o +} + +// SetSilenced adds the silenced to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetSilenced(silenced *bool) { + o.Silenced = silenced +} + +// WithStaff adds the staff to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithStaff(staff *bool) *AdminAccountsGetV1Params { + o.SetStaff(staff) + return o +} + +// SetStaff adds the staff to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetStaff(staff *bool) { + o.Staff = staff +} + +// WithSuspended adds the suspended to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithSuspended(suspended *bool) *AdminAccountsGetV1Params { + o.SetSuspended(suspended) + return o +} + +// SetSuspended adds the suspended to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetSuspended(suspended *bool) { + o.Suspended = suspended +} + +// WithUsername adds the username to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) WithUsername(username *string) *AdminAccountsGetV1Params { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the admin accounts get v1 params +func (o *AdminAccountsGetV1Params) SetUsername(username *string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountsGetV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Active != nil { + + // query param active + var qrActive bool + + if o.Active != nil { + qrActive = *o.Active + } + qActive := swag.FormatBool(qrActive) + if qActive != "" { + + if err := r.SetQueryParam("active", qActive); err != nil { + return err + } + } + } + + if o.ByDomain != nil { + + // query param by_domain + var qrByDomain string + + if o.ByDomain != nil { + qrByDomain = *o.ByDomain + } + qByDomain := qrByDomain + if qByDomain != "" { + + if err := r.SetQueryParam("by_domain", qByDomain); err != nil { + return err + } + } + } + + if o.Disabled != nil { + + // query param disabled + var qrDisabled bool + + if o.Disabled != nil { + qrDisabled = *o.Disabled + } + qDisabled := swag.FormatBool(qrDisabled) + if qDisabled != "" { + + if err := r.SetQueryParam("disabled", qDisabled); err != nil { + return err + } + } + } + + if o.DisplayName != nil { + + // query param display_name + var qrDisplayName string + + if o.DisplayName != nil { + qrDisplayName = *o.DisplayName + } + qDisplayName := qrDisplayName + if qDisplayName != "" { + + if err := r.SetQueryParam("display_name", qDisplayName); err != nil { + return err + } + } + } + + if o.Email != nil { + + // query param email + var qrEmail string + + if o.Email != nil { + qrEmail = *o.Email + } + qEmail := qrEmail + if qEmail != "" { + + if err := r.SetQueryParam("email", qEmail); err != nil { + return err + } + } + } + + if o.IP != nil { + + // query param ip + var qrIP string + + if o.IP != nil { + qrIP = *o.IP + } + qIP := qrIP + if qIP != "" { + + if err := r.SetQueryParam("ip", qIP); err != nil { + return err + } + } + } + + 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.Pending != nil { + + // query param pending + var qrPending bool + + if o.Pending != nil { + qrPending = *o.Pending + } + qPending := swag.FormatBool(qrPending) + if qPending != "" { + + if err := r.SetQueryParam("pending", qPending); err != nil { + return err + } + } + } + + if o.Remote != nil { + + // query param remote + var qrRemote bool + + if o.Remote != nil { + qrRemote = *o.Remote + } + qRemote := swag.FormatBool(qrRemote) + if qRemote != "" { + + if err := r.SetQueryParam("remote", qRemote); err != nil { + return err + } + } + } + + if o.Sensitized != nil { + + // query param sensitized + var qrSensitized bool + + if o.Sensitized != nil { + qrSensitized = *o.Sensitized + } + qSensitized := swag.FormatBool(qrSensitized) + if qSensitized != "" { + + if err := r.SetQueryParam("sensitized", qSensitized); err != nil { + return err + } + } + } + + if o.Silenced != nil { + + // query param silenced + var qrSilenced bool + + if o.Silenced != nil { + qrSilenced = *o.Silenced + } + qSilenced := swag.FormatBool(qrSilenced) + if qSilenced != "" { + + if err := r.SetQueryParam("silenced", qSilenced); err != nil { + return err + } + } + } + + if o.Staff != nil { + + // query param staff + var qrStaff bool + + if o.Staff != nil { + qrStaff = *o.Staff + } + qStaff := swag.FormatBool(qrStaff) + if qStaff != "" { + + if err := r.SetQueryParam("staff", qStaff); err != nil { + return err + } + } + } + + if o.Suspended != nil { + + // query param suspended + var qrSuspended bool + + if o.Suspended != nil { + qrSuspended = *o.Suspended + } + qSuspended := swag.FormatBool(qrSuspended) + if qSuspended != "" { + + if err := r.SetQueryParam("suspended", qSuspended); err != nil { + return err + } + } + } + + if o.Username != nil { + + // query param username + var qrUsername string + + if o.Username != nil { + qrUsername = *o.Username + } + qUsername := qrUsername + if qUsername != "" { + + if err := r.SetQueryParam("username", qUsername); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_accounts_get_v1_responses.go b/client/admin/admin_accounts_get_v1_responses.go new file mode 100644 index 0000000..129ee70 --- /dev/null +++ b/client/admin/admin_accounts_get_v1_responses.go @@ -0,0 +1,488 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountsGetV1Reader is a Reader for the AdminAccountsGetV1 structure. +type AdminAccountsGetV1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountsGetV1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountsGetV1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountsGetV1BadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountsGetV1Unauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountsGetV1Forbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountsGetV1NotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountsGetV1NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountsGetV1InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/accounts] adminAccountsGetV1", response, response.Code()) + } +} + +// NewAdminAccountsGetV1OK creates a AdminAccountsGetV1OK with default headers values +func NewAdminAccountsGetV1OK() *AdminAccountsGetV1OK { + return &AdminAccountsGetV1OK{} +} + +/* +AdminAccountsGetV1OK describes a response with status code 200, with default header values. + +AdminAccountsGetV1OK admin accounts get v1 o k +*/ +type AdminAccountsGetV1OK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminAccountInfo +} + +// IsSuccess returns true when this admin accounts get v1 o k response has a 2xx status code +func (o *AdminAccountsGetV1OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin accounts get v1 o k response has a 3xx status code +func (o *AdminAccountsGetV1OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 o k response has a 4xx status code +func (o *AdminAccountsGetV1OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v1 o k response has a 5xx status code +func (o *AdminAccountsGetV1OK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 o k response a status code equal to that given +func (o *AdminAccountsGetV1OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin accounts get v1 o k response +func (o *AdminAccountsGetV1OK) Code() int { + return 200 +} + +func (o *AdminAccountsGetV1OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1OK %s", 200, payload) +} + +func (o *AdminAccountsGetV1OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1OK %s", 200, payload) +} + +func (o *AdminAccountsGetV1OK) GetPayload() []*models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountsGetV1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountsGetV1BadRequest creates a AdminAccountsGetV1BadRequest with default headers values +func NewAdminAccountsGetV1BadRequest() *AdminAccountsGetV1BadRequest { + return &AdminAccountsGetV1BadRequest{} +} + +/* +AdminAccountsGetV1BadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountsGetV1BadRequest struct { +} + +// IsSuccess returns true when this admin accounts get v1 bad request response has a 2xx status code +func (o *AdminAccountsGetV1BadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 bad request response has a 3xx status code +func (o *AdminAccountsGetV1BadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 bad request response has a 4xx status code +func (o *AdminAccountsGetV1BadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 bad request response has a 5xx status code +func (o *AdminAccountsGetV1BadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 bad request response a status code equal to that given +func (o *AdminAccountsGetV1BadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin accounts get v1 bad request response +func (o *AdminAccountsGetV1BadRequest) Code() int { + return 400 +} + +func (o *AdminAccountsGetV1BadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1BadRequest", 400) +} + +func (o *AdminAccountsGetV1BadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1BadRequest", 400) +} + +func (o *AdminAccountsGetV1BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1Unauthorized creates a AdminAccountsGetV1Unauthorized with default headers values +func NewAdminAccountsGetV1Unauthorized() *AdminAccountsGetV1Unauthorized { + return &AdminAccountsGetV1Unauthorized{} +} + +/* +AdminAccountsGetV1Unauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountsGetV1Unauthorized struct { +} + +// IsSuccess returns true when this admin accounts get v1 unauthorized response has a 2xx status code +func (o *AdminAccountsGetV1Unauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 unauthorized response has a 3xx status code +func (o *AdminAccountsGetV1Unauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 unauthorized response has a 4xx status code +func (o *AdminAccountsGetV1Unauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 unauthorized response has a 5xx status code +func (o *AdminAccountsGetV1Unauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 unauthorized response a status code equal to that given +func (o *AdminAccountsGetV1Unauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin accounts get v1 unauthorized response +func (o *AdminAccountsGetV1Unauthorized) Code() int { + return 401 +} + +func (o *AdminAccountsGetV1Unauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Unauthorized", 401) +} + +func (o *AdminAccountsGetV1Unauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Unauthorized", 401) +} + +func (o *AdminAccountsGetV1Unauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1Forbidden creates a AdminAccountsGetV1Forbidden with default headers values +func NewAdminAccountsGetV1Forbidden() *AdminAccountsGetV1Forbidden { + return &AdminAccountsGetV1Forbidden{} +} + +/* +AdminAccountsGetV1Forbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountsGetV1Forbidden struct { +} + +// IsSuccess returns true when this admin accounts get v1 forbidden response has a 2xx status code +func (o *AdminAccountsGetV1Forbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 forbidden response has a 3xx status code +func (o *AdminAccountsGetV1Forbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 forbidden response has a 4xx status code +func (o *AdminAccountsGetV1Forbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 forbidden response has a 5xx status code +func (o *AdminAccountsGetV1Forbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 forbidden response a status code equal to that given +func (o *AdminAccountsGetV1Forbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin accounts get v1 forbidden response +func (o *AdminAccountsGetV1Forbidden) Code() int { + return 403 +} + +func (o *AdminAccountsGetV1Forbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Forbidden", 403) +} + +func (o *AdminAccountsGetV1Forbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1Forbidden", 403) +} + +func (o *AdminAccountsGetV1Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1NotFound creates a AdminAccountsGetV1NotFound with default headers values +func NewAdminAccountsGetV1NotFound() *AdminAccountsGetV1NotFound { + return &AdminAccountsGetV1NotFound{} +} + +/* +AdminAccountsGetV1NotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountsGetV1NotFound struct { +} + +// IsSuccess returns true when this admin accounts get v1 not found response has a 2xx status code +func (o *AdminAccountsGetV1NotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 not found response has a 3xx status code +func (o *AdminAccountsGetV1NotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 not found response has a 4xx status code +func (o *AdminAccountsGetV1NotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 not found response has a 5xx status code +func (o *AdminAccountsGetV1NotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 not found response a status code equal to that given +func (o *AdminAccountsGetV1NotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin accounts get v1 not found response +func (o *AdminAccountsGetV1NotFound) Code() int { + return 404 +} + +func (o *AdminAccountsGetV1NotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotFound", 404) +} + +func (o *AdminAccountsGetV1NotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotFound", 404) +} + +func (o *AdminAccountsGetV1NotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1NotAcceptable creates a AdminAccountsGetV1NotAcceptable with default headers values +func NewAdminAccountsGetV1NotAcceptable() *AdminAccountsGetV1NotAcceptable { + return &AdminAccountsGetV1NotAcceptable{} +} + +/* +AdminAccountsGetV1NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountsGetV1NotAcceptable struct { +} + +// IsSuccess returns true when this admin accounts get v1 not acceptable response has a 2xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 not acceptable response has a 3xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 not acceptable response has a 4xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v1 not acceptable response has a 5xx status code +func (o *AdminAccountsGetV1NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v1 not acceptable response a status code equal to that given +func (o *AdminAccountsGetV1NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin accounts get v1 not acceptable response +func (o *AdminAccountsGetV1NotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountsGetV1NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotAcceptable", 406) +} + +func (o *AdminAccountsGetV1NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1NotAcceptable", 406) +} + +func (o *AdminAccountsGetV1NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV1InternalServerError creates a AdminAccountsGetV1InternalServerError with default headers values +func NewAdminAccountsGetV1InternalServerError() *AdminAccountsGetV1InternalServerError { + return &AdminAccountsGetV1InternalServerError{} +} + +/* +AdminAccountsGetV1InternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountsGetV1InternalServerError struct { +} + +// IsSuccess returns true when this admin accounts get v1 internal server error response has a 2xx status code +func (o *AdminAccountsGetV1InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v1 internal server error response has a 3xx status code +func (o *AdminAccountsGetV1InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v1 internal server error response has a 4xx status code +func (o *AdminAccountsGetV1InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v1 internal server error response has a 5xx status code +func (o *AdminAccountsGetV1InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin accounts get v1 internal server error response a status code equal to that given +func (o *AdminAccountsGetV1InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin accounts get v1 internal server error response +func (o *AdminAccountsGetV1InternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountsGetV1InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1InternalServerError", 500) +} + +func (o *AdminAccountsGetV1InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/accounts][%d] adminAccountsGetV1InternalServerError", 500) +} + +func (o *AdminAccountsGetV1InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_accounts_get_v2_parameters.go b/client/admin/admin_accounts_get_v2_parameters.go new file mode 100644 index 0000000..7b77a05 --- /dev/null +++ b/client/admin/admin_accounts_get_v2_parameters.go @@ -0,0 +1,596 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminAccountsGetV2Params creates a new AdminAccountsGetV2Params 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 NewAdminAccountsGetV2Params() *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminAccountsGetV2ParamsWithTimeout creates a new AdminAccountsGetV2Params object +// with the ability to set a timeout on a request. +func NewAdminAccountsGetV2ParamsWithTimeout(timeout time.Duration) *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + timeout: timeout, + } +} + +// NewAdminAccountsGetV2ParamsWithContext creates a new AdminAccountsGetV2Params object +// with the ability to set a context for a request. +func NewAdminAccountsGetV2ParamsWithContext(ctx context.Context) *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + Context: ctx, + } +} + +// NewAdminAccountsGetV2ParamsWithHTTPClient creates a new AdminAccountsGetV2Params object +// with the ability to set a custom HTTPClient for a request. +func NewAdminAccountsGetV2ParamsWithHTTPClient(client *http.Client) *AdminAccountsGetV2Params { + return &AdminAccountsGetV2Params{ + HTTPClient: client, + } +} + +/* +AdminAccountsGetV2Params contains all the parameters to send to the API endpoint + + for the admin accounts get v2 operation. + + Typically these are written to a http.Request. +*/ +type AdminAccountsGetV2Params struct { + + /* ByDomain. + + Filter by the given domain. + */ + ByDomain *string + + /* DisplayName. + + Search for the given display name. + */ + DisplayName *string + + /* Email. + + Lookup a user with this email. + */ + Email *string + + /* InvitedBy. + + Lookup users invited by the account with this ID. + */ + InvitedBy *string + + /* IP. + + Lookup users with this IP address. + */ + IP *string + + /* Limit. + + Maximum number of results to return. + + Default: 50 + */ + Limit *int64 + + /* MaxID. + + max_id in the form `[domain]/@[username]`. All results returned will be later in the alphabet than `[domain]/@[username]`. For example, if max_id = `example.org/@someone` then returned entries might contain `example.org/@someone_else`, `later.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MaxID *string + + /* MinID. + + min_id in the form `[domain]/@[username]`. All results returned will be earlier in the alphabet than `[domain]/@[username]`. For example, if min_id = `example.org/@someone` then returned entries might contain `example.org/@earlier_account`, `earlier.example.org/@someone`, etc. Local account IDs in this form use an empty string for the `[domain]` part, for example local account with username `someone` would be `/@someone`. + */ + MinID *string + + /* Origin. + + Filter for `local` or `remote` accounts. + */ + Origin *string + + /* Permissions. + + Filter for accounts with staff permissions (users that can manage reports). + */ + Permissions *string + + /* RoleIds. + + Filter for users with these roles. + */ + RoleIds []string + + /* Status. + + Filter for `active`, `pending`, `disabled`, `silenced`, or `suspended` accounts. + */ + Status *string + + /* Username. + + Search for the given username. + */ + Username *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin accounts get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV2Params) WithDefaults() *AdminAccountsGetV2Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin accounts get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminAccountsGetV2Params) SetDefaults() { + var ( + limitDefault = int64(50) + ) + + val := AdminAccountsGetV2Params{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithTimeout(timeout time.Duration) *AdminAccountsGetV2Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithContext(ctx context.Context) *AdminAccountsGetV2Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithHTTPClient(client *http.Client) *AdminAccountsGetV2Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithByDomain adds the byDomain to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithByDomain(byDomain *string) *AdminAccountsGetV2Params { + o.SetByDomain(byDomain) + return o +} + +// SetByDomain adds the byDomain to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetByDomain(byDomain *string) { + o.ByDomain = byDomain +} + +// WithDisplayName adds the displayName to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithDisplayName(displayName *string) *AdminAccountsGetV2Params { + o.SetDisplayName(displayName) + return o +} + +// SetDisplayName adds the displayName to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetDisplayName(displayName *string) { + o.DisplayName = displayName +} + +// WithEmail adds the email to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithEmail(email *string) *AdminAccountsGetV2Params { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetEmail(email *string) { + o.Email = email +} + +// WithInvitedBy adds the invitedBy to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithInvitedBy(invitedBy *string) *AdminAccountsGetV2Params { + o.SetInvitedBy(invitedBy) + return o +} + +// SetInvitedBy adds the invitedBy to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetInvitedBy(invitedBy *string) { + o.InvitedBy = invitedBy +} + +// WithIP adds the ip to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithIP(ip *string) *AdminAccountsGetV2Params { + o.SetIP(ip) + return o +} + +// SetIP adds the ip to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetIP(ip *string) { + o.IP = ip +} + +// WithLimit adds the limit to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithLimit(limit *int64) *AdminAccountsGetV2Params { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithMaxID(maxID *string) *AdminAccountsGetV2Params { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithMinID(minID *string) *AdminAccountsGetV2Params { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOrigin adds the origin to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithOrigin(origin *string) *AdminAccountsGetV2Params { + o.SetOrigin(origin) + return o +} + +// SetOrigin adds the origin to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetOrigin(origin *string) { + o.Origin = origin +} + +// WithPermissions adds the permissions to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithPermissions(permissions *string) *AdminAccountsGetV2Params { + o.SetPermissions(permissions) + return o +} + +// SetPermissions adds the permissions to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetPermissions(permissions *string) { + o.Permissions = permissions +} + +// WithRoleIds adds the roleIds to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithRoleIds(roleIds []string) *AdminAccountsGetV2Params { + o.SetRoleIds(roleIds) + return o +} + +// SetRoleIds adds the roleIds to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetRoleIds(roleIds []string) { + o.RoleIds = roleIds +} + +// WithStatus adds the status to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithStatus(status *string) *AdminAccountsGetV2Params { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetStatus(status *string) { + o.Status = status +} + +// WithUsername adds the username to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) WithUsername(username *string) *AdminAccountsGetV2Params { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the admin accounts get v2 params +func (o *AdminAccountsGetV2Params) SetUsername(username *string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminAccountsGetV2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ByDomain != nil { + + // query param by_domain + var qrByDomain string + + if o.ByDomain != nil { + qrByDomain = *o.ByDomain + } + qByDomain := qrByDomain + if qByDomain != "" { + + if err := r.SetQueryParam("by_domain", qByDomain); err != nil { + return err + } + } + } + + if o.DisplayName != nil { + + // query param display_name + var qrDisplayName string + + if o.DisplayName != nil { + qrDisplayName = *o.DisplayName + } + qDisplayName := qrDisplayName + if qDisplayName != "" { + + if err := r.SetQueryParam("display_name", qDisplayName); err != nil { + return err + } + } + } + + if o.Email != nil { + + // query param email + var qrEmail string + + if o.Email != nil { + qrEmail = *o.Email + } + qEmail := qrEmail + if qEmail != "" { + + if err := r.SetQueryParam("email", qEmail); err != nil { + return err + } + } + } + + if o.InvitedBy != nil { + + // query param invited_by + var qrInvitedBy string + + if o.InvitedBy != nil { + qrInvitedBy = *o.InvitedBy + } + qInvitedBy := qrInvitedBy + if qInvitedBy != "" { + + if err := r.SetQueryParam("invited_by", qInvitedBy); err != nil { + return err + } + } + } + + if o.IP != nil { + + // query param ip + var qrIP string + + if o.IP != nil { + qrIP = *o.IP + } + qIP := qrIP + if qIP != "" { + + if err := r.SetQueryParam("ip", qIP); err != nil { + return err + } + } + } + + 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.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.Origin != nil { + + // query param origin + var qrOrigin string + + if o.Origin != nil { + qrOrigin = *o.Origin + } + qOrigin := qrOrigin + if qOrigin != "" { + + if err := r.SetQueryParam("origin", qOrigin); err != nil { + return err + } + } + } + + if o.Permissions != nil { + + // query param permissions + var qrPermissions string + + if o.Permissions != nil { + qrPermissions = *o.Permissions + } + qPermissions := qrPermissions + if qPermissions != "" { + + if err := r.SetQueryParam("permissions", qPermissions); err != nil { + return err + } + } + } + + if o.RoleIds != nil { + + // binding items for role_ids[] + joinedRoleIds := o.bindParamRoleIds(reg) + + // query array param role_ids[] + if err := r.SetQueryParam("role_ids[]", joinedRoleIds...); err != nil { + return err + } + } + + if o.Status != nil { + + // query param status + var qrStatus string + + if o.Status != nil { + qrStatus = *o.Status + } + qStatus := qrStatus + if qStatus != "" { + + if err := r.SetQueryParam("status", qStatus); err != nil { + return err + } + } + } + + if o.Username != nil { + + // query param username + var qrUsername string + + if o.Username != nil { + qrUsername = *o.Username + } + qUsername := qrUsername + if qUsername != "" { + + if err := r.SetQueryParam("username", qUsername); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamAdminAccountsGetV2 binds the parameter role_ids[] +func (o *AdminAccountsGetV2Params) bindParamRoleIds(formats strfmt.Registry) []string { + roleIdsIR := o.RoleIds + + var roleIdsIC []string + for _, roleIdsIIR := range roleIdsIR { // explode []string + + roleIdsIIV := roleIdsIIR // string as string + roleIdsIC = append(roleIdsIC, roleIdsIIV) + } + + // items.CollectionFormat: "" + roleIdsIS := swag.JoinByFormat(roleIdsIC, "") + + return roleIdsIS +} diff --git a/client/admin/admin_accounts_get_v2_responses.go b/client/admin/admin_accounts_get_v2_responses.go new file mode 100644 index 0000000..5796499 --- /dev/null +++ b/client/admin/admin_accounts_get_v2_responses.go @@ -0,0 +1,488 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminAccountsGetV2Reader is a Reader for the AdminAccountsGetV2 structure. +type AdminAccountsGetV2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminAccountsGetV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminAccountsGetV2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminAccountsGetV2BadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminAccountsGetV2Unauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAdminAccountsGetV2Forbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminAccountsGetV2NotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminAccountsGetV2NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminAccountsGetV2InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/admin/accounts] adminAccountsGetV2", response, response.Code()) + } +} + +// NewAdminAccountsGetV2OK creates a AdminAccountsGetV2OK with default headers values +func NewAdminAccountsGetV2OK() *AdminAccountsGetV2OK { + return &AdminAccountsGetV2OK{} +} + +/* +AdminAccountsGetV2OK describes a response with status code 200, with default header values. + +AdminAccountsGetV2OK admin accounts get v2 o k +*/ +type AdminAccountsGetV2OK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminAccountInfo +} + +// IsSuccess returns true when this admin accounts get v2 o k response has a 2xx status code +func (o *AdminAccountsGetV2OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin accounts get v2 o k response has a 3xx status code +func (o *AdminAccountsGetV2OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 o k response has a 4xx status code +func (o *AdminAccountsGetV2OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v2 o k response has a 5xx status code +func (o *AdminAccountsGetV2OK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 o k response a status code equal to that given +func (o *AdminAccountsGetV2OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin accounts get v2 o k response +func (o *AdminAccountsGetV2OK) Code() int { + return 200 +} + +func (o *AdminAccountsGetV2OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2OK %s", 200, payload) +} + +func (o *AdminAccountsGetV2OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2OK %s", 200, payload) +} + +func (o *AdminAccountsGetV2OK) GetPayload() []*models.AdminAccountInfo { + return o.Payload +} + +func (o *AdminAccountsGetV2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminAccountsGetV2BadRequest creates a AdminAccountsGetV2BadRequest with default headers values +func NewAdminAccountsGetV2BadRequest() *AdminAccountsGetV2BadRequest { + return &AdminAccountsGetV2BadRequest{} +} + +/* +AdminAccountsGetV2BadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminAccountsGetV2BadRequest struct { +} + +// IsSuccess returns true when this admin accounts get v2 bad request response has a 2xx status code +func (o *AdminAccountsGetV2BadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 bad request response has a 3xx status code +func (o *AdminAccountsGetV2BadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 bad request response has a 4xx status code +func (o *AdminAccountsGetV2BadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 bad request response has a 5xx status code +func (o *AdminAccountsGetV2BadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 bad request response a status code equal to that given +func (o *AdminAccountsGetV2BadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin accounts get v2 bad request response +func (o *AdminAccountsGetV2BadRequest) Code() int { + return 400 +} + +func (o *AdminAccountsGetV2BadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2BadRequest", 400) +} + +func (o *AdminAccountsGetV2BadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2BadRequest", 400) +} + +func (o *AdminAccountsGetV2BadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2Unauthorized creates a AdminAccountsGetV2Unauthorized with default headers values +func NewAdminAccountsGetV2Unauthorized() *AdminAccountsGetV2Unauthorized { + return &AdminAccountsGetV2Unauthorized{} +} + +/* +AdminAccountsGetV2Unauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminAccountsGetV2Unauthorized struct { +} + +// IsSuccess returns true when this admin accounts get v2 unauthorized response has a 2xx status code +func (o *AdminAccountsGetV2Unauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 unauthorized response has a 3xx status code +func (o *AdminAccountsGetV2Unauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 unauthorized response has a 4xx status code +func (o *AdminAccountsGetV2Unauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 unauthorized response has a 5xx status code +func (o *AdminAccountsGetV2Unauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 unauthorized response a status code equal to that given +func (o *AdminAccountsGetV2Unauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin accounts get v2 unauthorized response +func (o *AdminAccountsGetV2Unauthorized) Code() int { + return 401 +} + +func (o *AdminAccountsGetV2Unauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Unauthorized", 401) +} + +func (o *AdminAccountsGetV2Unauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Unauthorized", 401) +} + +func (o *AdminAccountsGetV2Unauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2Forbidden creates a AdminAccountsGetV2Forbidden with default headers values +func NewAdminAccountsGetV2Forbidden() *AdminAccountsGetV2Forbidden { + return &AdminAccountsGetV2Forbidden{} +} + +/* +AdminAccountsGetV2Forbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AdminAccountsGetV2Forbidden struct { +} + +// IsSuccess returns true when this admin accounts get v2 forbidden response has a 2xx status code +func (o *AdminAccountsGetV2Forbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 forbidden response has a 3xx status code +func (o *AdminAccountsGetV2Forbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 forbidden response has a 4xx status code +func (o *AdminAccountsGetV2Forbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 forbidden response has a 5xx status code +func (o *AdminAccountsGetV2Forbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 forbidden response a status code equal to that given +func (o *AdminAccountsGetV2Forbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the admin accounts get v2 forbidden response +func (o *AdminAccountsGetV2Forbidden) Code() int { + return 403 +} + +func (o *AdminAccountsGetV2Forbidden) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Forbidden", 403) +} + +func (o *AdminAccountsGetV2Forbidden) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2Forbidden", 403) +} + +func (o *AdminAccountsGetV2Forbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2NotFound creates a AdminAccountsGetV2NotFound with default headers values +func NewAdminAccountsGetV2NotFound() *AdminAccountsGetV2NotFound { + return &AdminAccountsGetV2NotFound{} +} + +/* +AdminAccountsGetV2NotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminAccountsGetV2NotFound struct { +} + +// IsSuccess returns true when this admin accounts get v2 not found response has a 2xx status code +func (o *AdminAccountsGetV2NotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 not found response has a 3xx status code +func (o *AdminAccountsGetV2NotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 not found response has a 4xx status code +func (o *AdminAccountsGetV2NotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 not found response has a 5xx status code +func (o *AdminAccountsGetV2NotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 not found response a status code equal to that given +func (o *AdminAccountsGetV2NotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin accounts get v2 not found response +func (o *AdminAccountsGetV2NotFound) Code() int { + return 404 +} + +func (o *AdminAccountsGetV2NotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotFound", 404) +} + +func (o *AdminAccountsGetV2NotFound) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotFound", 404) +} + +func (o *AdminAccountsGetV2NotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2NotAcceptable creates a AdminAccountsGetV2NotAcceptable with default headers values +func NewAdminAccountsGetV2NotAcceptable() *AdminAccountsGetV2NotAcceptable { + return &AdminAccountsGetV2NotAcceptable{} +} + +/* +AdminAccountsGetV2NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminAccountsGetV2NotAcceptable struct { +} + +// IsSuccess returns true when this admin accounts get v2 not acceptable response has a 2xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 not acceptable response has a 3xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 not acceptable response has a 4xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin accounts get v2 not acceptable response has a 5xx status code +func (o *AdminAccountsGetV2NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin accounts get v2 not acceptable response a status code equal to that given +func (o *AdminAccountsGetV2NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin accounts get v2 not acceptable response +func (o *AdminAccountsGetV2NotAcceptable) Code() int { + return 406 +} + +func (o *AdminAccountsGetV2NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotAcceptable", 406) +} + +func (o *AdminAccountsGetV2NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2NotAcceptable", 406) +} + +func (o *AdminAccountsGetV2NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminAccountsGetV2InternalServerError creates a AdminAccountsGetV2InternalServerError with default headers values +func NewAdminAccountsGetV2InternalServerError() *AdminAccountsGetV2InternalServerError { + return &AdminAccountsGetV2InternalServerError{} +} + +/* +AdminAccountsGetV2InternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminAccountsGetV2InternalServerError struct { +} + +// IsSuccess returns true when this admin accounts get v2 internal server error response has a 2xx status code +func (o *AdminAccountsGetV2InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin accounts get v2 internal server error response has a 3xx status code +func (o *AdminAccountsGetV2InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin accounts get v2 internal server error response has a 4xx status code +func (o *AdminAccountsGetV2InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin accounts get v2 internal server error response has a 5xx status code +func (o *AdminAccountsGetV2InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin accounts get v2 internal server error response a status code equal to that given +func (o *AdminAccountsGetV2InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin accounts get v2 internal server error response +func (o *AdminAccountsGetV2InternalServerError) Code() int { + return 500 +} + +func (o *AdminAccountsGetV2InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2InternalServerError", 500) +} + +func (o *AdminAccountsGetV2InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/admin/accounts][%d] adminAccountsGetV2InternalServerError", 500) +} + +func (o *AdminAccountsGetV2InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_client.go b/client/admin/admin_client.go new file mode 100644 index 0000000..baff4e2 --- /dev/null +++ b/client/admin/admin_client.go @@ -0,0 +1,1836 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new admin API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new admin API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new admin API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for admin API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AdminAccountAction(params *AdminAccountActionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountActionOK, error) + + AdminAccountApprove(params *AdminAccountApproveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountApproveOK, error) + + AdminAccountGet(params *AdminAccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountGetOK, error) + + AdminAccountReject(params *AdminAccountRejectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountRejectOK, error) + + AdminAccountsGetV1(params *AdminAccountsGetV1Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV1OK, error) + + AdminAccountsGetV2(params *AdminAccountsGetV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV2OK, error) + + AdminReportGet(params *AdminReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportGetOK, error) + + AdminReportResolve(params *AdminReportResolveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportResolveOK, error) + + AdminReports(params *AdminReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportsOK, error) + + AdminRuleGet(params *AdminRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminRuleGetOK, error) + + AdminsRuleGet(params *AdminsRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminsRuleGetOK, error) + + DomainAllowCreate(params *DomainAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowCreateOK, error) + + DomainAllowDelete(params *DomainAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowDeleteOK, error) + + DomainAllowGet(params *DomainAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowGetOK, error) + + DomainAllowsGet(params *DomainAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowsGetOK, error) + + DomainBlockCreate(params *DomainBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockCreateOK, error) + + DomainBlockDelete(params *DomainBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockDeleteOK, error) + + DomainBlockGet(params *DomainBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockGetOK, error) + + DomainBlocksGet(params *DomainBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlocksGetOK, error) + + DomainKeysExpire(params *DomainKeysExpireParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainKeysExpireAccepted, error) + + EmojiCategoriesGet(params *EmojiCategoriesGetParams, opts ...ClientOption) (*EmojiCategoriesGetOK, error) + + EmojiCreate(params *EmojiCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiCreateOK, error) + + EmojiDelete(params *EmojiDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiDeleteOK, error) + + EmojiGet(params *EmojiGetParams, opts ...ClientOption) (*EmojiGetOK, error) + + EmojiUpdate(params *EmojiUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiUpdateOK, error) + + EmojisGet(params *EmojisGetParams, opts ...ClientOption) (*EmojisGetOK, error) + + HeaderFilterAllowCreate(params *HeaderFilterAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowCreateOK, error) + + HeaderFilterAllowDelete(params *HeaderFilterAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowDeleteAccepted, error) + + HeaderFilterAllowGet(params *HeaderFilterAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowGetOK, error) + + HeaderFilterAllowsGet(params *HeaderFilterAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowsGetOK, error) + + HeaderFilterBlockCreate(params *HeaderFilterBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockCreateOK, error) + + HeaderFilterBlockDelete(params *HeaderFilterBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockDeleteAccepted, error) + + HeaderFilterBlockGet(params *HeaderFilterBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockGetOK, error) + + HeaderFilterBlocksGet(params *HeaderFilterBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlocksGetOK, error) + + MediaCleanup(params *MediaCleanupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCleanupOK, error) + + MediaRefetch(params *MediaRefetchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaRefetchAccepted, error) + + RuleCreate(params *RuleCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleCreateOK, error) + + RuleDelete(params *RuleDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleDeleteOK, error) + + RuleUpdate(params *RuleUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleUpdateOK, error) + + TestEmailSend(params *TestEmailSendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TestEmailSendAccepted, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +AdminAccountAction performs an admin action on an account +*/ +func (a *Client) AdminAccountAction(params *AdminAccountActionParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountActionOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountActionParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountAction", + Method: "POST", + PathPattern: "/api/v1/admin/accounts/{id}/action", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountActionReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminAccountActionOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminAccountAction: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminAccountApprove approves pending account +*/ +func (a *Client) AdminAccountApprove(params *AdminAccountApproveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountApproveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountApproveParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountApprove", + Method: "POST", + PathPattern: "/api/v1/admin/accounts/{id}/approve", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountApproveReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminAccountApproveOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminAccountApprove: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminAccountGet views one account +*/ +func (a *Client) AdminAccountGet(params *AdminAccountGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountGet", + Method: "GET", + PathPattern: "/api/v1/admin/accounts/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminAccountGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminAccountGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminAccountReject rejects pending account +*/ +func (a *Client) AdminAccountReject(params *AdminAccountRejectParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountRejectOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountRejectParams() + } + op := &runtime.ClientOperation{ + ID: "adminAccountReject", + Method: "POST", + PathPattern: "/api/v1/admin/accounts/{id}/reject", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountRejectReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminAccountRejectOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminAccountReject: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AdminAccountsGetV1 views page through known accounts according to given filters + + Returned accounts will be ordered alphabetically (a-z) by domain + username. + +The next and previous queries can be parsed from the returned Link header. +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) AdminAccountsGetV1(params *AdminAccountsGetV1Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV1OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountsGetV1Params() + } + op := &runtime.ClientOperation{ + ID: "adminAccountsGetV1", + Method: "GET", + PathPattern: "/api/v1/admin/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountsGetV1Reader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminAccountsGetV1OK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminAccountsGetV1: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AdminAccountsGetV2 views page through known accounts according to given filters + + Returned accounts will be ordered alphabetically (a-z) by domain + username. + +The next and previous queries can be parsed from the returned Link header. +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) AdminAccountsGetV2(params *AdminAccountsGetV2Params, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminAccountsGetV2OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminAccountsGetV2Params() + } + op := &runtime.ClientOperation{ + ID: "adminAccountsGetV2", + Method: "GET", + PathPattern: "/api/v2/admin/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminAccountsGetV2Reader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminAccountsGetV2OK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminAccountsGetV2: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminReportGet views user moderation report with the given id +*/ +func (a *Client) AdminReportGet(params *AdminReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminReportGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminReportGet", + Method: "GET", + PathPattern: "/api/v1/admin/reports/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminReportGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminReportGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminReportGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminReportResolve marks a report as resolved +*/ +func (a *Client) AdminReportResolve(params *AdminReportResolveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportResolveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminReportResolveParams() + } + op := &runtime.ClientOperation{ + ID: "adminReportResolve", + Method: "POST", + PathPattern: "/api/v1/admin/reports/{id}/resolve", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminReportResolveReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminReportResolveOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminReportResolve: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + AdminReports views user moderation reports + + The reports will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) AdminReports(params *AdminReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminReportsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminReportsParams() + } + op := &runtime.ClientOperation{ + ID: "adminReports", + Method: "GET", + PathPattern: "/api/v1/admin/reports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminReportsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminReportsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminReports: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminRuleGet views instance rule with the given id +*/ +func (a *Client) AdminRuleGet(params *AdminRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminRuleGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminRuleGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminRuleGet", + Method: "GET", + PathPattern: "/api/v1/admin/rules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminRuleGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminRuleGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminRuleGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +AdminsRuleGet views instance rules with i ds + +The rules will be returned in order (sorted by Order ascending). +*/ +func (a *Client) AdminsRuleGet(params *AdminsRuleGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AdminsRuleGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAdminsRuleGetParams() + } + op := &runtime.ClientOperation{ + ID: "adminsRuleGet", + Method: "GET", + PathPattern: "/api/v1/admin/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AdminsRuleGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AdminsRuleGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for adminsRuleGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + DomainAllowCreate creates one or more domain allows from a string or a file + + You have two options when using this endpoint: either you can set `import` to `true` and + +upload a file containing multiple domain allows, JSON-formatted, or you can leave import as +`false`, and just add one domain allow. + +The format of the json file should be something like: `[{"domain":"example.org"},{"domain":"whatever.com","public_comment":"they smell"}]` +*/ +func (a *Client) DomainAllowCreate(params *DomainAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowCreateParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowCreate", + Method: "POST", + PathPattern: "/api/v1/admin/domain_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainAllowCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainAllowCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainAllowDelete deletes domain allow with the given ID +*/ +func (a *Client) DomainAllowDelete(params *DomainAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/domain_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainAllowDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainAllowDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainAllowGet views domain allow with the given ID +*/ +func (a *Client) DomainAllowGet(params *DomainAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainAllowGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainAllowGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainAllowsGet views all domain allows currently in place +*/ +func (a *Client) DomainAllowsGet(params *DomainAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainAllowsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainAllowsGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainAllowsGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainAllowsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainAllowsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainAllowsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + DomainBlockCreate creates one or more domain blocks from a string or a file + + You have two options when using this endpoint: either you can set `import` to `true` and + +upload a file containing multiple domain blocks, JSON-formatted, or you can leave import as +`false`, and just add one domain block. + +The format of the json file should be something like: `[{"domain":"example.org"},{"domain":"whatever.com","public_comment":"they smell"}]` +*/ +func (a *Client) DomainBlockCreate(params *DomainBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlockCreateParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlockCreate", + Method: "POST", + PathPattern: "/api/v1/admin/domain_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlockCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainBlockCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainBlockCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainBlockDelete deletes domain block with the given ID +*/ +func (a *Client) DomainBlockDelete(params *DomainBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlockDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlockDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/domain_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlockDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainBlockDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainBlockDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainBlockGet views domain block with the given ID +*/ +func (a *Client) DomainBlockGet(params *DomainBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlockGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlockGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlockGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlockGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainBlockGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainBlockGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DomainBlocksGet views all domain blocks currently in place +*/ +func (a *Client) DomainBlocksGet(params *DomainBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainBlocksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainBlocksGetParams() + } + op := &runtime.ClientOperation{ + ID: "domainBlocksGet", + Method: "GET", + PathPattern: "/api/v1/admin/domain_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainBlocksGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainBlocksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainBlocksGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + DomainKeysExpire forces expiry of cached public keys for all accounts on the given domain stored in your database + + This is useful in cases where the remote domain has had to rotate their keys for whatever + +reason (security issue, data leak, routine safety procedure, etc), and your instance can no +longer communicate with theirs properly using cached keys. A key marked as expired in this way +will be lazily refetched next time a request is made to your instance signed by the owner of that +key, so no further action should be required in order to reestablish communication with that domain. + +This endpoint is explicitly not for rotating your *own* keys, it only works for remote instances. + +Using this endpoint to expire keys for a domain that hasn't rotated all of their keys is not +harmful and won't break federation, but it is pointless and will cause unnecessary requests to +be performed. +*/ +func (a *Client) DomainKeysExpire(params *DomainKeysExpireParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DomainKeysExpireAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDomainKeysExpireParams() + } + op := &runtime.ClientOperation{ + ID: "domainKeysExpire", + Method: "POST", + PathPattern: "/api/v1/admin/domain_keys_expire", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DomainKeysExpireReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DomainKeysExpireAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for domainKeysExpire: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +EmojiCategoriesGet gets a list of existing emoji categories +*/ +func (a *Client) EmojiCategoriesGet(params *EmojiCategoriesGetParams, opts ...ClientOption) (*EmojiCategoriesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiCategoriesGetParams() + } + op := &runtime.ClientOperation{ + ID: "emojiCategoriesGet", + Method: "GET", + PathPattern: "/api/v1/admin/custom_emojis/categories", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiCategoriesGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*EmojiCategoriesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for emojiCategoriesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +EmojiCreate uploads and create a new instance emoji +*/ +func (a *Client) EmojiCreate(params *EmojiCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiCreateParams() + } + op := &runtime.ClientOperation{ + ID: "emojiCreate", + Method: "POST", + PathPattern: "/api/v1/admin/custom_emojis", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*EmojiCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for emojiCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + EmojiDelete deletes a local emoji with the given ID from the instance + + Emoji with the given ID will no longer be available to use on the instance. + +If you just want to update the emoji image instead, use the `/api/v1/admin/custom_emojis/{id}` PATCH route. + +To disable emojis from **remote** instances, use the `/api/v1/admin/custom_emojis/{id}` PATCH route. +*/ +func (a *Client) EmojiDelete(params *EmojiDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "emojiDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/custom_emojis/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*EmojiDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for emojiDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +EmojiGet gets the admin view of a single emoji +*/ +func (a *Client) EmojiGet(params *EmojiGetParams, opts ...ClientOption) (*EmojiGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiGetParams() + } + op := &runtime.ClientOperation{ + ID: "emojiGet", + Method: "GET", + PathPattern: "/api/v1/admin/custom_emojis/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*EmojiGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for emojiGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + EmojiUpdate performs admin action on a local or remote emoji known to this instance + + Action performed depends upon the action `type` provided. + +`disable`: disable a REMOTE emoji from being used/displayed on this instance. Does not work for local emojis. + +`copy`: copy a REMOTE emoji to this instance. When doing this action, a shortcode MUST be provided, and it must +be unique among emojis already present on this instance. A category MAY be provided, and the copied emoji will then +be put into the provided category. + +`modify`: modify a LOCAL emoji. You can provide a new image for the emoji and/or update the category. + +Local emojis cannot be deleted using this endpoint. To delete a local emoji, check DELETE /api/v1/admin/custom_emojis/{id} instead. +*/ +func (a *Client) EmojiUpdate(params *EmojiUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*EmojiUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojiUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "emojiUpdate", + Method: "PATCH", + PathPattern: "/api/v1/admin/custom_emojis/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojiUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*EmojiUpdateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for emojiUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + EmojisGet views local and remote emojis available to known by this instance + + The next and previous queries can be parsed from the returned Link header. + +Example: + +`; rel="next", ; rel="prev"` +*/ +func (a *Client) EmojisGet(params *EmojisGetParams, opts ...ClientOption) (*EmojisGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewEmojisGetParams() + } + op := &runtime.ClientOperation{ + ID: "emojisGet", + Method: "GET", + PathPattern: "/api/v1/admin/custom_emojis", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &EmojisGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*EmojisGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for emojisGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + HeaderFilterAllowCreate creates new allow HTTP request header filter + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) HeaderFilterAllowCreate(params *HeaderFilterAllowCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowCreateParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowCreate", + Method: "POST", + PathPattern: "/api/v1/admin/header_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterAllowCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterAllowCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterAllowDelete deletes the allow header filter with the given ID +*/ +func (a *Client) HeaderFilterAllowDelete(params *HeaderFilterAllowDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/header_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterAllowDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterAllowDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterAllowGet gets allow header filter with the given ID +*/ +func (a *Client) HeaderFilterAllowGet(params *HeaderFilterAllowGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_allows/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterAllowGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterAllowGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterAllowsGet gets all allow header filters currently in place +*/ +func (a *Client) HeaderFilterAllowsGet(params *HeaderFilterAllowsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterAllowsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterAllowsGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterAllowsGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_allows", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterAllowsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterAllowsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterAllowsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + HeaderFilterBlockCreate creates new block HTTP request header filter + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) HeaderFilterBlockCreate(params *HeaderFilterBlockCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlockCreateParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlockCreate", + Method: "POST", + PathPattern: "/api/v1/admin/header_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlockCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterBlockCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterBlockCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterBlockDelete deletes the block header filter with the given ID +*/ +func (a *Client) HeaderFilterBlockDelete(params *HeaderFilterBlockDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockDeleteAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlockDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlockDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/header_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlockDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterBlockDeleteAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterBlockDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterBlockGet gets block header filter with the given ID +*/ +func (a *Client) HeaderFilterBlockGet(params *HeaderFilterBlockGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlockGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlockGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlockGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_blocks/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlockGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterBlockGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterBlockGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +HeaderFilterBlocksGet gets all allow header filters currently in place +*/ +func (a *Client) HeaderFilterBlocksGet(params *HeaderFilterBlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HeaderFilterBlocksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHeaderFilterBlocksGetParams() + } + op := &runtime.ClientOperation{ + ID: "headerFilterBlocksGet", + Method: "GET", + PathPattern: "/api/v1/admin/header_blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HeaderFilterBlocksGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HeaderFilterBlocksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for headerFilterBlocksGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +MediaCleanup cleans up remote media older than the specified number of days + +Also cleans up unused headers + avatars from the media cache and prunes orphaned items from storage. +*/ +func (a *Client) MediaCleanup(params *MediaCleanupParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCleanupOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaCleanupParams() + } + op := &runtime.ClientOperation{ + ID: "mediaCleanup", + Method: "POST", + PathPattern: "/api/v1/admin/media_cleanup", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaCleanupReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MediaCleanupOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for mediaCleanup: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + MediaRefetch refetches media specified in the database but missing from storage + + Currently, this only includes remote emojis. + +This endpoint is useful when data loss has occurred, and you want to try to recover to a working state. +*/ +func (a *Client) MediaRefetch(params *MediaRefetchParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaRefetchAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaRefetchParams() + } + op := &runtime.ClientOperation{ + ID: "mediaRefetch", + Method: "POST", + PathPattern: "/api/v1/admin/media_refetch", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaRefetchReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MediaRefetchAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for mediaRefetch: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RuleCreate creates a new instance rule +*/ +func (a *Client) RuleCreate(params *RuleCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRuleCreateParams() + } + op := &runtime.ClientOperation{ + ID: "ruleCreate", + Method: "POST", + PathPattern: "/api/v1/admin/instance/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RuleCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*RuleCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for ruleCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RuleDelete deletes an existing instance rule +*/ +func (a *Client) RuleDelete(params *RuleDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRuleDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "ruleDelete", + Method: "DELETE", + PathPattern: "/api/v1/admin/instance/rules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RuleDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*RuleDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for ruleDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RuleUpdate updates an existing instance rule +*/ +func (a *Client) RuleUpdate(params *RuleUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RuleUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRuleUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "ruleUpdate", + Method: "PATCH", + PathPattern: "/api/v1/admin/instance/rules/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RuleUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*RuleUpdateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for ruleUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + TestEmailSend sends a generic test email to a specified email address + + This can be used to validate an instance's SMTP configuration, and to debug any potential issues. + +If an error is returned by the SMTP connection, this handler will return code 422 to indicate that +the request could not be processed, and the SMTP error will be returned to the caller. +*/ +func (a *Client) TestEmailSend(params *TestEmailSendParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TestEmailSendAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTestEmailSendParams() + } + op := &runtime.ClientOperation{ + ID: "testEmailSend", + Method: "POST", + PathPattern: "/api/v1/admin/email/test", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TestEmailSendReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TestEmailSendAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for testEmailSend: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/admin/admin_report_get_parameters.go b/client/admin/admin_report_get_parameters.go new file mode 100644 index 0000000..3b9b893 --- /dev/null +++ b/client/admin/admin_report_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminReportGetParams creates a new AdminReportGetParams 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 NewAdminReportGetParams() *AdminReportGetParams { + return &AdminReportGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminReportGetParamsWithTimeout creates a new AdminReportGetParams object +// with the ability to set a timeout on a request. +func NewAdminReportGetParamsWithTimeout(timeout time.Duration) *AdminReportGetParams { + return &AdminReportGetParams{ + timeout: timeout, + } +} + +// NewAdminReportGetParamsWithContext creates a new AdminReportGetParams object +// with the ability to set a context for a request. +func NewAdminReportGetParamsWithContext(ctx context.Context) *AdminReportGetParams { + return &AdminReportGetParams{ + Context: ctx, + } +} + +// NewAdminReportGetParamsWithHTTPClient creates a new AdminReportGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminReportGetParamsWithHTTPClient(client *http.Client) *AdminReportGetParams { + return &AdminReportGetParams{ + HTTPClient: client, + } +} + +/* +AdminReportGetParams contains all the parameters to send to the API endpoint + + for the admin report get operation. + + Typically these are written to a http.Request. +*/ +type AdminReportGetParams struct { + + /* ID. + + The id of the report. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportGetParams) WithDefaults() *AdminReportGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin report get params +func (o *AdminReportGetParams) WithTimeout(timeout time.Duration) *AdminReportGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin report get params +func (o *AdminReportGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin report get params +func (o *AdminReportGetParams) WithContext(ctx context.Context) *AdminReportGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin report get params +func (o *AdminReportGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin report get params +func (o *AdminReportGetParams) WithHTTPClient(client *http.Client) *AdminReportGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin report get params +func (o *AdminReportGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin report get params +func (o *AdminReportGetParams) WithID(id string) *AdminReportGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin report get params +func (o *AdminReportGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminReportGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_report_get_responses.go b/client/admin/admin_report_get_responses.go new file mode 100644 index 0000000..4a76f86 --- /dev/null +++ b/client/admin/admin_report_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminReportGetReader is a Reader for the AdminReportGet structure. +type AdminReportGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminReportGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminReportGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminReportGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminReportGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminReportGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminReportGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminReportGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/reports/{id}] adminReportGet", response, response.Code()) + } +} + +// NewAdminReportGetOK creates a AdminReportGetOK with default headers values +func NewAdminReportGetOK() *AdminReportGetOK { + return &AdminReportGetOK{} +} + +/* +AdminReportGetOK describes a response with status code 200, with default header values. + +The requested report. +*/ +type AdminReportGetOK struct { + Payload *models.AdminReport +} + +// IsSuccess returns true when this admin report get o k response has a 2xx status code +func (o *AdminReportGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin report get o k response has a 3xx status code +func (o *AdminReportGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get o k response has a 4xx status code +func (o *AdminReportGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report get o k response has a 5xx status code +func (o *AdminReportGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get o k response a status code equal to that given +func (o *AdminReportGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin report get o k response +func (o *AdminReportGetOK) Code() int { + return 200 +} + +func (o *AdminReportGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetOK %s", 200, payload) +} + +func (o *AdminReportGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetOK %s", 200, payload) +} + +func (o *AdminReportGetOK) GetPayload() *models.AdminReport { + return o.Payload +} + +func (o *AdminReportGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminReport) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminReportGetBadRequest creates a AdminReportGetBadRequest with default headers values +func NewAdminReportGetBadRequest() *AdminReportGetBadRequest { + return &AdminReportGetBadRequest{} +} + +/* +AdminReportGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminReportGetBadRequest struct { +} + +// IsSuccess returns true when this admin report get bad request response has a 2xx status code +func (o *AdminReportGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get bad request response has a 3xx status code +func (o *AdminReportGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get bad request response has a 4xx status code +func (o *AdminReportGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get bad request response has a 5xx status code +func (o *AdminReportGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get bad request response a status code equal to that given +func (o *AdminReportGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin report get bad request response +func (o *AdminReportGetBadRequest) Code() int { + return 400 +} + +func (o *AdminReportGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetBadRequest", 400) +} + +func (o *AdminReportGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetBadRequest", 400) +} + +func (o *AdminReportGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetUnauthorized creates a AdminReportGetUnauthorized with default headers values +func NewAdminReportGetUnauthorized() *AdminReportGetUnauthorized { + return &AdminReportGetUnauthorized{} +} + +/* +AdminReportGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminReportGetUnauthorized struct { +} + +// IsSuccess returns true when this admin report get unauthorized response has a 2xx status code +func (o *AdminReportGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get unauthorized response has a 3xx status code +func (o *AdminReportGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get unauthorized response has a 4xx status code +func (o *AdminReportGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get unauthorized response has a 5xx status code +func (o *AdminReportGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get unauthorized response a status code equal to that given +func (o *AdminReportGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin report get unauthorized response +func (o *AdminReportGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminReportGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetUnauthorized", 401) +} + +func (o *AdminReportGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetUnauthorized", 401) +} + +func (o *AdminReportGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetNotFound creates a AdminReportGetNotFound with default headers values +func NewAdminReportGetNotFound() *AdminReportGetNotFound { + return &AdminReportGetNotFound{} +} + +/* +AdminReportGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminReportGetNotFound struct { +} + +// IsSuccess returns true when this admin report get not found response has a 2xx status code +func (o *AdminReportGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get not found response has a 3xx status code +func (o *AdminReportGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get not found response has a 4xx status code +func (o *AdminReportGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get not found response has a 5xx status code +func (o *AdminReportGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get not found response a status code equal to that given +func (o *AdminReportGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin report get not found response +func (o *AdminReportGetNotFound) Code() int { + return 404 +} + +func (o *AdminReportGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotFound", 404) +} + +func (o *AdminReportGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotFound", 404) +} + +func (o *AdminReportGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetNotAcceptable creates a AdminReportGetNotAcceptable with default headers values +func NewAdminReportGetNotAcceptable() *AdminReportGetNotAcceptable { + return &AdminReportGetNotAcceptable{} +} + +/* +AdminReportGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminReportGetNotAcceptable struct { +} + +// IsSuccess returns true when this admin report get not acceptable response has a 2xx status code +func (o *AdminReportGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get not acceptable response has a 3xx status code +func (o *AdminReportGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get not acceptable response has a 4xx status code +func (o *AdminReportGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report get not acceptable response has a 5xx status code +func (o *AdminReportGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report get not acceptable response a status code equal to that given +func (o *AdminReportGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin report get not acceptable response +func (o *AdminReportGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminReportGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotAcceptable", 406) +} + +func (o *AdminReportGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetNotAcceptable", 406) +} + +func (o *AdminReportGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportGetInternalServerError creates a AdminReportGetInternalServerError with default headers values +func NewAdminReportGetInternalServerError() *AdminReportGetInternalServerError { + return &AdminReportGetInternalServerError{} +} + +/* +AdminReportGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminReportGetInternalServerError struct { +} + +// IsSuccess returns true when this admin report get internal server error response has a 2xx status code +func (o *AdminReportGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report get internal server error response has a 3xx status code +func (o *AdminReportGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report get internal server error response has a 4xx status code +func (o *AdminReportGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report get internal server error response has a 5xx status code +func (o *AdminReportGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin report get internal server error response a status code equal to that given +func (o *AdminReportGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin report get internal server error response +func (o *AdminReportGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminReportGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetInternalServerError", 500) +} + +func (o *AdminReportGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports/{id}][%d] adminReportGetInternalServerError", 500) +} + +func (o *AdminReportGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_report_resolve_parameters.go b/client/admin/admin_report_resolve_parameters.go new file mode 100644 index 0000000..1648302 --- /dev/null +++ b/client/admin/admin_report_resolve_parameters.go @@ -0,0 +1,184 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminReportResolveParams creates a new AdminReportResolveParams 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 NewAdminReportResolveParams() *AdminReportResolveParams { + return &AdminReportResolveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminReportResolveParamsWithTimeout creates a new AdminReportResolveParams object +// with the ability to set a timeout on a request. +func NewAdminReportResolveParamsWithTimeout(timeout time.Duration) *AdminReportResolveParams { + return &AdminReportResolveParams{ + timeout: timeout, + } +} + +// NewAdminReportResolveParamsWithContext creates a new AdminReportResolveParams object +// with the ability to set a context for a request. +func NewAdminReportResolveParamsWithContext(ctx context.Context) *AdminReportResolveParams { + return &AdminReportResolveParams{ + Context: ctx, + } +} + +// NewAdminReportResolveParamsWithHTTPClient creates a new AdminReportResolveParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminReportResolveParamsWithHTTPClient(client *http.Client) *AdminReportResolveParams { + return &AdminReportResolveParams{ + HTTPClient: client, + } +} + +/* +AdminReportResolveParams contains all the parameters to send to the API endpoint + + for the admin report resolve operation. + + Typically these are written to a http.Request. +*/ +type AdminReportResolveParams struct { + + /* ActionTakenComment. + + Optional admin comment on the action taken in response to this report. Useful for providing an explanation about what action was taken (if any) before the report was marked as resolved. This will be visible to the user that created the report! + Sample: The reported account was suspended. + */ + ActionTakenComment *string + + /* ID. + + The id of the report. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin report resolve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportResolveParams) WithDefaults() *AdminReportResolveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin report resolve params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportResolveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin report resolve params +func (o *AdminReportResolveParams) WithTimeout(timeout time.Duration) *AdminReportResolveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin report resolve params +func (o *AdminReportResolveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin report resolve params +func (o *AdminReportResolveParams) WithContext(ctx context.Context) *AdminReportResolveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin report resolve params +func (o *AdminReportResolveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin report resolve params +func (o *AdminReportResolveParams) WithHTTPClient(client *http.Client) *AdminReportResolveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin report resolve params +func (o *AdminReportResolveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithActionTakenComment adds the actionTakenComment to the admin report resolve params +func (o *AdminReportResolveParams) WithActionTakenComment(actionTakenComment *string) *AdminReportResolveParams { + o.SetActionTakenComment(actionTakenComment) + return o +} + +// SetActionTakenComment adds the actionTakenComment to the admin report resolve params +func (o *AdminReportResolveParams) SetActionTakenComment(actionTakenComment *string) { + o.ActionTakenComment = actionTakenComment +} + +// WithID adds the id to the admin report resolve params +func (o *AdminReportResolveParams) WithID(id string) *AdminReportResolveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin report resolve params +func (o *AdminReportResolveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminReportResolveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ActionTakenComment != nil { + + // form param action_taken_comment + var frActionTakenComment string + if o.ActionTakenComment != nil { + frActionTakenComment = *o.ActionTakenComment + } + fActionTakenComment := frActionTakenComment + if fActionTakenComment != "" { + if err := r.SetFormParam("action_taken_comment", fActionTakenComment); 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 +} diff --git a/client/admin/admin_report_resolve_responses.go b/client/admin/admin_report_resolve_responses.go new file mode 100644 index 0000000..076e5ac --- /dev/null +++ b/client/admin/admin_report_resolve_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminReportResolveReader is a Reader for the AdminReportResolve structure. +type AdminReportResolveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminReportResolveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminReportResolveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminReportResolveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminReportResolveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminReportResolveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminReportResolveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminReportResolveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/reports/{id}/resolve] adminReportResolve", response, response.Code()) + } +} + +// NewAdminReportResolveOK creates a AdminReportResolveOK with default headers values +func NewAdminReportResolveOK() *AdminReportResolveOK { + return &AdminReportResolveOK{} +} + +/* +AdminReportResolveOK describes a response with status code 200, with default header values. + +The resolved report. +*/ +type AdminReportResolveOK struct { + Payload *models.AdminReport +} + +// IsSuccess returns true when this admin report resolve o k response has a 2xx status code +func (o *AdminReportResolveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin report resolve o k response has a 3xx status code +func (o *AdminReportResolveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve o k response has a 4xx status code +func (o *AdminReportResolveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report resolve o k response has a 5xx status code +func (o *AdminReportResolveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve o k response a status code equal to that given +func (o *AdminReportResolveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin report resolve o k response +func (o *AdminReportResolveOK) Code() int { + return 200 +} + +func (o *AdminReportResolveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveOK %s", 200, payload) +} + +func (o *AdminReportResolveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveOK %s", 200, payload) +} + +func (o *AdminReportResolveOK) GetPayload() *models.AdminReport { + return o.Payload +} + +func (o *AdminReportResolveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminReport) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminReportResolveBadRequest creates a AdminReportResolveBadRequest with default headers values +func NewAdminReportResolveBadRequest() *AdminReportResolveBadRequest { + return &AdminReportResolveBadRequest{} +} + +/* +AdminReportResolveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminReportResolveBadRequest struct { +} + +// IsSuccess returns true when this admin report resolve bad request response has a 2xx status code +func (o *AdminReportResolveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve bad request response has a 3xx status code +func (o *AdminReportResolveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve bad request response has a 4xx status code +func (o *AdminReportResolveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve bad request response has a 5xx status code +func (o *AdminReportResolveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve bad request response a status code equal to that given +func (o *AdminReportResolveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin report resolve bad request response +func (o *AdminReportResolveBadRequest) Code() int { + return 400 +} + +func (o *AdminReportResolveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveBadRequest", 400) +} + +func (o *AdminReportResolveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveBadRequest", 400) +} + +func (o *AdminReportResolveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveUnauthorized creates a AdminReportResolveUnauthorized with default headers values +func NewAdminReportResolveUnauthorized() *AdminReportResolveUnauthorized { + return &AdminReportResolveUnauthorized{} +} + +/* +AdminReportResolveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminReportResolveUnauthorized struct { +} + +// IsSuccess returns true when this admin report resolve unauthorized response has a 2xx status code +func (o *AdminReportResolveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve unauthorized response has a 3xx status code +func (o *AdminReportResolveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve unauthorized response has a 4xx status code +func (o *AdminReportResolveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve unauthorized response has a 5xx status code +func (o *AdminReportResolveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve unauthorized response a status code equal to that given +func (o *AdminReportResolveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin report resolve unauthorized response +func (o *AdminReportResolveUnauthorized) Code() int { + return 401 +} + +func (o *AdminReportResolveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveUnauthorized", 401) +} + +func (o *AdminReportResolveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveUnauthorized", 401) +} + +func (o *AdminReportResolveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveNotFound creates a AdminReportResolveNotFound with default headers values +func NewAdminReportResolveNotFound() *AdminReportResolveNotFound { + return &AdminReportResolveNotFound{} +} + +/* +AdminReportResolveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminReportResolveNotFound struct { +} + +// IsSuccess returns true when this admin report resolve not found response has a 2xx status code +func (o *AdminReportResolveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve not found response has a 3xx status code +func (o *AdminReportResolveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve not found response has a 4xx status code +func (o *AdminReportResolveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve not found response has a 5xx status code +func (o *AdminReportResolveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve not found response a status code equal to that given +func (o *AdminReportResolveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin report resolve not found response +func (o *AdminReportResolveNotFound) Code() int { + return 404 +} + +func (o *AdminReportResolveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotFound", 404) +} + +func (o *AdminReportResolveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotFound", 404) +} + +func (o *AdminReportResolveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveNotAcceptable creates a AdminReportResolveNotAcceptable with default headers values +func NewAdminReportResolveNotAcceptable() *AdminReportResolveNotAcceptable { + return &AdminReportResolveNotAcceptable{} +} + +/* +AdminReportResolveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminReportResolveNotAcceptable struct { +} + +// IsSuccess returns true when this admin report resolve not acceptable response has a 2xx status code +func (o *AdminReportResolveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve not acceptable response has a 3xx status code +func (o *AdminReportResolveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve not acceptable response has a 4xx status code +func (o *AdminReportResolveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin report resolve not acceptable response has a 5xx status code +func (o *AdminReportResolveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin report resolve not acceptable response a status code equal to that given +func (o *AdminReportResolveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin report resolve not acceptable response +func (o *AdminReportResolveNotAcceptable) Code() int { + return 406 +} + +func (o *AdminReportResolveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotAcceptable", 406) +} + +func (o *AdminReportResolveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveNotAcceptable", 406) +} + +func (o *AdminReportResolveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportResolveInternalServerError creates a AdminReportResolveInternalServerError with default headers values +func NewAdminReportResolveInternalServerError() *AdminReportResolveInternalServerError { + return &AdminReportResolveInternalServerError{} +} + +/* +AdminReportResolveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminReportResolveInternalServerError struct { +} + +// IsSuccess returns true when this admin report resolve internal server error response has a 2xx status code +func (o *AdminReportResolveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin report resolve internal server error response has a 3xx status code +func (o *AdminReportResolveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin report resolve internal server error response has a 4xx status code +func (o *AdminReportResolveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin report resolve internal server error response has a 5xx status code +func (o *AdminReportResolveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin report resolve internal server error response a status code equal to that given +func (o *AdminReportResolveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin report resolve internal server error response +func (o *AdminReportResolveInternalServerError) Code() int { + return 500 +} + +func (o *AdminReportResolveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveInternalServerError", 500) +} + +func (o *AdminReportResolveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/reports/{id}/resolve][%d] adminReportResolveInternalServerError", 500) +} + +func (o *AdminReportResolveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_reports_parameters.go b/client/admin/admin_reports_parameters.go new file mode 100644 index 0000000..ec2a236 --- /dev/null +++ b/client/admin/admin_reports_parameters.go @@ -0,0 +1,381 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminReportsParams creates a new AdminReportsParams 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 NewAdminReportsParams() *AdminReportsParams { + return &AdminReportsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminReportsParamsWithTimeout creates a new AdminReportsParams object +// with the ability to set a timeout on a request. +func NewAdminReportsParamsWithTimeout(timeout time.Duration) *AdminReportsParams { + return &AdminReportsParams{ + timeout: timeout, + } +} + +// NewAdminReportsParamsWithContext creates a new AdminReportsParams object +// with the ability to set a context for a request. +func NewAdminReportsParamsWithContext(ctx context.Context) *AdminReportsParams { + return &AdminReportsParams{ + Context: ctx, + } +} + +// NewAdminReportsParamsWithHTTPClient creates a new AdminReportsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminReportsParamsWithHTTPClient(client *http.Client) *AdminReportsParams { + return &AdminReportsParams{ + HTTPClient: client, + } +} + +/* +AdminReportsParams contains all the parameters to send to the API endpoint + + for the admin reports operation. + + Typically these are written to a http.Request. +*/ +type AdminReportsParams struct { + + /* AccountID. + + Return only reports created by the given account id. + */ + AccountID *string + + /* Limit. + + Number of reports to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only reports *OLDER* than the given max ID (for paging downwards). The report with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only reports immediately *NEWER* than the given min ID (for paging upwards). The report with the specified ID will not be included in the response. + */ + MinID *string + + /* Resolved. + + If set to true, only resolved reports will be returned. If false, only unresolved reports will be returned. If unset, reports will not be filtered on their resolved status. + */ + Resolved *bool + + /* SinceID. + + Return only reports *NEWER* than the given since ID. The report with the specified ID will not be included in the response. + */ + SinceID *string + + /* TargetAccountID. + + Return only reports that target the given account id. + */ + TargetAccountID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportsParams) WithDefaults() *AdminReportsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminReportsParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := AdminReportsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the admin reports params +func (o *AdminReportsParams) WithTimeout(timeout time.Duration) *AdminReportsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin reports params +func (o *AdminReportsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin reports params +func (o *AdminReportsParams) WithContext(ctx context.Context) *AdminReportsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin reports params +func (o *AdminReportsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin reports params +func (o *AdminReportsParams) WithHTTPClient(client *http.Client) *AdminReportsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin reports params +func (o *AdminReportsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the admin reports params +func (o *AdminReportsParams) WithAccountID(accountID *string) *AdminReportsParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the admin reports params +func (o *AdminReportsParams) SetAccountID(accountID *string) { + o.AccountID = accountID +} + +// WithLimit adds the limit to the admin reports params +func (o *AdminReportsParams) WithLimit(limit *int64) *AdminReportsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the admin reports params +func (o *AdminReportsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the admin reports params +func (o *AdminReportsParams) WithMaxID(maxID *string) *AdminReportsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the admin reports params +func (o *AdminReportsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the admin reports params +func (o *AdminReportsParams) WithMinID(minID *string) *AdminReportsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the admin reports params +func (o *AdminReportsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithResolved adds the resolved to the admin reports params +func (o *AdminReportsParams) WithResolved(resolved *bool) *AdminReportsParams { + o.SetResolved(resolved) + return o +} + +// SetResolved adds the resolved to the admin reports params +func (o *AdminReportsParams) SetResolved(resolved *bool) { + o.Resolved = resolved +} + +// WithSinceID adds the sinceID to the admin reports params +func (o *AdminReportsParams) WithSinceID(sinceID *string) *AdminReportsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the admin reports params +func (o *AdminReportsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTargetAccountID adds the targetAccountID to the admin reports params +func (o *AdminReportsParams) WithTargetAccountID(targetAccountID *string) *AdminReportsParams { + o.SetTargetAccountID(targetAccountID) + return o +} + +// SetTargetAccountID adds the targetAccountId to the admin reports params +func (o *AdminReportsParams) SetTargetAccountID(targetAccountID *string) { + o.TargetAccountID = targetAccountID +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminReportsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountID != nil { + + // query param account_id + var qrAccountID string + + if o.AccountID != nil { + qrAccountID = *o.AccountID + } + qAccountID := qrAccountID + if qAccountID != "" { + + if err := r.SetQueryParam("account_id", qAccountID); err != nil { + return err + } + } + } + + 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.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.Resolved != nil { + + // query param resolved + var qrResolved bool + + if o.Resolved != nil { + qrResolved = *o.Resolved + } + qResolved := swag.FormatBool(qrResolved) + if qResolved != "" { + + if err := r.SetQueryParam("resolved", qResolved); 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 o.TargetAccountID != nil { + + // query param target_account_id + var qrTargetAccountID string + + if o.TargetAccountID != nil { + qrTargetAccountID = *o.TargetAccountID + } + qTargetAccountID := qrTargetAccountID + if qTargetAccountID != "" { + + if err := r.SetQueryParam("target_account_id", qTargetAccountID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_reports_responses.go b/client/admin/admin_reports_responses.go new file mode 100644 index 0000000..8f334de --- /dev/null +++ b/client/admin/admin_reports_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminReportsReader is a Reader for the AdminReports structure. +type AdminReportsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminReportsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminReportsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminReportsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminReportsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminReportsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminReportsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminReportsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/reports] adminReports", response, response.Code()) + } +} + +// NewAdminReportsOK creates a AdminReportsOK with default headers values +func NewAdminReportsOK() *AdminReportsOK { + return &AdminReportsOK{} +} + +/* +AdminReportsOK describes a response with status code 200, with default header values. + +Array of reports. +*/ +type AdminReportsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminReport +} + +// IsSuccess returns true when this admin reports o k response has a 2xx status code +func (o *AdminReportsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin reports o k response has a 3xx status code +func (o *AdminReportsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports o k response has a 4xx status code +func (o *AdminReportsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin reports o k response has a 5xx status code +func (o *AdminReportsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports o k response a status code equal to that given +func (o *AdminReportsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin reports o k response +func (o *AdminReportsOK) Code() int { + return 200 +} + +func (o *AdminReportsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsOK %s", 200, payload) +} + +func (o *AdminReportsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsOK %s", 200, payload) +} + +func (o *AdminReportsOK) GetPayload() []*models.AdminReport { + return o.Payload +} + +func (o *AdminReportsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminReportsBadRequest creates a AdminReportsBadRequest with default headers values +func NewAdminReportsBadRequest() *AdminReportsBadRequest { + return &AdminReportsBadRequest{} +} + +/* +AdminReportsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminReportsBadRequest struct { +} + +// IsSuccess returns true when this admin reports bad request response has a 2xx status code +func (o *AdminReportsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports bad request response has a 3xx status code +func (o *AdminReportsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports bad request response has a 4xx status code +func (o *AdminReportsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports bad request response has a 5xx status code +func (o *AdminReportsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports bad request response a status code equal to that given +func (o *AdminReportsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin reports bad request response +func (o *AdminReportsBadRequest) Code() int { + return 400 +} + +func (o *AdminReportsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsBadRequest", 400) +} + +func (o *AdminReportsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsBadRequest", 400) +} + +func (o *AdminReportsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsUnauthorized creates a AdminReportsUnauthorized with default headers values +func NewAdminReportsUnauthorized() *AdminReportsUnauthorized { + return &AdminReportsUnauthorized{} +} + +/* +AdminReportsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminReportsUnauthorized struct { +} + +// IsSuccess returns true when this admin reports unauthorized response has a 2xx status code +func (o *AdminReportsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports unauthorized response has a 3xx status code +func (o *AdminReportsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports unauthorized response has a 4xx status code +func (o *AdminReportsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports unauthorized response has a 5xx status code +func (o *AdminReportsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports unauthorized response a status code equal to that given +func (o *AdminReportsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin reports unauthorized response +func (o *AdminReportsUnauthorized) Code() int { + return 401 +} + +func (o *AdminReportsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsUnauthorized", 401) +} + +func (o *AdminReportsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsUnauthorized", 401) +} + +func (o *AdminReportsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsNotFound creates a AdminReportsNotFound with default headers values +func NewAdminReportsNotFound() *AdminReportsNotFound { + return &AdminReportsNotFound{} +} + +/* +AdminReportsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminReportsNotFound struct { +} + +// IsSuccess returns true when this admin reports not found response has a 2xx status code +func (o *AdminReportsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports not found response has a 3xx status code +func (o *AdminReportsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports not found response has a 4xx status code +func (o *AdminReportsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports not found response has a 5xx status code +func (o *AdminReportsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports not found response a status code equal to that given +func (o *AdminReportsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin reports not found response +func (o *AdminReportsNotFound) Code() int { + return 404 +} + +func (o *AdminReportsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotFound", 404) +} + +func (o *AdminReportsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotFound", 404) +} + +func (o *AdminReportsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsNotAcceptable creates a AdminReportsNotAcceptable with default headers values +func NewAdminReportsNotAcceptable() *AdminReportsNotAcceptable { + return &AdminReportsNotAcceptable{} +} + +/* +AdminReportsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminReportsNotAcceptable struct { +} + +// IsSuccess returns true when this admin reports not acceptable response has a 2xx status code +func (o *AdminReportsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports not acceptable response has a 3xx status code +func (o *AdminReportsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports not acceptable response has a 4xx status code +func (o *AdminReportsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin reports not acceptable response has a 5xx status code +func (o *AdminReportsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin reports not acceptable response a status code equal to that given +func (o *AdminReportsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin reports not acceptable response +func (o *AdminReportsNotAcceptable) Code() int { + return 406 +} + +func (o *AdminReportsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotAcceptable", 406) +} + +func (o *AdminReportsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsNotAcceptable", 406) +} + +func (o *AdminReportsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminReportsInternalServerError creates a AdminReportsInternalServerError with default headers values +func NewAdminReportsInternalServerError() *AdminReportsInternalServerError { + return &AdminReportsInternalServerError{} +} + +/* +AdminReportsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminReportsInternalServerError struct { +} + +// IsSuccess returns true when this admin reports internal server error response has a 2xx status code +func (o *AdminReportsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin reports internal server error response has a 3xx status code +func (o *AdminReportsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin reports internal server error response has a 4xx status code +func (o *AdminReportsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin reports internal server error response has a 5xx status code +func (o *AdminReportsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin reports internal server error response a status code equal to that given +func (o *AdminReportsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin reports internal server error response +func (o *AdminReportsInternalServerError) Code() int { + return 500 +} + +func (o *AdminReportsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsInternalServerError", 500) +} + +func (o *AdminReportsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/reports][%d] adminReportsInternalServerError", 500) +} + +func (o *AdminReportsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admin_rule_get_parameters.go b/client/admin/admin_rule_get_parameters.go new file mode 100644 index 0000000..a99972c --- /dev/null +++ b/client/admin/admin_rule_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminRuleGetParams creates a new AdminRuleGetParams 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 NewAdminRuleGetParams() *AdminRuleGetParams { + return &AdminRuleGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminRuleGetParamsWithTimeout creates a new AdminRuleGetParams object +// with the ability to set a timeout on a request. +func NewAdminRuleGetParamsWithTimeout(timeout time.Duration) *AdminRuleGetParams { + return &AdminRuleGetParams{ + timeout: timeout, + } +} + +// NewAdminRuleGetParamsWithContext creates a new AdminRuleGetParams object +// with the ability to set a context for a request. +func NewAdminRuleGetParamsWithContext(ctx context.Context) *AdminRuleGetParams { + return &AdminRuleGetParams{ + Context: ctx, + } +} + +// NewAdminRuleGetParamsWithHTTPClient creates a new AdminRuleGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminRuleGetParamsWithHTTPClient(client *http.Client) *AdminRuleGetParams { + return &AdminRuleGetParams{ + HTTPClient: client, + } +} + +/* +AdminRuleGetParams contains all the parameters to send to the API endpoint + + for the admin rule get operation. + + Typically these are written to a http.Request. +*/ +type AdminRuleGetParams struct { + + /* ID. + + The id of the rule. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admin rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminRuleGetParams) WithDefaults() *AdminRuleGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admin rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminRuleGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admin rule get params +func (o *AdminRuleGetParams) WithTimeout(timeout time.Duration) *AdminRuleGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admin rule get params +func (o *AdminRuleGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admin rule get params +func (o *AdminRuleGetParams) WithContext(ctx context.Context) *AdminRuleGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admin rule get params +func (o *AdminRuleGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admin rule get params +func (o *AdminRuleGetParams) WithHTTPClient(client *http.Client) *AdminRuleGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admin rule get params +func (o *AdminRuleGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the admin rule get params +func (o *AdminRuleGetParams) WithID(id string) *AdminRuleGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the admin rule get params +func (o *AdminRuleGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminRuleGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admin_rule_get_responses.go b/client/admin/admin_rule_get_responses.go new file mode 100644 index 0000000..65a17b4 --- /dev/null +++ b/client/admin/admin_rule_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminRuleGetReader is a Reader for the AdminRuleGet structure. +type AdminRuleGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminRuleGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminRuleGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminRuleGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminRuleGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminRuleGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminRuleGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminRuleGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/rules/{id}] adminRuleGet", response, response.Code()) + } +} + +// NewAdminRuleGetOK creates a AdminRuleGetOK with default headers values +func NewAdminRuleGetOK() *AdminRuleGetOK { + return &AdminRuleGetOK{} +} + +/* +AdminRuleGetOK describes a response with status code 200, with default header values. + +The requested rule. +*/ +type AdminRuleGetOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this admin rule get o k response has a 2xx status code +func (o *AdminRuleGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admin rule get o k response has a 3xx status code +func (o *AdminRuleGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get o k response has a 4xx status code +func (o *AdminRuleGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin rule get o k response has a 5xx status code +func (o *AdminRuleGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get o k response a status code equal to that given +func (o *AdminRuleGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admin rule get o k response +func (o *AdminRuleGetOK) Code() int { + return 200 +} + +func (o *AdminRuleGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetOK %s", 200, payload) +} + +func (o *AdminRuleGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetOK %s", 200, payload) +} + +func (o *AdminRuleGetOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *AdminRuleGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminRuleGetBadRequest creates a AdminRuleGetBadRequest with default headers values +func NewAdminRuleGetBadRequest() *AdminRuleGetBadRequest { + return &AdminRuleGetBadRequest{} +} + +/* +AdminRuleGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminRuleGetBadRequest struct { +} + +// IsSuccess returns true when this admin rule get bad request response has a 2xx status code +func (o *AdminRuleGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get bad request response has a 3xx status code +func (o *AdminRuleGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get bad request response has a 4xx status code +func (o *AdminRuleGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get bad request response has a 5xx status code +func (o *AdminRuleGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get bad request response a status code equal to that given +func (o *AdminRuleGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admin rule get bad request response +func (o *AdminRuleGetBadRequest) Code() int { + return 400 +} + +func (o *AdminRuleGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetBadRequest", 400) +} + +func (o *AdminRuleGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetBadRequest", 400) +} + +func (o *AdminRuleGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetUnauthorized creates a AdminRuleGetUnauthorized with default headers values +func NewAdminRuleGetUnauthorized() *AdminRuleGetUnauthorized { + return &AdminRuleGetUnauthorized{} +} + +/* +AdminRuleGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminRuleGetUnauthorized struct { +} + +// IsSuccess returns true when this admin rule get unauthorized response has a 2xx status code +func (o *AdminRuleGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get unauthorized response has a 3xx status code +func (o *AdminRuleGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get unauthorized response has a 4xx status code +func (o *AdminRuleGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get unauthorized response has a 5xx status code +func (o *AdminRuleGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get unauthorized response a status code equal to that given +func (o *AdminRuleGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admin rule get unauthorized response +func (o *AdminRuleGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminRuleGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetUnauthorized", 401) +} + +func (o *AdminRuleGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetUnauthorized", 401) +} + +func (o *AdminRuleGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetNotFound creates a AdminRuleGetNotFound with default headers values +func NewAdminRuleGetNotFound() *AdminRuleGetNotFound { + return &AdminRuleGetNotFound{} +} + +/* +AdminRuleGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminRuleGetNotFound struct { +} + +// IsSuccess returns true when this admin rule get not found response has a 2xx status code +func (o *AdminRuleGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get not found response has a 3xx status code +func (o *AdminRuleGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get not found response has a 4xx status code +func (o *AdminRuleGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get not found response has a 5xx status code +func (o *AdminRuleGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get not found response a status code equal to that given +func (o *AdminRuleGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admin rule get not found response +func (o *AdminRuleGetNotFound) Code() int { + return 404 +} + +func (o *AdminRuleGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotFound", 404) +} + +func (o *AdminRuleGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotFound", 404) +} + +func (o *AdminRuleGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetNotAcceptable creates a AdminRuleGetNotAcceptable with default headers values +func NewAdminRuleGetNotAcceptable() *AdminRuleGetNotAcceptable { + return &AdminRuleGetNotAcceptable{} +} + +/* +AdminRuleGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminRuleGetNotAcceptable struct { +} + +// IsSuccess returns true when this admin rule get not acceptable response has a 2xx status code +func (o *AdminRuleGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get not acceptable response has a 3xx status code +func (o *AdminRuleGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get not acceptable response has a 4xx status code +func (o *AdminRuleGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admin rule get not acceptable response has a 5xx status code +func (o *AdminRuleGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admin rule get not acceptable response a status code equal to that given +func (o *AdminRuleGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admin rule get not acceptable response +func (o *AdminRuleGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminRuleGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotAcceptable", 406) +} + +func (o *AdminRuleGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetNotAcceptable", 406) +} + +func (o *AdminRuleGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminRuleGetInternalServerError creates a AdminRuleGetInternalServerError with default headers values +func NewAdminRuleGetInternalServerError() *AdminRuleGetInternalServerError { + return &AdminRuleGetInternalServerError{} +} + +/* +AdminRuleGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminRuleGetInternalServerError struct { +} + +// IsSuccess returns true when this admin rule get internal server error response has a 2xx status code +func (o *AdminRuleGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admin rule get internal server error response has a 3xx status code +func (o *AdminRuleGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admin rule get internal server error response has a 4xx status code +func (o *AdminRuleGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admin rule get internal server error response has a 5xx status code +func (o *AdminRuleGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admin rule get internal server error response a status code equal to that given +func (o *AdminRuleGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admin rule get internal server error response +func (o *AdminRuleGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminRuleGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetInternalServerError", 500) +} + +func (o *AdminRuleGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules/{id}][%d] adminRuleGetInternalServerError", 500) +} + +func (o *AdminRuleGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/admins_rule_get_parameters.go b/client/admin/admins_rule_get_parameters.go new file mode 100644 index 0000000..28ad865 --- /dev/null +++ b/client/admin/admins_rule_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewAdminsRuleGetParams creates a new AdminsRuleGetParams 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 NewAdminsRuleGetParams() *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAdminsRuleGetParamsWithTimeout creates a new AdminsRuleGetParams object +// with the ability to set a timeout on a request. +func NewAdminsRuleGetParamsWithTimeout(timeout time.Duration) *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + timeout: timeout, + } +} + +// NewAdminsRuleGetParamsWithContext creates a new AdminsRuleGetParams object +// with the ability to set a context for a request. +func NewAdminsRuleGetParamsWithContext(ctx context.Context) *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + Context: ctx, + } +} + +// NewAdminsRuleGetParamsWithHTTPClient creates a new AdminsRuleGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewAdminsRuleGetParamsWithHTTPClient(client *http.Client) *AdminsRuleGetParams { + return &AdminsRuleGetParams{ + HTTPClient: client, + } +} + +/* +AdminsRuleGetParams contains all the parameters to send to the API endpoint + + for the admins rule get operation. + + Typically these are written to a http.Request. +*/ +type AdminsRuleGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the admins rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminsRuleGetParams) WithDefaults() *AdminsRuleGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the admins rule get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AdminsRuleGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the admins rule get params +func (o *AdminsRuleGetParams) WithTimeout(timeout time.Duration) *AdminsRuleGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the admins rule get params +func (o *AdminsRuleGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the admins rule get params +func (o *AdminsRuleGetParams) WithContext(ctx context.Context) *AdminsRuleGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the admins rule get params +func (o *AdminsRuleGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the admins rule get params +func (o *AdminsRuleGetParams) WithHTTPClient(client *http.Client) *AdminsRuleGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the admins rule get params +func (o *AdminsRuleGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *AdminsRuleGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/admins_rule_get_responses.go b/client/admin/admins_rule_get_responses.go new file mode 100644 index 0000000..11e4f15 --- /dev/null +++ b/client/admin/admins_rule_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AdminsRuleGetReader is a Reader for the AdminsRuleGet structure. +type AdminsRuleGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AdminsRuleGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAdminsRuleGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAdminsRuleGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAdminsRuleGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAdminsRuleGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAdminsRuleGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAdminsRuleGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/rules] adminsRuleGet", response, response.Code()) + } +} + +// NewAdminsRuleGetOK creates a AdminsRuleGetOK with default headers values +func NewAdminsRuleGetOK() *AdminsRuleGetOK { + return &AdminsRuleGetOK{} +} + +/* +AdminsRuleGetOK describes a response with status code 200, with default header values. + +An array with all the rules for the local instance. +*/ +type AdminsRuleGetOK struct { + Payload []*models.InstanceRule +} + +// IsSuccess returns true when this admins rule get o k response has a 2xx status code +func (o *AdminsRuleGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this admins rule get o k response has a 3xx status code +func (o *AdminsRuleGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get o k response has a 4xx status code +func (o *AdminsRuleGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this admins rule get o k response has a 5xx status code +func (o *AdminsRuleGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get o k response a status code equal to that given +func (o *AdminsRuleGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the admins rule get o k response +func (o *AdminsRuleGetOK) Code() int { + return 200 +} + +func (o *AdminsRuleGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetOK %s", 200, payload) +} + +func (o *AdminsRuleGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetOK %s", 200, payload) +} + +func (o *AdminsRuleGetOK) GetPayload() []*models.InstanceRule { + return o.Payload +} + +func (o *AdminsRuleGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAdminsRuleGetBadRequest creates a AdminsRuleGetBadRequest with default headers values +func NewAdminsRuleGetBadRequest() *AdminsRuleGetBadRequest { + return &AdminsRuleGetBadRequest{} +} + +/* +AdminsRuleGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AdminsRuleGetBadRequest struct { +} + +// IsSuccess returns true when this admins rule get bad request response has a 2xx status code +func (o *AdminsRuleGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get bad request response has a 3xx status code +func (o *AdminsRuleGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get bad request response has a 4xx status code +func (o *AdminsRuleGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get bad request response has a 5xx status code +func (o *AdminsRuleGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get bad request response a status code equal to that given +func (o *AdminsRuleGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the admins rule get bad request response +func (o *AdminsRuleGetBadRequest) Code() int { + return 400 +} + +func (o *AdminsRuleGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetBadRequest", 400) +} + +func (o *AdminsRuleGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetBadRequest", 400) +} + +func (o *AdminsRuleGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetUnauthorized creates a AdminsRuleGetUnauthorized with default headers values +func NewAdminsRuleGetUnauthorized() *AdminsRuleGetUnauthorized { + return &AdminsRuleGetUnauthorized{} +} + +/* +AdminsRuleGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AdminsRuleGetUnauthorized struct { +} + +// IsSuccess returns true when this admins rule get unauthorized response has a 2xx status code +func (o *AdminsRuleGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get unauthorized response has a 3xx status code +func (o *AdminsRuleGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get unauthorized response has a 4xx status code +func (o *AdminsRuleGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get unauthorized response has a 5xx status code +func (o *AdminsRuleGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get unauthorized response a status code equal to that given +func (o *AdminsRuleGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the admins rule get unauthorized response +func (o *AdminsRuleGetUnauthorized) Code() int { + return 401 +} + +func (o *AdminsRuleGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetUnauthorized", 401) +} + +func (o *AdminsRuleGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetUnauthorized", 401) +} + +func (o *AdminsRuleGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetNotFound creates a AdminsRuleGetNotFound with default headers values +func NewAdminsRuleGetNotFound() *AdminsRuleGetNotFound { + return &AdminsRuleGetNotFound{} +} + +/* +AdminsRuleGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AdminsRuleGetNotFound struct { +} + +// IsSuccess returns true when this admins rule get not found response has a 2xx status code +func (o *AdminsRuleGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get not found response has a 3xx status code +func (o *AdminsRuleGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get not found response has a 4xx status code +func (o *AdminsRuleGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get not found response has a 5xx status code +func (o *AdminsRuleGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get not found response a status code equal to that given +func (o *AdminsRuleGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the admins rule get not found response +func (o *AdminsRuleGetNotFound) Code() int { + return 404 +} + +func (o *AdminsRuleGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotFound", 404) +} + +func (o *AdminsRuleGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotFound", 404) +} + +func (o *AdminsRuleGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetNotAcceptable creates a AdminsRuleGetNotAcceptable with default headers values +func NewAdminsRuleGetNotAcceptable() *AdminsRuleGetNotAcceptable { + return &AdminsRuleGetNotAcceptable{} +} + +/* +AdminsRuleGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AdminsRuleGetNotAcceptable struct { +} + +// IsSuccess returns true when this admins rule get not acceptable response has a 2xx status code +func (o *AdminsRuleGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get not acceptable response has a 3xx status code +func (o *AdminsRuleGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get not acceptable response has a 4xx status code +func (o *AdminsRuleGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this admins rule get not acceptable response has a 5xx status code +func (o *AdminsRuleGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this admins rule get not acceptable response a status code equal to that given +func (o *AdminsRuleGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the admins rule get not acceptable response +func (o *AdminsRuleGetNotAcceptable) Code() int { + return 406 +} + +func (o *AdminsRuleGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotAcceptable", 406) +} + +func (o *AdminsRuleGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetNotAcceptable", 406) +} + +func (o *AdminsRuleGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAdminsRuleGetInternalServerError creates a AdminsRuleGetInternalServerError with default headers values +func NewAdminsRuleGetInternalServerError() *AdminsRuleGetInternalServerError { + return &AdminsRuleGetInternalServerError{} +} + +/* +AdminsRuleGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AdminsRuleGetInternalServerError struct { +} + +// IsSuccess returns true when this admins rule get internal server error response has a 2xx status code +func (o *AdminsRuleGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this admins rule get internal server error response has a 3xx status code +func (o *AdminsRuleGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this admins rule get internal server error response has a 4xx status code +func (o *AdminsRuleGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this admins rule get internal server error response has a 5xx status code +func (o *AdminsRuleGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this admins rule get internal server error response a status code equal to that given +func (o *AdminsRuleGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the admins rule get internal server error response +func (o *AdminsRuleGetInternalServerError) Code() int { + return 500 +} + +func (o *AdminsRuleGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetInternalServerError", 500) +} + +func (o *AdminsRuleGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/rules][%d] adminsRuleGetInternalServerError", 500) +} + +func (o *AdminsRuleGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_allow_create_parameters.go b/client/admin/domain_allow_create_parameters.go new file mode 100644 index 0000000..2f182be --- /dev/null +++ b/client/admin/domain_allow_create_parameters.go @@ -0,0 +1,330 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainAllowCreateParams creates a new DomainAllowCreateParams 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 NewDomainAllowCreateParams() *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowCreateParamsWithTimeout creates a new DomainAllowCreateParams object +// with the ability to set a timeout on a request. +func NewDomainAllowCreateParamsWithTimeout(timeout time.Duration) *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + timeout: timeout, + } +} + +// NewDomainAllowCreateParamsWithContext creates a new DomainAllowCreateParams object +// with the ability to set a context for a request. +func NewDomainAllowCreateParamsWithContext(ctx context.Context) *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + Context: ctx, + } +} + +// NewDomainAllowCreateParamsWithHTTPClient creates a new DomainAllowCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowCreateParamsWithHTTPClient(client *http.Client) *DomainAllowCreateParams { + return &DomainAllowCreateParams{ + HTTPClient: client, + } +} + +/* +DomainAllowCreateParams contains all the parameters to send to the API endpoint + + for the domain allow create operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowCreateParams struct { + + /* Domain. + + Single domain to allow. Used only if `import` is not `true`. + */ + Domain *string + + /* Domains. + + JSON-formatted list of domain allows to import. This is only used if `import` is set to `true`. + */ + Domains runtime.NamedReadCloser + + /* Import. + + Signal that a list of domain allows is being imported as a file. If set to `true`, then 'domains' must be present as a JSON-formatted file. If set to `false`, then `domains` will be ignored, and `domain` must be present. + */ + Import *bool + + /* Obfuscate. + + Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`. Used only if `import` is not `true`. + */ + Obfuscate *bool + + /* PrivateComment. + + Private comment about this domain allow. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up allowed. Used only if `import` is not `true`. + */ + PrivateComment *string + + /* PublicComment. + + Public comment about this domain allow. This will be displayed alongside the domain allow if you choose to share allows. Used only if `import` is not `true`. + */ + PublicComment *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowCreateParams) WithDefaults() *DomainAllowCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowCreateParams) SetDefaults() { + var ( + importVarDefault = bool(false) + ) + + val := DomainAllowCreateParams{ + Import: &importVarDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the domain allow create params +func (o *DomainAllowCreateParams) WithTimeout(timeout time.Duration) *DomainAllowCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allow create params +func (o *DomainAllowCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allow create params +func (o *DomainAllowCreateParams) WithContext(ctx context.Context) *DomainAllowCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allow create params +func (o *DomainAllowCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allow create params +func (o *DomainAllowCreateParams) WithHTTPClient(client *http.Client) *DomainAllowCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allow create params +func (o *DomainAllowCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the domain allow create params +func (o *DomainAllowCreateParams) WithDomain(domain *string) *DomainAllowCreateParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the domain allow create params +func (o *DomainAllowCreateParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithDomains adds the domains to the domain allow create params +func (o *DomainAllowCreateParams) WithDomains(domains runtime.NamedReadCloser) *DomainAllowCreateParams { + o.SetDomains(domains) + return o +} + +// SetDomains adds the domains to the domain allow create params +func (o *DomainAllowCreateParams) SetDomains(domains runtime.NamedReadCloser) { + o.Domains = domains +} + +// WithImport adds the importVar to the domain allow create params +func (o *DomainAllowCreateParams) WithImport(importVar *bool) *DomainAllowCreateParams { + o.SetImport(importVar) + return o +} + +// SetImport adds the import to the domain allow create params +func (o *DomainAllowCreateParams) SetImport(importVar *bool) { + o.Import = importVar +} + +// WithObfuscate adds the obfuscate to the domain allow create params +func (o *DomainAllowCreateParams) WithObfuscate(obfuscate *bool) *DomainAllowCreateParams { + o.SetObfuscate(obfuscate) + return o +} + +// SetObfuscate adds the obfuscate to the domain allow create params +func (o *DomainAllowCreateParams) SetObfuscate(obfuscate *bool) { + o.Obfuscate = obfuscate +} + +// WithPrivateComment adds the privateComment to the domain allow create params +func (o *DomainAllowCreateParams) WithPrivateComment(privateComment *string) *DomainAllowCreateParams { + o.SetPrivateComment(privateComment) + return o +} + +// SetPrivateComment adds the privateComment to the domain allow create params +func (o *DomainAllowCreateParams) SetPrivateComment(privateComment *string) { + o.PrivateComment = privateComment +} + +// WithPublicComment adds the publicComment to the domain allow create params +func (o *DomainAllowCreateParams) WithPublicComment(publicComment *string) *DomainAllowCreateParams { + o.SetPublicComment(publicComment) + return o +} + +// SetPublicComment adds the publicComment to the domain allow create params +func (o *DomainAllowCreateParams) SetPublicComment(publicComment *string) { + o.PublicComment = publicComment +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // form param domain + var frDomain string + if o.Domain != nil { + frDomain = *o.Domain + } + fDomain := frDomain + if fDomain != "" { + if err := r.SetFormParam("domain", fDomain); err != nil { + return err + } + } + } + + if o.Domains != nil { + + if o.Domains != nil { + // form file param domains + if err := r.SetFileParam("domains", o.Domains); err != nil { + return err + } + } + } + + if o.Import != nil { + + // query param import + var qrImport bool + + if o.Import != nil { + qrImport = *o.Import + } + qImport := swag.FormatBool(qrImport) + if qImport != "" { + + if err := r.SetQueryParam("import", qImport); err != nil { + return err + } + } + } + + if o.Obfuscate != nil { + + // form param obfuscate + var frObfuscate bool + if o.Obfuscate != nil { + frObfuscate = *o.Obfuscate + } + fObfuscate := swag.FormatBool(frObfuscate) + if fObfuscate != "" { + if err := r.SetFormParam("obfuscate", fObfuscate); err != nil { + return err + } + } + } + + if o.PrivateComment != nil { + + // form param private_comment + var frPrivateComment string + if o.PrivateComment != nil { + frPrivateComment = *o.PrivateComment + } + fPrivateComment := frPrivateComment + if fPrivateComment != "" { + if err := r.SetFormParam("private_comment", fPrivateComment); err != nil { + return err + } + } + } + + if o.PublicComment != nil { + + // form param public_comment + var frPublicComment string + if o.PublicComment != nil { + frPublicComment = *o.PublicComment + } + fPublicComment := frPublicComment + if fPublicComment != "" { + if err := r.SetFormParam("public_comment", fPublicComment); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_allow_create_responses.go b/client/admin/domain_allow_create_responses.go new file mode 100644 index 0000000..16f8a81 --- /dev/null +++ b/client/admin/domain_allow_create_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowCreateReader is a Reader for the DomainAllowCreate structure. +type DomainAllowCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainAllowCreateConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/domain_allows] domainAllowCreate", response, response.Code()) + } +} + +// NewDomainAllowCreateOK creates a DomainAllowCreateOK with default headers values +func NewDomainAllowCreateOK() *DomainAllowCreateOK { + return &DomainAllowCreateOK{} +} + +/* +DomainAllowCreateOK describes a response with status code 200, with default header values. + +The newly created domain allow, if `import` != `true`. If a list has been imported, then an `array` of newly created domain allows will be returned instead. +*/ +type DomainAllowCreateOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain allow create o k response has a 2xx status code +func (o *DomainAllowCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allow create o k response has a 3xx status code +func (o *DomainAllowCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create o k response has a 4xx status code +func (o *DomainAllowCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow create o k response has a 5xx status code +func (o *DomainAllowCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create o k response a status code equal to that given +func (o *DomainAllowCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allow create o k response +func (o *DomainAllowCreateOK) Code() int { + return 200 +} + +func (o *DomainAllowCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateOK %s", 200, payload) +} + +func (o *DomainAllowCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateOK %s", 200, payload) +} + +func (o *DomainAllowCreateOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainAllowCreateBadRequest creates a DomainAllowCreateBadRequest with default headers values +func NewDomainAllowCreateBadRequest() *DomainAllowCreateBadRequest { + return &DomainAllowCreateBadRequest{} +} + +/* +DomainAllowCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowCreateBadRequest struct { +} + +// IsSuccess returns true when this domain allow create bad request response has a 2xx status code +func (o *DomainAllowCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create bad request response has a 3xx status code +func (o *DomainAllowCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create bad request response has a 4xx status code +func (o *DomainAllowCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create bad request response has a 5xx status code +func (o *DomainAllowCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create bad request response a status code equal to that given +func (o *DomainAllowCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allow create bad request response +func (o *DomainAllowCreateBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateBadRequest", 400) +} + +func (o *DomainAllowCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateBadRequest", 400) +} + +func (o *DomainAllowCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateUnauthorized creates a DomainAllowCreateUnauthorized with default headers values +func NewDomainAllowCreateUnauthorized() *DomainAllowCreateUnauthorized { + return &DomainAllowCreateUnauthorized{} +} + +/* +DomainAllowCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowCreateUnauthorized struct { +} + +// IsSuccess returns true when this domain allow create unauthorized response has a 2xx status code +func (o *DomainAllowCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create unauthorized response has a 3xx status code +func (o *DomainAllowCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create unauthorized response has a 4xx status code +func (o *DomainAllowCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create unauthorized response has a 5xx status code +func (o *DomainAllowCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create unauthorized response a status code equal to that given +func (o *DomainAllowCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allow create unauthorized response +func (o *DomainAllowCreateUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateUnauthorized", 401) +} + +func (o *DomainAllowCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateUnauthorized", 401) +} + +func (o *DomainAllowCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateForbidden creates a DomainAllowCreateForbidden with default headers values +func NewDomainAllowCreateForbidden() *DomainAllowCreateForbidden { + return &DomainAllowCreateForbidden{} +} + +/* +DomainAllowCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowCreateForbidden struct { +} + +// IsSuccess returns true when this domain allow create forbidden response has a 2xx status code +func (o *DomainAllowCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create forbidden response has a 3xx status code +func (o *DomainAllowCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create forbidden response has a 4xx status code +func (o *DomainAllowCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create forbidden response has a 5xx status code +func (o *DomainAllowCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create forbidden response a status code equal to that given +func (o *DomainAllowCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allow create forbidden response +func (o *DomainAllowCreateForbidden) Code() int { + return 403 +} + +func (o *DomainAllowCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateForbidden", 403) +} + +func (o *DomainAllowCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateForbidden", 403) +} + +func (o *DomainAllowCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateNotFound creates a DomainAllowCreateNotFound with default headers values +func NewDomainAllowCreateNotFound() *DomainAllowCreateNotFound { + return &DomainAllowCreateNotFound{} +} + +/* +DomainAllowCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowCreateNotFound struct { +} + +// IsSuccess returns true when this domain allow create not found response has a 2xx status code +func (o *DomainAllowCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create not found response has a 3xx status code +func (o *DomainAllowCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create not found response has a 4xx status code +func (o *DomainAllowCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create not found response has a 5xx status code +func (o *DomainAllowCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create not found response a status code equal to that given +func (o *DomainAllowCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allow create not found response +func (o *DomainAllowCreateNotFound) Code() int { + return 404 +} + +func (o *DomainAllowCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotFound", 404) +} + +func (o *DomainAllowCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotFound", 404) +} + +func (o *DomainAllowCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateNotAcceptable creates a DomainAllowCreateNotAcceptable with default headers values +func NewDomainAllowCreateNotAcceptable() *DomainAllowCreateNotAcceptable { + return &DomainAllowCreateNotAcceptable{} +} + +/* +DomainAllowCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowCreateNotAcceptable struct { +} + +// IsSuccess returns true when this domain allow create not acceptable response has a 2xx status code +func (o *DomainAllowCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create not acceptable response has a 3xx status code +func (o *DomainAllowCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create not acceptable response has a 4xx status code +func (o *DomainAllowCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create not acceptable response has a 5xx status code +func (o *DomainAllowCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create not acceptable response a status code equal to that given +func (o *DomainAllowCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allow create not acceptable response +func (o *DomainAllowCreateNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotAcceptable", 406) +} + +func (o *DomainAllowCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateNotAcceptable", 406) +} + +func (o *DomainAllowCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateConflict creates a DomainAllowCreateConflict with default headers values +func NewDomainAllowCreateConflict() *DomainAllowCreateConflict { + return &DomainAllowCreateConflict{} +} + +/* +DomainAllowCreateConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainAllowCreateConflict struct { +} + +// IsSuccess returns true when this domain allow create conflict response has a 2xx status code +func (o *DomainAllowCreateConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create conflict response has a 3xx status code +func (o *DomainAllowCreateConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create conflict response has a 4xx status code +func (o *DomainAllowCreateConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow create conflict response has a 5xx status code +func (o *DomainAllowCreateConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow create conflict response a status code equal to that given +func (o *DomainAllowCreateConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain allow create conflict response +func (o *DomainAllowCreateConflict) Code() int { + return 409 +} + +func (o *DomainAllowCreateConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateConflict", 409) +} + +func (o *DomainAllowCreateConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateConflict", 409) +} + +func (o *DomainAllowCreateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowCreateInternalServerError creates a DomainAllowCreateInternalServerError with default headers values +func NewDomainAllowCreateInternalServerError() *DomainAllowCreateInternalServerError { + return &DomainAllowCreateInternalServerError{} +} + +/* +DomainAllowCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowCreateInternalServerError struct { +} + +// IsSuccess returns true when this domain allow create internal server error response has a 2xx status code +func (o *DomainAllowCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow create internal server error response has a 3xx status code +func (o *DomainAllowCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow create internal server error response has a 4xx status code +func (o *DomainAllowCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow create internal server error response has a 5xx status code +func (o *DomainAllowCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allow create internal server error response a status code equal to that given +func (o *DomainAllowCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allow create internal server error response +func (o *DomainAllowCreateInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateInternalServerError", 500) +} + +func (o *DomainAllowCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_allows][%d] domainAllowCreateInternalServerError", 500) +} + +func (o *DomainAllowCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_allow_delete_parameters.go b/client/admin/domain_allow_delete_parameters.go new file mode 100644 index 0000000..9e6003e --- /dev/null +++ b/client/admin/domain_allow_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainAllowDeleteParams creates a new DomainAllowDeleteParams 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 NewDomainAllowDeleteParams() *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowDeleteParamsWithTimeout creates a new DomainAllowDeleteParams object +// with the ability to set a timeout on a request. +func NewDomainAllowDeleteParamsWithTimeout(timeout time.Duration) *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + timeout: timeout, + } +} + +// NewDomainAllowDeleteParamsWithContext creates a new DomainAllowDeleteParams object +// with the ability to set a context for a request. +func NewDomainAllowDeleteParamsWithContext(ctx context.Context) *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + Context: ctx, + } +} + +// NewDomainAllowDeleteParamsWithHTTPClient creates a new DomainAllowDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowDeleteParamsWithHTTPClient(client *http.Client) *DomainAllowDeleteParams { + return &DomainAllowDeleteParams{ + HTTPClient: client, + } +} + +/* +DomainAllowDeleteParams contains all the parameters to send to the API endpoint + + for the domain allow delete operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowDeleteParams struct { + + /* ID. + + The id of the domain allow. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowDeleteParams) WithDefaults() *DomainAllowDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain allow delete params +func (o *DomainAllowDeleteParams) WithTimeout(timeout time.Duration) *DomainAllowDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allow delete params +func (o *DomainAllowDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allow delete params +func (o *DomainAllowDeleteParams) WithContext(ctx context.Context) *DomainAllowDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allow delete params +func (o *DomainAllowDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allow delete params +func (o *DomainAllowDeleteParams) WithHTTPClient(client *http.Client) *DomainAllowDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allow delete params +func (o *DomainAllowDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain allow delete params +func (o *DomainAllowDeleteParams) WithID(id string) *DomainAllowDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain allow delete params +func (o *DomainAllowDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_allow_delete_responses.go b/client/admin/domain_allow_delete_responses.go new file mode 100644 index 0000000..5a0e83c --- /dev/null +++ b/client/admin/domain_allow_delete_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowDeleteReader is a Reader for the DomainAllowDelete structure. +type DomainAllowDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainAllowDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/domain_allows/{id}] domainAllowDelete", response, response.Code()) + } +} + +// NewDomainAllowDeleteOK creates a DomainAllowDeleteOK with default headers values +func NewDomainAllowDeleteOK() *DomainAllowDeleteOK { + return &DomainAllowDeleteOK{} +} + +/* +DomainAllowDeleteOK describes a response with status code 200, with default header values. + +The domain allow that was just deleted. +*/ +type DomainAllowDeleteOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain allow delete o k response has a 2xx status code +func (o *DomainAllowDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allow delete o k response has a 3xx status code +func (o *DomainAllowDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete o k response has a 4xx status code +func (o *DomainAllowDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow delete o k response has a 5xx status code +func (o *DomainAllowDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete o k response a status code equal to that given +func (o *DomainAllowDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allow delete o k response +func (o *DomainAllowDeleteOK) Code() int { + return 200 +} + +func (o *DomainAllowDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteOK %s", 200, payload) +} + +func (o *DomainAllowDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteOK %s", 200, payload) +} + +func (o *DomainAllowDeleteOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainAllowDeleteBadRequest creates a DomainAllowDeleteBadRequest with default headers values +func NewDomainAllowDeleteBadRequest() *DomainAllowDeleteBadRequest { + return &DomainAllowDeleteBadRequest{} +} + +/* +DomainAllowDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowDeleteBadRequest struct { +} + +// IsSuccess returns true when this domain allow delete bad request response has a 2xx status code +func (o *DomainAllowDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete bad request response has a 3xx status code +func (o *DomainAllowDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete bad request response has a 4xx status code +func (o *DomainAllowDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete bad request response has a 5xx status code +func (o *DomainAllowDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete bad request response a status code equal to that given +func (o *DomainAllowDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allow delete bad request response +func (o *DomainAllowDeleteBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteBadRequest", 400) +} + +func (o *DomainAllowDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteBadRequest", 400) +} + +func (o *DomainAllowDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteUnauthorized creates a DomainAllowDeleteUnauthorized with default headers values +func NewDomainAllowDeleteUnauthorized() *DomainAllowDeleteUnauthorized { + return &DomainAllowDeleteUnauthorized{} +} + +/* +DomainAllowDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowDeleteUnauthorized struct { +} + +// IsSuccess returns true when this domain allow delete unauthorized response has a 2xx status code +func (o *DomainAllowDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete unauthorized response has a 3xx status code +func (o *DomainAllowDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete unauthorized response has a 4xx status code +func (o *DomainAllowDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete unauthorized response has a 5xx status code +func (o *DomainAllowDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete unauthorized response a status code equal to that given +func (o *DomainAllowDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allow delete unauthorized response +func (o *DomainAllowDeleteUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteUnauthorized", 401) +} + +func (o *DomainAllowDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteUnauthorized", 401) +} + +func (o *DomainAllowDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteForbidden creates a DomainAllowDeleteForbidden with default headers values +func NewDomainAllowDeleteForbidden() *DomainAllowDeleteForbidden { + return &DomainAllowDeleteForbidden{} +} + +/* +DomainAllowDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowDeleteForbidden struct { +} + +// IsSuccess returns true when this domain allow delete forbidden response has a 2xx status code +func (o *DomainAllowDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete forbidden response has a 3xx status code +func (o *DomainAllowDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete forbidden response has a 4xx status code +func (o *DomainAllowDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete forbidden response has a 5xx status code +func (o *DomainAllowDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete forbidden response a status code equal to that given +func (o *DomainAllowDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allow delete forbidden response +func (o *DomainAllowDeleteForbidden) Code() int { + return 403 +} + +func (o *DomainAllowDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteForbidden", 403) +} + +func (o *DomainAllowDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteForbidden", 403) +} + +func (o *DomainAllowDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteNotFound creates a DomainAllowDeleteNotFound with default headers values +func NewDomainAllowDeleteNotFound() *DomainAllowDeleteNotFound { + return &DomainAllowDeleteNotFound{} +} + +/* +DomainAllowDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowDeleteNotFound struct { +} + +// IsSuccess returns true when this domain allow delete not found response has a 2xx status code +func (o *DomainAllowDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete not found response has a 3xx status code +func (o *DomainAllowDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete not found response has a 4xx status code +func (o *DomainAllowDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete not found response has a 5xx status code +func (o *DomainAllowDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete not found response a status code equal to that given +func (o *DomainAllowDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allow delete not found response +func (o *DomainAllowDeleteNotFound) Code() int { + return 404 +} + +func (o *DomainAllowDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotFound", 404) +} + +func (o *DomainAllowDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotFound", 404) +} + +func (o *DomainAllowDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteNotAcceptable creates a DomainAllowDeleteNotAcceptable with default headers values +func NewDomainAllowDeleteNotAcceptable() *DomainAllowDeleteNotAcceptable { + return &DomainAllowDeleteNotAcceptable{} +} + +/* +DomainAllowDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this domain allow delete not acceptable response has a 2xx status code +func (o *DomainAllowDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete not acceptable response has a 3xx status code +func (o *DomainAllowDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete not acceptable response has a 4xx status code +func (o *DomainAllowDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete not acceptable response has a 5xx status code +func (o *DomainAllowDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete not acceptable response a status code equal to that given +func (o *DomainAllowDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allow delete not acceptable response +func (o *DomainAllowDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotAcceptable", 406) +} + +func (o *DomainAllowDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteNotAcceptable", 406) +} + +func (o *DomainAllowDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteConflict creates a DomainAllowDeleteConflict with default headers values +func NewDomainAllowDeleteConflict() *DomainAllowDeleteConflict { + return &DomainAllowDeleteConflict{} +} + +/* +DomainAllowDeleteConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainAllowDeleteConflict struct { +} + +// IsSuccess returns true when this domain allow delete conflict response has a 2xx status code +func (o *DomainAllowDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete conflict response has a 3xx status code +func (o *DomainAllowDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete conflict response has a 4xx status code +func (o *DomainAllowDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow delete conflict response has a 5xx status code +func (o *DomainAllowDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow delete conflict response a status code equal to that given +func (o *DomainAllowDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain allow delete conflict response +func (o *DomainAllowDeleteConflict) Code() int { + return 409 +} + +func (o *DomainAllowDeleteConflict) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteConflict", 409) +} + +func (o *DomainAllowDeleteConflict) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteConflict", 409) +} + +func (o *DomainAllowDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowDeleteInternalServerError creates a DomainAllowDeleteInternalServerError with default headers values +func NewDomainAllowDeleteInternalServerError() *DomainAllowDeleteInternalServerError { + return &DomainAllowDeleteInternalServerError{} +} + +/* +DomainAllowDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowDeleteInternalServerError struct { +} + +// IsSuccess returns true when this domain allow delete internal server error response has a 2xx status code +func (o *DomainAllowDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow delete internal server error response has a 3xx status code +func (o *DomainAllowDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow delete internal server error response has a 4xx status code +func (o *DomainAllowDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow delete internal server error response has a 5xx status code +func (o *DomainAllowDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allow delete internal server error response a status code equal to that given +func (o *DomainAllowDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allow delete internal server error response +func (o *DomainAllowDeleteInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteInternalServerError", 500) +} + +func (o *DomainAllowDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_allows/{id}][%d] domainAllowDeleteInternalServerError", 500) +} + +func (o *DomainAllowDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_allow_get_parameters.go b/client/admin/domain_allow_get_parameters.go new file mode 100644 index 0000000..cd3a7b2 --- /dev/null +++ b/client/admin/domain_allow_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainAllowGetParams creates a new DomainAllowGetParams 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 NewDomainAllowGetParams() *DomainAllowGetParams { + return &DomainAllowGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowGetParamsWithTimeout creates a new DomainAllowGetParams object +// with the ability to set a timeout on a request. +func NewDomainAllowGetParamsWithTimeout(timeout time.Duration) *DomainAllowGetParams { + return &DomainAllowGetParams{ + timeout: timeout, + } +} + +// NewDomainAllowGetParamsWithContext creates a new DomainAllowGetParams object +// with the ability to set a context for a request. +func NewDomainAllowGetParamsWithContext(ctx context.Context) *DomainAllowGetParams { + return &DomainAllowGetParams{ + Context: ctx, + } +} + +// NewDomainAllowGetParamsWithHTTPClient creates a new DomainAllowGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowGetParamsWithHTTPClient(client *http.Client) *DomainAllowGetParams { + return &DomainAllowGetParams{ + HTTPClient: client, + } +} + +/* +DomainAllowGetParams contains all the parameters to send to the API endpoint + + for the domain allow get operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowGetParams struct { + + /* ID. + + The id of the domain allow. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowGetParams) WithDefaults() *DomainAllowGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain allow get params +func (o *DomainAllowGetParams) WithTimeout(timeout time.Duration) *DomainAllowGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allow get params +func (o *DomainAllowGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allow get params +func (o *DomainAllowGetParams) WithContext(ctx context.Context) *DomainAllowGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allow get params +func (o *DomainAllowGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allow get params +func (o *DomainAllowGetParams) WithHTTPClient(client *http.Client) *DomainAllowGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allow get params +func (o *DomainAllowGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain allow get params +func (o *DomainAllowGetParams) WithID(id string) *DomainAllowGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain allow get params +func (o *DomainAllowGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_allow_get_responses.go b/client/admin/domain_allow_get_responses.go new file mode 100644 index 0000000..74b5c89 --- /dev/null +++ b/client/admin/domain_allow_get_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowGetReader is a Reader for the DomainAllowGet structure. +type DomainAllowGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_allows/{id}] domainAllowGet", response, response.Code()) + } +} + +// NewDomainAllowGetOK creates a DomainAllowGetOK with default headers values +func NewDomainAllowGetOK() *DomainAllowGetOK { + return &DomainAllowGetOK{} +} + +/* +DomainAllowGetOK describes a response with status code 200, with default header values. + +The requested domain allow. +*/ +type DomainAllowGetOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain allow get o k response has a 2xx status code +func (o *DomainAllowGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allow get o k response has a 3xx status code +func (o *DomainAllowGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get o k response has a 4xx status code +func (o *DomainAllowGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow get o k response has a 5xx status code +func (o *DomainAllowGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get o k response a status code equal to that given +func (o *DomainAllowGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allow get o k response +func (o *DomainAllowGetOK) Code() int { + return 200 +} + +func (o *DomainAllowGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetOK %s", 200, payload) +} + +func (o *DomainAllowGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetOK %s", 200, payload) +} + +func (o *DomainAllowGetOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainAllowGetBadRequest creates a DomainAllowGetBadRequest with default headers values +func NewDomainAllowGetBadRequest() *DomainAllowGetBadRequest { + return &DomainAllowGetBadRequest{} +} + +/* +DomainAllowGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowGetBadRequest struct { +} + +// IsSuccess returns true when this domain allow get bad request response has a 2xx status code +func (o *DomainAllowGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get bad request response has a 3xx status code +func (o *DomainAllowGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get bad request response has a 4xx status code +func (o *DomainAllowGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get bad request response has a 5xx status code +func (o *DomainAllowGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get bad request response a status code equal to that given +func (o *DomainAllowGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allow get bad request response +func (o *DomainAllowGetBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetBadRequest", 400) +} + +func (o *DomainAllowGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetBadRequest", 400) +} + +func (o *DomainAllowGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetUnauthorized creates a DomainAllowGetUnauthorized with default headers values +func NewDomainAllowGetUnauthorized() *DomainAllowGetUnauthorized { + return &DomainAllowGetUnauthorized{} +} + +/* +DomainAllowGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowGetUnauthorized struct { +} + +// IsSuccess returns true when this domain allow get unauthorized response has a 2xx status code +func (o *DomainAllowGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get unauthorized response has a 3xx status code +func (o *DomainAllowGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get unauthorized response has a 4xx status code +func (o *DomainAllowGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get unauthorized response has a 5xx status code +func (o *DomainAllowGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get unauthorized response a status code equal to that given +func (o *DomainAllowGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allow get unauthorized response +func (o *DomainAllowGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetUnauthorized", 401) +} + +func (o *DomainAllowGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetUnauthorized", 401) +} + +func (o *DomainAllowGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetForbidden creates a DomainAllowGetForbidden with default headers values +func NewDomainAllowGetForbidden() *DomainAllowGetForbidden { + return &DomainAllowGetForbidden{} +} + +/* +DomainAllowGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowGetForbidden struct { +} + +// IsSuccess returns true when this domain allow get forbidden response has a 2xx status code +func (o *DomainAllowGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get forbidden response has a 3xx status code +func (o *DomainAllowGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get forbidden response has a 4xx status code +func (o *DomainAllowGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get forbidden response has a 5xx status code +func (o *DomainAllowGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get forbidden response a status code equal to that given +func (o *DomainAllowGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allow get forbidden response +func (o *DomainAllowGetForbidden) Code() int { + return 403 +} + +func (o *DomainAllowGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetForbidden", 403) +} + +func (o *DomainAllowGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetForbidden", 403) +} + +func (o *DomainAllowGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetNotFound creates a DomainAllowGetNotFound with default headers values +func NewDomainAllowGetNotFound() *DomainAllowGetNotFound { + return &DomainAllowGetNotFound{} +} + +/* +DomainAllowGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowGetNotFound struct { +} + +// IsSuccess returns true when this domain allow get not found response has a 2xx status code +func (o *DomainAllowGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get not found response has a 3xx status code +func (o *DomainAllowGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get not found response has a 4xx status code +func (o *DomainAllowGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get not found response has a 5xx status code +func (o *DomainAllowGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get not found response a status code equal to that given +func (o *DomainAllowGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allow get not found response +func (o *DomainAllowGetNotFound) Code() int { + return 404 +} + +func (o *DomainAllowGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotFound", 404) +} + +func (o *DomainAllowGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotFound", 404) +} + +func (o *DomainAllowGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetNotAcceptable creates a DomainAllowGetNotAcceptable with default headers values +func NewDomainAllowGetNotAcceptable() *DomainAllowGetNotAcceptable { + return &DomainAllowGetNotAcceptable{} +} + +/* +DomainAllowGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain allow get not acceptable response has a 2xx status code +func (o *DomainAllowGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get not acceptable response has a 3xx status code +func (o *DomainAllowGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get not acceptable response has a 4xx status code +func (o *DomainAllowGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allow get not acceptable response has a 5xx status code +func (o *DomainAllowGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allow get not acceptable response a status code equal to that given +func (o *DomainAllowGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allow get not acceptable response +func (o *DomainAllowGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotAcceptable", 406) +} + +func (o *DomainAllowGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetNotAcceptable", 406) +} + +func (o *DomainAllowGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowGetInternalServerError creates a DomainAllowGetInternalServerError with default headers values +func NewDomainAllowGetInternalServerError() *DomainAllowGetInternalServerError { + return &DomainAllowGetInternalServerError{} +} + +/* +DomainAllowGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowGetInternalServerError struct { +} + +// IsSuccess returns true when this domain allow get internal server error response has a 2xx status code +func (o *DomainAllowGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allow get internal server error response has a 3xx status code +func (o *DomainAllowGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allow get internal server error response has a 4xx status code +func (o *DomainAllowGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allow get internal server error response has a 5xx status code +func (o *DomainAllowGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allow get internal server error response a status code equal to that given +func (o *DomainAllowGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allow get internal server error response +func (o *DomainAllowGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetInternalServerError", 500) +} + +func (o *DomainAllowGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows/{id}][%d] domainAllowGetInternalServerError", 500) +} + +func (o *DomainAllowGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_allows_get_parameters.go b/client/admin/domain_allows_get_parameters.go new file mode 100644 index 0000000..9b78461 --- /dev/null +++ b/client/admin/domain_allows_get_parameters.go @@ -0,0 +1,164 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainAllowsGetParams creates a new DomainAllowsGetParams 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 NewDomainAllowsGetParams() *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainAllowsGetParamsWithTimeout creates a new DomainAllowsGetParams object +// with the ability to set a timeout on a request. +func NewDomainAllowsGetParamsWithTimeout(timeout time.Duration) *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + timeout: timeout, + } +} + +// NewDomainAllowsGetParamsWithContext creates a new DomainAllowsGetParams object +// with the ability to set a context for a request. +func NewDomainAllowsGetParamsWithContext(ctx context.Context) *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + Context: ctx, + } +} + +// NewDomainAllowsGetParamsWithHTTPClient creates a new DomainAllowsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainAllowsGetParamsWithHTTPClient(client *http.Client) *DomainAllowsGetParams { + return &DomainAllowsGetParams{ + HTTPClient: client, + } +} + +/* +DomainAllowsGetParams contains all the parameters to send to the API endpoint + + for the domain allows get operation. + + Typically these are written to a http.Request. +*/ +type DomainAllowsGetParams struct { + + /* Export. + + If set to `true`, then each entry in the returned list of domain allows will only consist of the fields `domain` and `public_comment`. This is perfect for when you want to save and share a list of all the domains you have allowed on your instance, so that someone else can easily import them, but you don't want them to see the database IDs of your allows, or private comments etc. + */ + Export *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowsGetParams) WithDefaults() *DomainAllowsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainAllowsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain allows get params +func (o *DomainAllowsGetParams) WithTimeout(timeout time.Duration) *DomainAllowsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain allows get params +func (o *DomainAllowsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain allows get params +func (o *DomainAllowsGetParams) WithContext(ctx context.Context) *DomainAllowsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain allows get params +func (o *DomainAllowsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain allows get params +func (o *DomainAllowsGetParams) WithHTTPClient(client *http.Client) *DomainAllowsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain allows get params +func (o *DomainAllowsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExport adds the export to the domain allows get params +func (o *DomainAllowsGetParams) WithExport(export *bool) *DomainAllowsGetParams { + o.SetExport(export) + return o +} + +// SetExport adds the export to the domain allows get params +func (o *DomainAllowsGetParams) SetExport(export *bool) { + o.Export = export +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainAllowsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Export != nil { + + // query param export + var qrExport bool + + if o.Export != nil { + qrExport = *o.Export + } + qExport := swag.FormatBool(qrExport) + if qExport != "" { + + if err := r.SetQueryParam("export", qExport); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_allows_get_responses.go b/client/admin/domain_allows_get_responses.go new file mode 100644 index 0000000..a4512c1 --- /dev/null +++ b/client/admin/domain_allows_get_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainAllowsGetReader is a Reader for the DomainAllowsGet structure. +type DomainAllowsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainAllowsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainAllowsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainAllowsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainAllowsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainAllowsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainAllowsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainAllowsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainAllowsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_allows] domainAllowsGet", response, response.Code()) + } +} + +// NewDomainAllowsGetOK creates a DomainAllowsGetOK with default headers values +func NewDomainAllowsGetOK() *DomainAllowsGetOK { + return &DomainAllowsGetOK{} +} + +/* +DomainAllowsGetOK describes a response with status code 200, with default header values. + +All domain allows currently in place. +*/ +type DomainAllowsGetOK struct { + Payload []*models.DomainPermission +} + +// IsSuccess returns true when this domain allows get o k response has a 2xx status code +func (o *DomainAllowsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain allows get o k response has a 3xx status code +func (o *DomainAllowsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get o k response has a 4xx status code +func (o *DomainAllowsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allows get o k response has a 5xx status code +func (o *DomainAllowsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get o k response a status code equal to that given +func (o *DomainAllowsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain allows get o k response +func (o *DomainAllowsGetOK) Code() int { + return 200 +} + +func (o *DomainAllowsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetOK %s", 200, payload) +} + +func (o *DomainAllowsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetOK %s", 200, payload) +} + +func (o *DomainAllowsGetOK) GetPayload() []*models.DomainPermission { + return o.Payload +} + +func (o *DomainAllowsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainAllowsGetBadRequest creates a DomainAllowsGetBadRequest with default headers values +func NewDomainAllowsGetBadRequest() *DomainAllowsGetBadRequest { + return &DomainAllowsGetBadRequest{} +} + +/* +DomainAllowsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainAllowsGetBadRequest struct { +} + +// IsSuccess returns true when this domain allows get bad request response has a 2xx status code +func (o *DomainAllowsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get bad request response has a 3xx status code +func (o *DomainAllowsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get bad request response has a 4xx status code +func (o *DomainAllowsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get bad request response has a 5xx status code +func (o *DomainAllowsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get bad request response a status code equal to that given +func (o *DomainAllowsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain allows get bad request response +func (o *DomainAllowsGetBadRequest) Code() int { + return 400 +} + +func (o *DomainAllowsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetBadRequest", 400) +} + +func (o *DomainAllowsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetBadRequest", 400) +} + +func (o *DomainAllowsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetUnauthorized creates a DomainAllowsGetUnauthorized with default headers values +func NewDomainAllowsGetUnauthorized() *DomainAllowsGetUnauthorized { + return &DomainAllowsGetUnauthorized{} +} + +/* +DomainAllowsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainAllowsGetUnauthorized struct { +} + +// IsSuccess returns true when this domain allows get unauthorized response has a 2xx status code +func (o *DomainAllowsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get unauthorized response has a 3xx status code +func (o *DomainAllowsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get unauthorized response has a 4xx status code +func (o *DomainAllowsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get unauthorized response has a 5xx status code +func (o *DomainAllowsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get unauthorized response a status code equal to that given +func (o *DomainAllowsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain allows get unauthorized response +func (o *DomainAllowsGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainAllowsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetUnauthorized", 401) +} + +func (o *DomainAllowsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetUnauthorized", 401) +} + +func (o *DomainAllowsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetForbidden creates a DomainAllowsGetForbidden with default headers values +func NewDomainAllowsGetForbidden() *DomainAllowsGetForbidden { + return &DomainAllowsGetForbidden{} +} + +/* +DomainAllowsGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainAllowsGetForbidden struct { +} + +// IsSuccess returns true when this domain allows get forbidden response has a 2xx status code +func (o *DomainAllowsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get forbidden response has a 3xx status code +func (o *DomainAllowsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get forbidden response has a 4xx status code +func (o *DomainAllowsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get forbidden response has a 5xx status code +func (o *DomainAllowsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get forbidden response a status code equal to that given +func (o *DomainAllowsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain allows get forbidden response +func (o *DomainAllowsGetForbidden) Code() int { + return 403 +} + +func (o *DomainAllowsGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetForbidden", 403) +} + +func (o *DomainAllowsGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetForbidden", 403) +} + +func (o *DomainAllowsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetNotFound creates a DomainAllowsGetNotFound with default headers values +func NewDomainAllowsGetNotFound() *DomainAllowsGetNotFound { + return &DomainAllowsGetNotFound{} +} + +/* +DomainAllowsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainAllowsGetNotFound struct { +} + +// IsSuccess returns true when this domain allows get not found response has a 2xx status code +func (o *DomainAllowsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get not found response has a 3xx status code +func (o *DomainAllowsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get not found response has a 4xx status code +func (o *DomainAllowsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get not found response has a 5xx status code +func (o *DomainAllowsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get not found response a status code equal to that given +func (o *DomainAllowsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain allows get not found response +func (o *DomainAllowsGetNotFound) Code() int { + return 404 +} + +func (o *DomainAllowsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotFound", 404) +} + +func (o *DomainAllowsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotFound", 404) +} + +func (o *DomainAllowsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetNotAcceptable creates a DomainAllowsGetNotAcceptable with default headers values +func NewDomainAllowsGetNotAcceptable() *DomainAllowsGetNotAcceptable { + return &DomainAllowsGetNotAcceptable{} +} + +/* +DomainAllowsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainAllowsGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain allows get not acceptable response has a 2xx status code +func (o *DomainAllowsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get not acceptable response has a 3xx status code +func (o *DomainAllowsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get not acceptable response has a 4xx status code +func (o *DomainAllowsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain allows get not acceptable response has a 5xx status code +func (o *DomainAllowsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain allows get not acceptable response a status code equal to that given +func (o *DomainAllowsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain allows get not acceptable response +func (o *DomainAllowsGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainAllowsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotAcceptable", 406) +} + +func (o *DomainAllowsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetNotAcceptable", 406) +} + +func (o *DomainAllowsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainAllowsGetInternalServerError creates a DomainAllowsGetInternalServerError with default headers values +func NewDomainAllowsGetInternalServerError() *DomainAllowsGetInternalServerError { + return &DomainAllowsGetInternalServerError{} +} + +/* +DomainAllowsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainAllowsGetInternalServerError struct { +} + +// IsSuccess returns true when this domain allows get internal server error response has a 2xx status code +func (o *DomainAllowsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain allows get internal server error response has a 3xx status code +func (o *DomainAllowsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain allows get internal server error response has a 4xx status code +func (o *DomainAllowsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain allows get internal server error response has a 5xx status code +func (o *DomainAllowsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain allows get internal server error response a status code equal to that given +func (o *DomainAllowsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain allows get internal server error response +func (o *DomainAllowsGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainAllowsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetInternalServerError", 500) +} + +func (o *DomainAllowsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_allows][%d] domainAllowsGetInternalServerError", 500) +} + +func (o *DomainAllowsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_block_create_parameters.go b/client/admin/domain_block_create_parameters.go new file mode 100644 index 0000000..383a247 --- /dev/null +++ b/client/admin/domain_block_create_parameters.go @@ -0,0 +1,330 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainBlockCreateParams creates a new DomainBlockCreateParams 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 NewDomainBlockCreateParams() *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlockCreateParamsWithTimeout creates a new DomainBlockCreateParams object +// with the ability to set a timeout on a request. +func NewDomainBlockCreateParamsWithTimeout(timeout time.Duration) *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + timeout: timeout, + } +} + +// NewDomainBlockCreateParamsWithContext creates a new DomainBlockCreateParams object +// with the ability to set a context for a request. +func NewDomainBlockCreateParamsWithContext(ctx context.Context) *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + Context: ctx, + } +} + +// NewDomainBlockCreateParamsWithHTTPClient creates a new DomainBlockCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlockCreateParamsWithHTTPClient(client *http.Client) *DomainBlockCreateParams { + return &DomainBlockCreateParams{ + HTTPClient: client, + } +} + +/* +DomainBlockCreateParams contains all the parameters to send to the API endpoint + + for the domain block create operation. + + Typically these are written to a http.Request. +*/ +type DomainBlockCreateParams struct { + + /* Domain. + + Single domain to block. Used only if `import` is not `true`. + */ + Domain *string + + /* Domains. + + JSON-formatted list of domain blocks to import. This is only used if `import` is set to `true`. + */ + Domains runtime.NamedReadCloser + + /* Import. + + Signal that a list of domain blocks is being imported as a file. If set to `true`, then 'domains' must be present as a JSON-formatted file. If set to `false`, then `domains` will be ignored, and `domain` must be present. + */ + Import *bool + + /* Obfuscate. + + Obfuscate the name of the domain when serving it publicly. Eg., `example.org` becomes something like `ex***e.org`. Used only if `import` is not `true`. + */ + Obfuscate *bool + + /* PrivateComment. + + Private comment about this domain block. Will only be shown to other admins, so this is a useful way of internally keeping track of why a certain domain ended up blocked. Used only if `import` is not `true`. + */ + PrivateComment *string + + /* PublicComment. + + Public comment about this domain block. This will be displayed alongside the domain block if you choose to share blocks. Used only if `import` is not `true`. + */ + PublicComment *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockCreateParams) WithDefaults() *DomainBlockCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockCreateParams) SetDefaults() { + var ( + importVarDefault = bool(false) + ) + + val := DomainBlockCreateParams{ + Import: &importVarDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the domain block create params +func (o *DomainBlockCreateParams) WithTimeout(timeout time.Duration) *DomainBlockCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain block create params +func (o *DomainBlockCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain block create params +func (o *DomainBlockCreateParams) WithContext(ctx context.Context) *DomainBlockCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain block create params +func (o *DomainBlockCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain block create params +func (o *DomainBlockCreateParams) WithHTTPClient(client *http.Client) *DomainBlockCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain block create params +func (o *DomainBlockCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the domain block create params +func (o *DomainBlockCreateParams) WithDomain(domain *string) *DomainBlockCreateParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the domain block create params +func (o *DomainBlockCreateParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WithDomains adds the domains to the domain block create params +func (o *DomainBlockCreateParams) WithDomains(domains runtime.NamedReadCloser) *DomainBlockCreateParams { + o.SetDomains(domains) + return o +} + +// SetDomains adds the domains to the domain block create params +func (o *DomainBlockCreateParams) SetDomains(domains runtime.NamedReadCloser) { + o.Domains = domains +} + +// WithImport adds the importVar to the domain block create params +func (o *DomainBlockCreateParams) WithImport(importVar *bool) *DomainBlockCreateParams { + o.SetImport(importVar) + return o +} + +// SetImport adds the import to the domain block create params +func (o *DomainBlockCreateParams) SetImport(importVar *bool) { + o.Import = importVar +} + +// WithObfuscate adds the obfuscate to the domain block create params +func (o *DomainBlockCreateParams) WithObfuscate(obfuscate *bool) *DomainBlockCreateParams { + o.SetObfuscate(obfuscate) + return o +} + +// SetObfuscate adds the obfuscate to the domain block create params +func (o *DomainBlockCreateParams) SetObfuscate(obfuscate *bool) { + o.Obfuscate = obfuscate +} + +// WithPrivateComment adds the privateComment to the domain block create params +func (o *DomainBlockCreateParams) WithPrivateComment(privateComment *string) *DomainBlockCreateParams { + o.SetPrivateComment(privateComment) + return o +} + +// SetPrivateComment adds the privateComment to the domain block create params +func (o *DomainBlockCreateParams) SetPrivateComment(privateComment *string) { + o.PrivateComment = privateComment +} + +// WithPublicComment adds the publicComment to the domain block create params +func (o *DomainBlockCreateParams) WithPublicComment(publicComment *string) *DomainBlockCreateParams { + o.SetPublicComment(publicComment) + return o +} + +// SetPublicComment adds the publicComment to the domain block create params +func (o *DomainBlockCreateParams) SetPublicComment(publicComment *string) { + o.PublicComment = publicComment +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlockCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // form param domain + var frDomain string + if o.Domain != nil { + frDomain = *o.Domain + } + fDomain := frDomain + if fDomain != "" { + if err := r.SetFormParam("domain", fDomain); err != nil { + return err + } + } + } + + if o.Domains != nil { + + if o.Domains != nil { + // form file param domains + if err := r.SetFileParam("domains", o.Domains); err != nil { + return err + } + } + } + + if o.Import != nil { + + // query param import + var qrImport bool + + if o.Import != nil { + qrImport = *o.Import + } + qImport := swag.FormatBool(qrImport) + if qImport != "" { + + if err := r.SetQueryParam("import", qImport); err != nil { + return err + } + } + } + + if o.Obfuscate != nil { + + // form param obfuscate + var frObfuscate bool + if o.Obfuscate != nil { + frObfuscate = *o.Obfuscate + } + fObfuscate := swag.FormatBool(frObfuscate) + if fObfuscate != "" { + if err := r.SetFormParam("obfuscate", fObfuscate); err != nil { + return err + } + } + } + + if o.PrivateComment != nil { + + // form param private_comment + var frPrivateComment string + if o.PrivateComment != nil { + frPrivateComment = *o.PrivateComment + } + fPrivateComment := frPrivateComment + if fPrivateComment != "" { + if err := r.SetFormParam("private_comment", fPrivateComment); err != nil { + return err + } + } + } + + if o.PublicComment != nil { + + // form param public_comment + var frPublicComment string + if o.PublicComment != nil { + frPublicComment = *o.PublicComment + } + fPublicComment := frPublicComment + if fPublicComment != "" { + if err := r.SetFormParam("public_comment", fPublicComment); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_block_create_responses.go b/client/admin/domain_block_create_responses.go new file mode 100644 index 0000000..9e5d370 --- /dev/null +++ b/client/admin/domain_block_create_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlockCreateReader is a Reader for the DomainBlockCreate structure. +type DomainBlockCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlockCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlockCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlockCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlockCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlockCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlockCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlockCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainBlockCreateConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlockCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/domain_blocks] domainBlockCreate", response, response.Code()) + } +} + +// NewDomainBlockCreateOK creates a DomainBlockCreateOK with default headers values +func NewDomainBlockCreateOK() *DomainBlockCreateOK { + return &DomainBlockCreateOK{} +} + +/* +DomainBlockCreateOK describes a response with status code 200, with default header values. + +The newly created domain block, if `import` != `true`. If a list has been imported, then an `array` of newly created domain blocks will be returned instead. +*/ +type DomainBlockCreateOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain block create o k response has a 2xx status code +func (o *DomainBlockCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain block create o k response has a 3xx status code +func (o *DomainBlockCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create o k response has a 4xx status code +func (o *DomainBlockCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block create o k response has a 5xx status code +func (o *DomainBlockCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create o k response a status code equal to that given +func (o *DomainBlockCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain block create o k response +func (o *DomainBlockCreateOK) Code() int { + return 200 +} + +func (o *DomainBlockCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateOK %s", 200, payload) +} + +func (o *DomainBlockCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateOK %s", 200, payload) +} + +func (o *DomainBlockCreateOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainBlockCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainBlockCreateBadRequest creates a DomainBlockCreateBadRequest with default headers values +func NewDomainBlockCreateBadRequest() *DomainBlockCreateBadRequest { + return &DomainBlockCreateBadRequest{} +} + +/* +DomainBlockCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlockCreateBadRequest struct { +} + +// IsSuccess returns true when this domain block create bad request response has a 2xx status code +func (o *DomainBlockCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create bad request response has a 3xx status code +func (o *DomainBlockCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create bad request response has a 4xx status code +func (o *DomainBlockCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create bad request response has a 5xx status code +func (o *DomainBlockCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create bad request response a status code equal to that given +func (o *DomainBlockCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain block create bad request response +func (o *DomainBlockCreateBadRequest) Code() int { + return 400 +} + +func (o *DomainBlockCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateBadRequest", 400) +} + +func (o *DomainBlockCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateBadRequest", 400) +} + +func (o *DomainBlockCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateUnauthorized creates a DomainBlockCreateUnauthorized with default headers values +func NewDomainBlockCreateUnauthorized() *DomainBlockCreateUnauthorized { + return &DomainBlockCreateUnauthorized{} +} + +/* +DomainBlockCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlockCreateUnauthorized struct { +} + +// IsSuccess returns true when this domain block create unauthorized response has a 2xx status code +func (o *DomainBlockCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create unauthorized response has a 3xx status code +func (o *DomainBlockCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create unauthorized response has a 4xx status code +func (o *DomainBlockCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create unauthorized response has a 5xx status code +func (o *DomainBlockCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create unauthorized response a status code equal to that given +func (o *DomainBlockCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain block create unauthorized response +func (o *DomainBlockCreateUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlockCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateUnauthorized", 401) +} + +func (o *DomainBlockCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateUnauthorized", 401) +} + +func (o *DomainBlockCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateForbidden creates a DomainBlockCreateForbidden with default headers values +func NewDomainBlockCreateForbidden() *DomainBlockCreateForbidden { + return &DomainBlockCreateForbidden{} +} + +/* +DomainBlockCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlockCreateForbidden struct { +} + +// IsSuccess returns true when this domain block create forbidden response has a 2xx status code +func (o *DomainBlockCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create forbidden response has a 3xx status code +func (o *DomainBlockCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create forbidden response has a 4xx status code +func (o *DomainBlockCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create forbidden response has a 5xx status code +func (o *DomainBlockCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create forbidden response a status code equal to that given +func (o *DomainBlockCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain block create forbidden response +func (o *DomainBlockCreateForbidden) Code() int { + return 403 +} + +func (o *DomainBlockCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateForbidden", 403) +} + +func (o *DomainBlockCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateForbidden", 403) +} + +func (o *DomainBlockCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateNotFound creates a DomainBlockCreateNotFound with default headers values +func NewDomainBlockCreateNotFound() *DomainBlockCreateNotFound { + return &DomainBlockCreateNotFound{} +} + +/* +DomainBlockCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlockCreateNotFound struct { +} + +// IsSuccess returns true when this domain block create not found response has a 2xx status code +func (o *DomainBlockCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create not found response has a 3xx status code +func (o *DomainBlockCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create not found response has a 4xx status code +func (o *DomainBlockCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create not found response has a 5xx status code +func (o *DomainBlockCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create not found response a status code equal to that given +func (o *DomainBlockCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain block create not found response +func (o *DomainBlockCreateNotFound) Code() int { + return 404 +} + +func (o *DomainBlockCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotFound", 404) +} + +func (o *DomainBlockCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotFound", 404) +} + +func (o *DomainBlockCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateNotAcceptable creates a DomainBlockCreateNotAcceptable with default headers values +func NewDomainBlockCreateNotAcceptable() *DomainBlockCreateNotAcceptable { + return &DomainBlockCreateNotAcceptable{} +} + +/* +DomainBlockCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlockCreateNotAcceptable struct { +} + +// IsSuccess returns true when this domain block create not acceptable response has a 2xx status code +func (o *DomainBlockCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create not acceptable response has a 3xx status code +func (o *DomainBlockCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create not acceptable response has a 4xx status code +func (o *DomainBlockCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create not acceptable response has a 5xx status code +func (o *DomainBlockCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create not acceptable response a status code equal to that given +func (o *DomainBlockCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain block create not acceptable response +func (o *DomainBlockCreateNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlockCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotAcceptable", 406) +} + +func (o *DomainBlockCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateNotAcceptable", 406) +} + +func (o *DomainBlockCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateConflict creates a DomainBlockCreateConflict with default headers values +func NewDomainBlockCreateConflict() *DomainBlockCreateConflict { + return &DomainBlockCreateConflict{} +} + +/* +DomainBlockCreateConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainBlockCreateConflict struct { +} + +// IsSuccess returns true when this domain block create conflict response has a 2xx status code +func (o *DomainBlockCreateConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create conflict response has a 3xx status code +func (o *DomainBlockCreateConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create conflict response has a 4xx status code +func (o *DomainBlockCreateConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block create conflict response has a 5xx status code +func (o *DomainBlockCreateConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block create conflict response a status code equal to that given +func (o *DomainBlockCreateConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain block create conflict response +func (o *DomainBlockCreateConflict) Code() int { + return 409 +} + +func (o *DomainBlockCreateConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateConflict", 409) +} + +func (o *DomainBlockCreateConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateConflict", 409) +} + +func (o *DomainBlockCreateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockCreateInternalServerError creates a DomainBlockCreateInternalServerError with default headers values +func NewDomainBlockCreateInternalServerError() *DomainBlockCreateInternalServerError { + return &DomainBlockCreateInternalServerError{} +} + +/* +DomainBlockCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlockCreateInternalServerError struct { +} + +// IsSuccess returns true when this domain block create internal server error response has a 2xx status code +func (o *DomainBlockCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block create internal server error response has a 3xx status code +func (o *DomainBlockCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block create internal server error response has a 4xx status code +func (o *DomainBlockCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block create internal server error response has a 5xx status code +func (o *DomainBlockCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain block create internal server error response a status code equal to that given +func (o *DomainBlockCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain block create internal server error response +func (o *DomainBlockCreateInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlockCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateInternalServerError", 500) +} + +func (o *DomainBlockCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_blocks][%d] domainBlockCreateInternalServerError", 500) +} + +func (o *DomainBlockCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_block_delete_parameters.go b/client/admin/domain_block_delete_parameters.go new file mode 100644 index 0000000..6af133b --- /dev/null +++ b/client/admin/domain_block_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainBlockDeleteParams creates a new DomainBlockDeleteParams 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 NewDomainBlockDeleteParams() *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlockDeleteParamsWithTimeout creates a new DomainBlockDeleteParams object +// with the ability to set a timeout on a request. +func NewDomainBlockDeleteParamsWithTimeout(timeout time.Duration) *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + timeout: timeout, + } +} + +// NewDomainBlockDeleteParamsWithContext creates a new DomainBlockDeleteParams object +// with the ability to set a context for a request. +func NewDomainBlockDeleteParamsWithContext(ctx context.Context) *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + Context: ctx, + } +} + +// NewDomainBlockDeleteParamsWithHTTPClient creates a new DomainBlockDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlockDeleteParamsWithHTTPClient(client *http.Client) *DomainBlockDeleteParams { + return &DomainBlockDeleteParams{ + HTTPClient: client, + } +} + +/* +DomainBlockDeleteParams contains all the parameters to send to the API endpoint + + for the domain block delete operation. + + Typically these are written to a http.Request. +*/ +type DomainBlockDeleteParams struct { + + /* ID. + + The id of the domain block. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockDeleteParams) WithDefaults() *DomainBlockDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain block delete params +func (o *DomainBlockDeleteParams) WithTimeout(timeout time.Duration) *DomainBlockDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain block delete params +func (o *DomainBlockDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain block delete params +func (o *DomainBlockDeleteParams) WithContext(ctx context.Context) *DomainBlockDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain block delete params +func (o *DomainBlockDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain block delete params +func (o *DomainBlockDeleteParams) WithHTTPClient(client *http.Client) *DomainBlockDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain block delete params +func (o *DomainBlockDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain block delete params +func (o *DomainBlockDeleteParams) WithID(id string) *DomainBlockDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain block delete params +func (o *DomainBlockDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlockDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_block_delete_responses.go b/client/admin/domain_block_delete_responses.go new file mode 100644 index 0000000..4a34c8d --- /dev/null +++ b/client/admin/domain_block_delete_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlockDeleteReader is a Reader for the DomainBlockDelete structure. +type DomainBlockDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlockDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlockDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlockDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlockDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlockDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlockDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlockDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainBlockDeleteConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlockDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/domain_blocks/{id}] domainBlockDelete", response, response.Code()) + } +} + +// NewDomainBlockDeleteOK creates a DomainBlockDeleteOK with default headers values +func NewDomainBlockDeleteOK() *DomainBlockDeleteOK { + return &DomainBlockDeleteOK{} +} + +/* +DomainBlockDeleteOK describes a response with status code 200, with default header values. + +The domain block that was just deleted. +*/ +type DomainBlockDeleteOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain block delete o k response has a 2xx status code +func (o *DomainBlockDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain block delete o k response has a 3xx status code +func (o *DomainBlockDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete o k response has a 4xx status code +func (o *DomainBlockDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block delete o k response has a 5xx status code +func (o *DomainBlockDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete o k response a status code equal to that given +func (o *DomainBlockDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain block delete o k response +func (o *DomainBlockDeleteOK) Code() int { + return 200 +} + +func (o *DomainBlockDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteOK %s", 200, payload) +} + +func (o *DomainBlockDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteOK %s", 200, payload) +} + +func (o *DomainBlockDeleteOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainBlockDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainBlockDeleteBadRequest creates a DomainBlockDeleteBadRequest with default headers values +func NewDomainBlockDeleteBadRequest() *DomainBlockDeleteBadRequest { + return &DomainBlockDeleteBadRequest{} +} + +/* +DomainBlockDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlockDeleteBadRequest struct { +} + +// IsSuccess returns true when this domain block delete bad request response has a 2xx status code +func (o *DomainBlockDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete bad request response has a 3xx status code +func (o *DomainBlockDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete bad request response has a 4xx status code +func (o *DomainBlockDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete bad request response has a 5xx status code +func (o *DomainBlockDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete bad request response a status code equal to that given +func (o *DomainBlockDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain block delete bad request response +func (o *DomainBlockDeleteBadRequest) Code() int { + return 400 +} + +func (o *DomainBlockDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteBadRequest", 400) +} + +func (o *DomainBlockDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteBadRequest", 400) +} + +func (o *DomainBlockDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteUnauthorized creates a DomainBlockDeleteUnauthorized with default headers values +func NewDomainBlockDeleteUnauthorized() *DomainBlockDeleteUnauthorized { + return &DomainBlockDeleteUnauthorized{} +} + +/* +DomainBlockDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlockDeleteUnauthorized struct { +} + +// IsSuccess returns true when this domain block delete unauthorized response has a 2xx status code +func (o *DomainBlockDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete unauthorized response has a 3xx status code +func (o *DomainBlockDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete unauthorized response has a 4xx status code +func (o *DomainBlockDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete unauthorized response has a 5xx status code +func (o *DomainBlockDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete unauthorized response a status code equal to that given +func (o *DomainBlockDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain block delete unauthorized response +func (o *DomainBlockDeleteUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlockDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteUnauthorized", 401) +} + +func (o *DomainBlockDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteUnauthorized", 401) +} + +func (o *DomainBlockDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteForbidden creates a DomainBlockDeleteForbidden with default headers values +func NewDomainBlockDeleteForbidden() *DomainBlockDeleteForbidden { + return &DomainBlockDeleteForbidden{} +} + +/* +DomainBlockDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlockDeleteForbidden struct { +} + +// IsSuccess returns true when this domain block delete forbidden response has a 2xx status code +func (o *DomainBlockDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete forbidden response has a 3xx status code +func (o *DomainBlockDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete forbidden response has a 4xx status code +func (o *DomainBlockDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete forbidden response has a 5xx status code +func (o *DomainBlockDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete forbidden response a status code equal to that given +func (o *DomainBlockDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain block delete forbidden response +func (o *DomainBlockDeleteForbidden) Code() int { + return 403 +} + +func (o *DomainBlockDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteForbidden", 403) +} + +func (o *DomainBlockDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteForbidden", 403) +} + +func (o *DomainBlockDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteNotFound creates a DomainBlockDeleteNotFound with default headers values +func NewDomainBlockDeleteNotFound() *DomainBlockDeleteNotFound { + return &DomainBlockDeleteNotFound{} +} + +/* +DomainBlockDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlockDeleteNotFound struct { +} + +// IsSuccess returns true when this domain block delete not found response has a 2xx status code +func (o *DomainBlockDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete not found response has a 3xx status code +func (o *DomainBlockDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete not found response has a 4xx status code +func (o *DomainBlockDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete not found response has a 5xx status code +func (o *DomainBlockDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete not found response a status code equal to that given +func (o *DomainBlockDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain block delete not found response +func (o *DomainBlockDeleteNotFound) Code() int { + return 404 +} + +func (o *DomainBlockDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotFound", 404) +} + +func (o *DomainBlockDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotFound", 404) +} + +func (o *DomainBlockDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteNotAcceptable creates a DomainBlockDeleteNotAcceptable with default headers values +func NewDomainBlockDeleteNotAcceptable() *DomainBlockDeleteNotAcceptable { + return &DomainBlockDeleteNotAcceptable{} +} + +/* +DomainBlockDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlockDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this domain block delete not acceptable response has a 2xx status code +func (o *DomainBlockDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete not acceptable response has a 3xx status code +func (o *DomainBlockDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete not acceptable response has a 4xx status code +func (o *DomainBlockDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete not acceptable response has a 5xx status code +func (o *DomainBlockDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete not acceptable response a status code equal to that given +func (o *DomainBlockDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain block delete not acceptable response +func (o *DomainBlockDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlockDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotAcceptable", 406) +} + +func (o *DomainBlockDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteNotAcceptable", 406) +} + +func (o *DomainBlockDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteConflict creates a DomainBlockDeleteConflict with default headers values +func NewDomainBlockDeleteConflict() *DomainBlockDeleteConflict { + return &DomainBlockDeleteConflict{} +} + +/* +DomainBlockDeleteConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainBlockDeleteConflict struct { +} + +// IsSuccess returns true when this domain block delete conflict response has a 2xx status code +func (o *DomainBlockDeleteConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete conflict response has a 3xx status code +func (o *DomainBlockDeleteConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete conflict response has a 4xx status code +func (o *DomainBlockDeleteConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block delete conflict response has a 5xx status code +func (o *DomainBlockDeleteConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block delete conflict response a status code equal to that given +func (o *DomainBlockDeleteConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain block delete conflict response +func (o *DomainBlockDeleteConflict) Code() int { + return 409 +} + +func (o *DomainBlockDeleteConflict) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteConflict", 409) +} + +func (o *DomainBlockDeleteConflict) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteConflict", 409) +} + +func (o *DomainBlockDeleteConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockDeleteInternalServerError creates a DomainBlockDeleteInternalServerError with default headers values +func NewDomainBlockDeleteInternalServerError() *DomainBlockDeleteInternalServerError { + return &DomainBlockDeleteInternalServerError{} +} + +/* +DomainBlockDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlockDeleteInternalServerError struct { +} + +// IsSuccess returns true when this domain block delete internal server error response has a 2xx status code +func (o *DomainBlockDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block delete internal server error response has a 3xx status code +func (o *DomainBlockDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block delete internal server error response has a 4xx status code +func (o *DomainBlockDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block delete internal server error response has a 5xx status code +func (o *DomainBlockDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain block delete internal server error response a status code equal to that given +func (o *DomainBlockDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain block delete internal server error response +func (o *DomainBlockDeleteInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlockDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteInternalServerError", 500) +} + +func (o *DomainBlockDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/domain_blocks/{id}][%d] domainBlockDeleteInternalServerError", 500) +} + +func (o *DomainBlockDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_block_get_parameters.go b/client/admin/domain_block_get_parameters.go new file mode 100644 index 0000000..016fa47 --- /dev/null +++ b/client/admin/domain_block_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainBlockGetParams creates a new DomainBlockGetParams 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 NewDomainBlockGetParams() *DomainBlockGetParams { + return &DomainBlockGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlockGetParamsWithTimeout creates a new DomainBlockGetParams object +// with the ability to set a timeout on a request. +func NewDomainBlockGetParamsWithTimeout(timeout time.Duration) *DomainBlockGetParams { + return &DomainBlockGetParams{ + timeout: timeout, + } +} + +// NewDomainBlockGetParamsWithContext creates a new DomainBlockGetParams object +// with the ability to set a context for a request. +func NewDomainBlockGetParamsWithContext(ctx context.Context) *DomainBlockGetParams { + return &DomainBlockGetParams{ + Context: ctx, + } +} + +// NewDomainBlockGetParamsWithHTTPClient creates a new DomainBlockGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlockGetParamsWithHTTPClient(client *http.Client) *DomainBlockGetParams { + return &DomainBlockGetParams{ + HTTPClient: client, + } +} + +/* +DomainBlockGetParams contains all the parameters to send to the API endpoint + + for the domain block get operation. + + Typically these are written to a http.Request. +*/ +type DomainBlockGetParams struct { + + /* ID. + + The id of the domain block. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockGetParams) WithDefaults() *DomainBlockGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlockGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain block get params +func (o *DomainBlockGetParams) WithTimeout(timeout time.Duration) *DomainBlockGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain block get params +func (o *DomainBlockGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain block get params +func (o *DomainBlockGetParams) WithContext(ctx context.Context) *DomainBlockGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain block get params +func (o *DomainBlockGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain block get params +func (o *DomainBlockGetParams) WithHTTPClient(client *http.Client) *DomainBlockGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain block get params +func (o *DomainBlockGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the domain block get params +func (o *DomainBlockGetParams) WithID(id string) *DomainBlockGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the domain block get params +func (o *DomainBlockGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlockGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_block_get_responses.go b/client/admin/domain_block_get_responses.go new file mode 100644 index 0000000..1a221e1 --- /dev/null +++ b/client/admin/domain_block_get_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlockGetReader is a Reader for the DomainBlockGet structure. +type DomainBlockGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlockGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlockGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlockGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlockGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlockGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlockGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlockGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlockGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_blocks/{id}] domainBlockGet", response, response.Code()) + } +} + +// NewDomainBlockGetOK creates a DomainBlockGetOK with default headers values +func NewDomainBlockGetOK() *DomainBlockGetOK { + return &DomainBlockGetOK{} +} + +/* +DomainBlockGetOK describes a response with status code 200, with default header values. + +The requested domain block. +*/ +type DomainBlockGetOK struct { + Payload *models.DomainPermission +} + +// IsSuccess returns true when this domain block get o k response has a 2xx status code +func (o *DomainBlockGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain block get o k response has a 3xx status code +func (o *DomainBlockGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get o k response has a 4xx status code +func (o *DomainBlockGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block get o k response has a 5xx status code +func (o *DomainBlockGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get o k response a status code equal to that given +func (o *DomainBlockGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain block get o k response +func (o *DomainBlockGetOK) Code() int { + return 200 +} + +func (o *DomainBlockGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetOK %s", 200, payload) +} + +func (o *DomainBlockGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetOK %s", 200, payload) +} + +func (o *DomainBlockGetOK) GetPayload() *models.DomainPermission { + return o.Payload +} + +func (o *DomainBlockGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DomainPermission) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainBlockGetBadRequest creates a DomainBlockGetBadRequest with default headers values +func NewDomainBlockGetBadRequest() *DomainBlockGetBadRequest { + return &DomainBlockGetBadRequest{} +} + +/* +DomainBlockGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlockGetBadRequest struct { +} + +// IsSuccess returns true when this domain block get bad request response has a 2xx status code +func (o *DomainBlockGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get bad request response has a 3xx status code +func (o *DomainBlockGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get bad request response has a 4xx status code +func (o *DomainBlockGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get bad request response has a 5xx status code +func (o *DomainBlockGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get bad request response a status code equal to that given +func (o *DomainBlockGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain block get bad request response +func (o *DomainBlockGetBadRequest) Code() int { + return 400 +} + +func (o *DomainBlockGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetBadRequest", 400) +} + +func (o *DomainBlockGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetBadRequest", 400) +} + +func (o *DomainBlockGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetUnauthorized creates a DomainBlockGetUnauthorized with default headers values +func NewDomainBlockGetUnauthorized() *DomainBlockGetUnauthorized { + return &DomainBlockGetUnauthorized{} +} + +/* +DomainBlockGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlockGetUnauthorized struct { +} + +// IsSuccess returns true when this domain block get unauthorized response has a 2xx status code +func (o *DomainBlockGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get unauthorized response has a 3xx status code +func (o *DomainBlockGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get unauthorized response has a 4xx status code +func (o *DomainBlockGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get unauthorized response has a 5xx status code +func (o *DomainBlockGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get unauthorized response a status code equal to that given +func (o *DomainBlockGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain block get unauthorized response +func (o *DomainBlockGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlockGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetUnauthorized", 401) +} + +func (o *DomainBlockGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetUnauthorized", 401) +} + +func (o *DomainBlockGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetForbidden creates a DomainBlockGetForbidden with default headers values +func NewDomainBlockGetForbidden() *DomainBlockGetForbidden { + return &DomainBlockGetForbidden{} +} + +/* +DomainBlockGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlockGetForbidden struct { +} + +// IsSuccess returns true when this domain block get forbidden response has a 2xx status code +func (o *DomainBlockGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get forbidden response has a 3xx status code +func (o *DomainBlockGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get forbidden response has a 4xx status code +func (o *DomainBlockGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get forbidden response has a 5xx status code +func (o *DomainBlockGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get forbidden response a status code equal to that given +func (o *DomainBlockGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain block get forbidden response +func (o *DomainBlockGetForbidden) Code() int { + return 403 +} + +func (o *DomainBlockGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetForbidden", 403) +} + +func (o *DomainBlockGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetForbidden", 403) +} + +func (o *DomainBlockGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetNotFound creates a DomainBlockGetNotFound with default headers values +func NewDomainBlockGetNotFound() *DomainBlockGetNotFound { + return &DomainBlockGetNotFound{} +} + +/* +DomainBlockGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlockGetNotFound struct { +} + +// IsSuccess returns true when this domain block get not found response has a 2xx status code +func (o *DomainBlockGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get not found response has a 3xx status code +func (o *DomainBlockGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get not found response has a 4xx status code +func (o *DomainBlockGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get not found response has a 5xx status code +func (o *DomainBlockGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get not found response a status code equal to that given +func (o *DomainBlockGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain block get not found response +func (o *DomainBlockGetNotFound) Code() int { + return 404 +} + +func (o *DomainBlockGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotFound", 404) +} + +func (o *DomainBlockGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotFound", 404) +} + +func (o *DomainBlockGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetNotAcceptable creates a DomainBlockGetNotAcceptable with default headers values +func NewDomainBlockGetNotAcceptable() *DomainBlockGetNotAcceptable { + return &DomainBlockGetNotAcceptable{} +} + +/* +DomainBlockGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlockGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain block get not acceptable response has a 2xx status code +func (o *DomainBlockGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get not acceptable response has a 3xx status code +func (o *DomainBlockGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get not acceptable response has a 4xx status code +func (o *DomainBlockGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain block get not acceptable response has a 5xx status code +func (o *DomainBlockGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain block get not acceptable response a status code equal to that given +func (o *DomainBlockGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain block get not acceptable response +func (o *DomainBlockGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlockGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotAcceptable", 406) +} + +func (o *DomainBlockGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetNotAcceptable", 406) +} + +func (o *DomainBlockGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlockGetInternalServerError creates a DomainBlockGetInternalServerError with default headers values +func NewDomainBlockGetInternalServerError() *DomainBlockGetInternalServerError { + return &DomainBlockGetInternalServerError{} +} + +/* +DomainBlockGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlockGetInternalServerError struct { +} + +// IsSuccess returns true when this domain block get internal server error response has a 2xx status code +func (o *DomainBlockGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain block get internal server error response has a 3xx status code +func (o *DomainBlockGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain block get internal server error response has a 4xx status code +func (o *DomainBlockGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain block get internal server error response has a 5xx status code +func (o *DomainBlockGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain block get internal server error response a status code equal to that given +func (o *DomainBlockGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain block get internal server error response +func (o *DomainBlockGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlockGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetInternalServerError", 500) +} + +func (o *DomainBlockGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks/{id}][%d] domainBlockGetInternalServerError", 500) +} + +func (o *DomainBlockGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_blocks_get_parameters.go b/client/admin/domain_blocks_get_parameters.go new file mode 100644 index 0000000..648003d --- /dev/null +++ b/client/admin/domain_blocks_get_parameters.go @@ -0,0 +1,164 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainBlocksGetParams creates a new DomainBlocksGetParams 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 NewDomainBlocksGetParams() *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainBlocksGetParamsWithTimeout creates a new DomainBlocksGetParams object +// with the ability to set a timeout on a request. +func NewDomainBlocksGetParamsWithTimeout(timeout time.Duration) *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + timeout: timeout, + } +} + +// NewDomainBlocksGetParamsWithContext creates a new DomainBlocksGetParams object +// with the ability to set a context for a request. +func NewDomainBlocksGetParamsWithContext(ctx context.Context) *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + Context: ctx, + } +} + +// NewDomainBlocksGetParamsWithHTTPClient creates a new DomainBlocksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainBlocksGetParamsWithHTTPClient(client *http.Client) *DomainBlocksGetParams { + return &DomainBlocksGetParams{ + HTTPClient: client, + } +} + +/* +DomainBlocksGetParams contains all the parameters to send to the API endpoint + + for the domain blocks get operation. + + Typically these are written to a http.Request. +*/ +type DomainBlocksGetParams struct { + + /* Export. + + If set to `true`, then each entry in the returned list of domain blocks will only consist of the fields `domain` and `public_comment`. This is perfect for when you want to save and share a list of all the domains you have blocked on your instance, so that someone else can easily import them, but you don't want them to see the database IDs of your blocks, or private comments etc. + */ + Export *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlocksGetParams) WithDefaults() *DomainBlocksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainBlocksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain blocks get params +func (o *DomainBlocksGetParams) WithTimeout(timeout time.Duration) *DomainBlocksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain blocks get params +func (o *DomainBlocksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain blocks get params +func (o *DomainBlocksGetParams) WithContext(ctx context.Context) *DomainBlocksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain blocks get params +func (o *DomainBlocksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain blocks get params +func (o *DomainBlocksGetParams) WithHTTPClient(client *http.Client) *DomainBlocksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain blocks get params +func (o *DomainBlocksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExport adds the export to the domain blocks get params +func (o *DomainBlocksGetParams) WithExport(export *bool) *DomainBlocksGetParams { + o.SetExport(export) + return o +} + +// SetExport adds the export to the domain blocks get params +func (o *DomainBlocksGetParams) SetExport(export *bool) { + o.Export = export +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainBlocksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Export != nil { + + // query param export + var qrExport bool + + if o.Export != nil { + qrExport = *o.Export + } + qExport := swag.FormatBool(qrExport) + if qExport != "" { + + if err := r.SetQueryParam("export", qExport); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_blocks_get_responses.go b/client/admin/domain_blocks_get_responses.go new file mode 100644 index 0000000..4423cdf --- /dev/null +++ b/client/admin/domain_blocks_get_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainBlocksGetReader is a Reader for the DomainBlocksGet structure. +type DomainBlocksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainBlocksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDomainBlocksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainBlocksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainBlocksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainBlocksGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainBlocksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainBlocksGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainBlocksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/domain_blocks] domainBlocksGet", response, response.Code()) + } +} + +// NewDomainBlocksGetOK creates a DomainBlocksGetOK with default headers values +func NewDomainBlocksGetOK() *DomainBlocksGetOK { + return &DomainBlocksGetOK{} +} + +/* +DomainBlocksGetOK describes a response with status code 200, with default header values. + +All domain blocks currently in place. +*/ +type DomainBlocksGetOK struct { + Payload []*models.DomainPermission +} + +// IsSuccess returns true when this domain blocks get o k response has a 2xx status code +func (o *DomainBlocksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain blocks get o k response has a 3xx status code +func (o *DomainBlocksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get o k response has a 4xx status code +func (o *DomainBlocksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain blocks get o k response has a 5xx status code +func (o *DomainBlocksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get o k response a status code equal to that given +func (o *DomainBlocksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the domain blocks get o k response +func (o *DomainBlocksGetOK) Code() int { + return 200 +} + +func (o *DomainBlocksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetOK %s", 200, payload) +} + +func (o *DomainBlocksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetOK %s", 200, payload) +} + +func (o *DomainBlocksGetOK) GetPayload() []*models.DomainPermission { + return o.Payload +} + +func (o *DomainBlocksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainBlocksGetBadRequest creates a DomainBlocksGetBadRequest with default headers values +func NewDomainBlocksGetBadRequest() *DomainBlocksGetBadRequest { + return &DomainBlocksGetBadRequest{} +} + +/* +DomainBlocksGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainBlocksGetBadRequest struct { +} + +// IsSuccess returns true when this domain blocks get bad request response has a 2xx status code +func (o *DomainBlocksGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get bad request response has a 3xx status code +func (o *DomainBlocksGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get bad request response has a 4xx status code +func (o *DomainBlocksGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get bad request response has a 5xx status code +func (o *DomainBlocksGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get bad request response a status code equal to that given +func (o *DomainBlocksGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain blocks get bad request response +func (o *DomainBlocksGetBadRequest) Code() int { + return 400 +} + +func (o *DomainBlocksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetBadRequest", 400) +} + +func (o *DomainBlocksGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetBadRequest", 400) +} + +func (o *DomainBlocksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetUnauthorized creates a DomainBlocksGetUnauthorized with default headers values +func NewDomainBlocksGetUnauthorized() *DomainBlocksGetUnauthorized { + return &DomainBlocksGetUnauthorized{} +} + +/* +DomainBlocksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainBlocksGetUnauthorized struct { +} + +// IsSuccess returns true when this domain blocks get unauthorized response has a 2xx status code +func (o *DomainBlocksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get unauthorized response has a 3xx status code +func (o *DomainBlocksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get unauthorized response has a 4xx status code +func (o *DomainBlocksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get unauthorized response has a 5xx status code +func (o *DomainBlocksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get unauthorized response a status code equal to that given +func (o *DomainBlocksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain blocks get unauthorized response +func (o *DomainBlocksGetUnauthorized) Code() int { + return 401 +} + +func (o *DomainBlocksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetUnauthorized", 401) +} + +func (o *DomainBlocksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetUnauthorized", 401) +} + +func (o *DomainBlocksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetForbidden creates a DomainBlocksGetForbidden with default headers values +func NewDomainBlocksGetForbidden() *DomainBlocksGetForbidden { + return &DomainBlocksGetForbidden{} +} + +/* +DomainBlocksGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainBlocksGetForbidden struct { +} + +// IsSuccess returns true when this domain blocks get forbidden response has a 2xx status code +func (o *DomainBlocksGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get forbidden response has a 3xx status code +func (o *DomainBlocksGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get forbidden response has a 4xx status code +func (o *DomainBlocksGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get forbidden response has a 5xx status code +func (o *DomainBlocksGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get forbidden response a status code equal to that given +func (o *DomainBlocksGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain blocks get forbidden response +func (o *DomainBlocksGetForbidden) Code() int { + return 403 +} + +func (o *DomainBlocksGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetForbidden", 403) +} + +func (o *DomainBlocksGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetForbidden", 403) +} + +func (o *DomainBlocksGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetNotFound creates a DomainBlocksGetNotFound with default headers values +func NewDomainBlocksGetNotFound() *DomainBlocksGetNotFound { + return &DomainBlocksGetNotFound{} +} + +/* +DomainBlocksGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainBlocksGetNotFound struct { +} + +// IsSuccess returns true when this domain blocks get not found response has a 2xx status code +func (o *DomainBlocksGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get not found response has a 3xx status code +func (o *DomainBlocksGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get not found response has a 4xx status code +func (o *DomainBlocksGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get not found response has a 5xx status code +func (o *DomainBlocksGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get not found response a status code equal to that given +func (o *DomainBlocksGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain blocks get not found response +func (o *DomainBlocksGetNotFound) Code() int { + return 404 +} + +func (o *DomainBlocksGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotFound", 404) +} + +func (o *DomainBlocksGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotFound", 404) +} + +func (o *DomainBlocksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetNotAcceptable creates a DomainBlocksGetNotAcceptable with default headers values +func NewDomainBlocksGetNotAcceptable() *DomainBlocksGetNotAcceptable { + return &DomainBlocksGetNotAcceptable{} +} + +/* +DomainBlocksGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainBlocksGetNotAcceptable struct { +} + +// IsSuccess returns true when this domain blocks get not acceptable response has a 2xx status code +func (o *DomainBlocksGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get not acceptable response has a 3xx status code +func (o *DomainBlocksGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get not acceptable response has a 4xx status code +func (o *DomainBlocksGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain blocks get not acceptable response has a 5xx status code +func (o *DomainBlocksGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain blocks get not acceptable response a status code equal to that given +func (o *DomainBlocksGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain blocks get not acceptable response +func (o *DomainBlocksGetNotAcceptable) Code() int { + return 406 +} + +func (o *DomainBlocksGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotAcceptable", 406) +} + +func (o *DomainBlocksGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetNotAcceptable", 406) +} + +func (o *DomainBlocksGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainBlocksGetInternalServerError creates a DomainBlocksGetInternalServerError with default headers values +func NewDomainBlocksGetInternalServerError() *DomainBlocksGetInternalServerError { + return &DomainBlocksGetInternalServerError{} +} + +/* +DomainBlocksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainBlocksGetInternalServerError struct { +} + +// IsSuccess returns true when this domain blocks get internal server error response has a 2xx status code +func (o *DomainBlocksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain blocks get internal server error response has a 3xx status code +func (o *DomainBlocksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain blocks get internal server error response has a 4xx status code +func (o *DomainBlocksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain blocks get internal server error response has a 5xx status code +func (o *DomainBlocksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain blocks get internal server error response a status code equal to that given +func (o *DomainBlocksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain blocks get internal server error response +func (o *DomainBlocksGetInternalServerError) Code() int { + return 500 +} + +func (o *DomainBlocksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetInternalServerError", 500) +} + +func (o *DomainBlocksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/domain_blocks][%d] domainBlocksGetInternalServerError", 500) +} + +func (o *DomainBlocksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/domain_keys_expire_parameters.go b/client/admin/domain_keys_expire_parameters.go new file mode 100644 index 0000000..e19e4a7 --- /dev/null +++ b/client/admin/domain_keys_expire_parameters.go @@ -0,0 +1,162 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewDomainKeysExpireParams creates a new DomainKeysExpireParams 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 NewDomainKeysExpireParams() *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDomainKeysExpireParamsWithTimeout creates a new DomainKeysExpireParams object +// with the ability to set a timeout on a request. +func NewDomainKeysExpireParamsWithTimeout(timeout time.Duration) *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + timeout: timeout, + } +} + +// NewDomainKeysExpireParamsWithContext creates a new DomainKeysExpireParams object +// with the ability to set a context for a request. +func NewDomainKeysExpireParamsWithContext(ctx context.Context) *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + Context: ctx, + } +} + +// NewDomainKeysExpireParamsWithHTTPClient creates a new DomainKeysExpireParams object +// with the ability to set a custom HTTPClient for a request. +func NewDomainKeysExpireParamsWithHTTPClient(client *http.Client) *DomainKeysExpireParams { + return &DomainKeysExpireParams{ + HTTPClient: client, + } +} + +/* +DomainKeysExpireParams contains all the parameters to send to the API endpoint + + for the domain keys expire operation. + + Typically these are written to a http.Request. +*/ +type DomainKeysExpireParams struct { + + /* Domain. + + Domain to expire keys for. + Sample: example.org + */ + Domain *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the domain keys expire params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainKeysExpireParams) WithDefaults() *DomainKeysExpireParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the domain keys expire params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DomainKeysExpireParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the domain keys expire params +func (o *DomainKeysExpireParams) WithTimeout(timeout time.Duration) *DomainKeysExpireParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the domain keys expire params +func (o *DomainKeysExpireParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the domain keys expire params +func (o *DomainKeysExpireParams) WithContext(ctx context.Context) *DomainKeysExpireParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the domain keys expire params +func (o *DomainKeysExpireParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the domain keys expire params +func (o *DomainKeysExpireParams) WithHTTPClient(client *http.Client) *DomainKeysExpireParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the domain keys expire params +func (o *DomainKeysExpireParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the domain keys expire params +func (o *DomainKeysExpireParams) WithDomain(domain *string) *DomainKeysExpireParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the domain keys expire params +func (o *DomainKeysExpireParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WriteToRequest writes these params to a swagger request +func (o *DomainKeysExpireParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // form param domain + var frDomain string + if o.Domain != nil { + frDomain = *o.Domain + } + fDomain := frDomain + if fDomain != "" { + if err := r.SetFormParam("domain", fDomain); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/domain_keys_expire_responses.go b/client/admin/domain_keys_expire_responses.go new file mode 100644 index 0000000..edd6953 --- /dev/null +++ b/client/admin/domain_keys_expire_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DomainKeysExpireReader is a Reader for the DomainKeysExpire structure. +type DomainKeysExpireReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DomainKeysExpireReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewDomainKeysExpireAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDomainKeysExpireBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDomainKeysExpireUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewDomainKeysExpireForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDomainKeysExpireNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDomainKeysExpireNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewDomainKeysExpireConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDomainKeysExpireInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/domain_keys_expire] domainKeysExpire", response, response.Code()) + } +} + +// NewDomainKeysExpireAccepted creates a DomainKeysExpireAccepted with default headers values +func NewDomainKeysExpireAccepted() *DomainKeysExpireAccepted { + return &DomainKeysExpireAccepted{} +} + +/* +DomainKeysExpireAccepted describes a response with status code 202, with default header values. + +Request accepted and will be processed. Check the logs for progress / errors. +*/ +type DomainKeysExpireAccepted struct { + Payload *models.AdminActionResponse +} + +// IsSuccess returns true when this domain keys expire accepted response has a 2xx status code +func (o *DomainKeysExpireAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this domain keys expire accepted response has a 3xx status code +func (o *DomainKeysExpireAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire accepted response has a 4xx status code +func (o *DomainKeysExpireAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain keys expire accepted response has a 5xx status code +func (o *DomainKeysExpireAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire accepted response a status code equal to that given +func (o *DomainKeysExpireAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the domain keys expire accepted response +func (o *DomainKeysExpireAccepted) Code() int { + return 202 +} + +func (o *DomainKeysExpireAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireAccepted %s", 202, payload) +} + +func (o *DomainKeysExpireAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireAccepted %s", 202, payload) +} + +func (o *DomainKeysExpireAccepted) GetPayload() *models.AdminActionResponse { + return o.Payload +} + +func (o *DomainKeysExpireAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminActionResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDomainKeysExpireBadRequest creates a DomainKeysExpireBadRequest with default headers values +func NewDomainKeysExpireBadRequest() *DomainKeysExpireBadRequest { + return &DomainKeysExpireBadRequest{} +} + +/* +DomainKeysExpireBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DomainKeysExpireBadRequest struct { +} + +// IsSuccess returns true when this domain keys expire bad request response has a 2xx status code +func (o *DomainKeysExpireBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire bad request response has a 3xx status code +func (o *DomainKeysExpireBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire bad request response has a 4xx status code +func (o *DomainKeysExpireBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire bad request response has a 5xx status code +func (o *DomainKeysExpireBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire bad request response a status code equal to that given +func (o *DomainKeysExpireBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the domain keys expire bad request response +func (o *DomainKeysExpireBadRequest) Code() int { + return 400 +} + +func (o *DomainKeysExpireBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireBadRequest", 400) +} + +func (o *DomainKeysExpireBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireBadRequest", 400) +} + +func (o *DomainKeysExpireBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireUnauthorized creates a DomainKeysExpireUnauthorized with default headers values +func NewDomainKeysExpireUnauthorized() *DomainKeysExpireUnauthorized { + return &DomainKeysExpireUnauthorized{} +} + +/* +DomainKeysExpireUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DomainKeysExpireUnauthorized struct { +} + +// IsSuccess returns true when this domain keys expire unauthorized response has a 2xx status code +func (o *DomainKeysExpireUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire unauthorized response has a 3xx status code +func (o *DomainKeysExpireUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire unauthorized response has a 4xx status code +func (o *DomainKeysExpireUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire unauthorized response has a 5xx status code +func (o *DomainKeysExpireUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire unauthorized response a status code equal to that given +func (o *DomainKeysExpireUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the domain keys expire unauthorized response +func (o *DomainKeysExpireUnauthorized) Code() int { + return 401 +} + +func (o *DomainKeysExpireUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireUnauthorized", 401) +} + +func (o *DomainKeysExpireUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireUnauthorized", 401) +} + +func (o *DomainKeysExpireUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireForbidden creates a DomainKeysExpireForbidden with default headers values +func NewDomainKeysExpireForbidden() *DomainKeysExpireForbidden { + return &DomainKeysExpireForbidden{} +} + +/* +DomainKeysExpireForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type DomainKeysExpireForbidden struct { +} + +// IsSuccess returns true when this domain keys expire forbidden response has a 2xx status code +func (o *DomainKeysExpireForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire forbidden response has a 3xx status code +func (o *DomainKeysExpireForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire forbidden response has a 4xx status code +func (o *DomainKeysExpireForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire forbidden response has a 5xx status code +func (o *DomainKeysExpireForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire forbidden response a status code equal to that given +func (o *DomainKeysExpireForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the domain keys expire forbidden response +func (o *DomainKeysExpireForbidden) Code() int { + return 403 +} + +func (o *DomainKeysExpireForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireForbidden", 403) +} + +func (o *DomainKeysExpireForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireForbidden", 403) +} + +func (o *DomainKeysExpireForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireNotFound creates a DomainKeysExpireNotFound with default headers values +func NewDomainKeysExpireNotFound() *DomainKeysExpireNotFound { + return &DomainKeysExpireNotFound{} +} + +/* +DomainKeysExpireNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DomainKeysExpireNotFound struct { +} + +// IsSuccess returns true when this domain keys expire not found response has a 2xx status code +func (o *DomainKeysExpireNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire not found response has a 3xx status code +func (o *DomainKeysExpireNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire not found response has a 4xx status code +func (o *DomainKeysExpireNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire not found response has a 5xx status code +func (o *DomainKeysExpireNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire not found response a status code equal to that given +func (o *DomainKeysExpireNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the domain keys expire not found response +func (o *DomainKeysExpireNotFound) Code() int { + return 404 +} + +func (o *DomainKeysExpireNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotFound", 404) +} + +func (o *DomainKeysExpireNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotFound", 404) +} + +func (o *DomainKeysExpireNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireNotAcceptable creates a DomainKeysExpireNotAcceptable with default headers values +func NewDomainKeysExpireNotAcceptable() *DomainKeysExpireNotAcceptable { + return &DomainKeysExpireNotAcceptable{} +} + +/* +DomainKeysExpireNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DomainKeysExpireNotAcceptable struct { +} + +// IsSuccess returns true when this domain keys expire not acceptable response has a 2xx status code +func (o *DomainKeysExpireNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire not acceptable response has a 3xx status code +func (o *DomainKeysExpireNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire not acceptable response has a 4xx status code +func (o *DomainKeysExpireNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire not acceptable response has a 5xx status code +func (o *DomainKeysExpireNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire not acceptable response a status code equal to that given +func (o *DomainKeysExpireNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the domain keys expire not acceptable response +func (o *DomainKeysExpireNotAcceptable) Code() int { + return 406 +} + +func (o *DomainKeysExpireNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotAcceptable", 406) +} + +func (o *DomainKeysExpireNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireNotAcceptable", 406) +} + +func (o *DomainKeysExpireNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireConflict creates a DomainKeysExpireConflict with default headers values +func NewDomainKeysExpireConflict() *DomainKeysExpireConflict { + return &DomainKeysExpireConflict{} +} + +/* +DomainKeysExpireConflict describes a response with status code 409, with default header values. + +Conflict: There is already an admin action running that conflicts with this action. Check the error message in the response body for more information. This is a temporary error; it should be possible to process this action if you try again in a bit. +*/ +type DomainKeysExpireConflict struct { +} + +// IsSuccess returns true when this domain keys expire conflict response has a 2xx status code +func (o *DomainKeysExpireConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire conflict response has a 3xx status code +func (o *DomainKeysExpireConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire conflict response has a 4xx status code +func (o *DomainKeysExpireConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this domain keys expire conflict response has a 5xx status code +func (o *DomainKeysExpireConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this domain keys expire conflict response a status code equal to that given +func (o *DomainKeysExpireConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the domain keys expire conflict response +func (o *DomainKeysExpireConflict) Code() int { + return 409 +} + +func (o *DomainKeysExpireConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireConflict", 409) +} + +func (o *DomainKeysExpireConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireConflict", 409) +} + +func (o *DomainKeysExpireConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDomainKeysExpireInternalServerError creates a DomainKeysExpireInternalServerError with default headers values +func NewDomainKeysExpireInternalServerError() *DomainKeysExpireInternalServerError { + return &DomainKeysExpireInternalServerError{} +} + +/* +DomainKeysExpireInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DomainKeysExpireInternalServerError struct { +} + +// IsSuccess returns true when this domain keys expire internal server error response has a 2xx status code +func (o *DomainKeysExpireInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this domain keys expire internal server error response has a 3xx status code +func (o *DomainKeysExpireInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this domain keys expire internal server error response has a 4xx status code +func (o *DomainKeysExpireInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this domain keys expire internal server error response has a 5xx status code +func (o *DomainKeysExpireInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this domain keys expire internal server error response a status code equal to that given +func (o *DomainKeysExpireInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the domain keys expire internal server error response +func (o *DomainKeysExpireInternalServerError) Code() int { + return 500 +} + +func (o *DomainKeysExpireInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireInternalServerError", 500) +} + +func (o *DomainKeysExpireInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/domain_keys_expire][%d] domainKeysExpireInternalServerError", 500) +} + +func (o *DomainKeysExpireInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/emoji_categories_get_parameters.go b/client/admin/emoji_categories_get_parameters.go new file mode 100644 index 0000000..55ce218 --- /dev/null +++ b/client/admin/emoji_categories_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewEmojiCategoriesGetParams creates a new EmojiCategoriesGetParams 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 NewEmojiCategoriesGetParams() *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiCategoriesGetParamsWithTimeout creates a new EmojiCategoriesGetParams object +// with the ability to set a timeout on a request. +func NewEmojiCategoriesGetParamsWithTimeout(timeout time.Duration) *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + timeout: timeout, + } +} + +// NewEmojiCategoriesGetParamsWithContext creates a new EmojiCategoriesGetParams object +// with the ability to set a context for a request. +func NewEmojiCategoriesGetParamsWithContext(ctx context.Context) *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + Context: ctx, + } +} + +// NewEmojiCategoriesGetParamsWithHTTPClient creates a new EmojiCategoriesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiCategoriesGetParamsWithHTTPClient(client *http.Client) *EmojiCategoriesGetParams { + return &EmojiCategoriesGetParams{ + HTTPClient: client, + } +} + +/* +EmojiCategoriesGetParams contains all the parameters to send to the API endpoint + + for the emoji categories get operation. + + Typically these are written to a http.Request. +*/ +type EmojiCategoriesGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji categories get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCategoriesGetParams) WithDefaults() *EmojiCategoriesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji categories get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCategoriesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji categories get params +func (o *EmojiCategoriesGetParams) WithTimeout(timeout time.Duration) *EmojiCategoriesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji categories get params +func (o *EmojiCategoriesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji categories get params +func (o *EmojiCategoriesGetParams) WithContext(ctx context.Context) *EmojiCategoriesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji categories get params +func (o *EmojiCategoriesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji categories get params +func (o *EmojiCategoriesGetParams) WithHTTPClient(client *http.Client) *EmojiCategoriesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji categories get params +func (o *EmojiCategoriesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiCategoriesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/emoji_categories_get_responses.go b/client/admin/emoji_categories_get_responses.go new file mode 100644 index 0000000..55fde8e --- /dev/null +++ b/client/admin/emoji_categories_get_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiCategoriesGetReader is a Reader for the EmojiCategoriesGet structure. +type EmojiCategoriesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiCategoriesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiCategoriesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiCategoriesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiCategoriesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiCategoriesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiCategoriesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiCategoriesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiCategoriesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/custom_emojis/categories] emojiCategoriesGet", response, response.Code()) + } +} + +// NewEmojiCategoriesGetOK creates a EmojiCategoriesGetOK with default headers values +func NewEmojiCategoriesGetOK() *EmojiCategoriesGetOK { + return &EmojiCategoriesGetOK{} +} + +/* +EmojiCategoriesGetOK describes a response with status code 200, with default header values. + +Array of existing emoji categories. +*/ +type EmojiCategoriesGetOK struct { + Payload []*models.EmojiCategory +} + +// IsSuccess returns true when this emoji categories get o k response has a 2xx status code +func (o *EmojiCategoriesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji categories get o k response has a 3xx status code +func (o *EmojiCategoriesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get o k response has a 4xx status code +func (o *EmojiCategoriesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji categories get o k response has a 5xx status code +func (o *EmojiCategoriesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get o k response a status code equal to that given +func (o *EmojiCategoriesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji categories get o k response +func (o *EmojiCategoriesGetOK) Code() int { + return 200 +} + +func (o *EmojiCategoriesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetOK %s", 200, payload) +} + +func (o *EmojiCategoriesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetOK %s", 200, payload) +} + +func (o *EmojiCategoriesGetOK) GetPayload() []*models.EmojiCategory { + return o.Payload +} + +func (o *EmojiCategoriesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiCategoriesGetBadRequest creates a EmojiCategoriesGetBadRequest with default headers values +func NewEmojiCategoriesGetBadRequest() *EmojiCategoriesGetBadRequest { + return &EmojiCategoriesGetBadRequest{} +} + +/* +EmojiCategoriesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiCategoriesGetBadRequest struct { +} + +// IsSuccess returns true when this emoji categories get bad request response has a 2xx status code +func (o *EmojiCategoriesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get bad request response has a 3xx status code +func (o *EmojiCategoriesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get bad request response has a 4xx status code +func (o *EmojiCategoriesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get bad request response has a 5xx status code +func (o *EmojiCategoriesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get bad request response a status code equal to that given +func (o *EmojiCategoriesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji categories get bad request response +func (o *EmojiCategoriesGetBadRequest) Code() int { + return 400 +} + +func (o *EmojiCategoriesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetBadRequest", 400) +} + +func (o *EmojiCategoriesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetBadRequest", 400) +} + +func (o *EmojiCategoriesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetUnauthorized creates a EmojiCategoriesGetUnauthorized with default headers values +func NewEmojiCategoriesGetUnauthorized() *EmojiCategoriesGetUnauthorized { + return &EmojiCategoriesGetUnauthorized{} +} + +/* +EmojiCategoriesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiCategoriesGetUnauthorized struct { +} + +// IsSuccess returns true when this emoji categories get unauthorized response has a 2xx status code +func (o *EmojiCategoriesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get unauthorized response has a 3xx status code +func (o *EmojiCategoriesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get unauthorized response has a 4xx status code +func (o *EmojiCategoriesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get unauthorized response has a 5xx status code +func (o *EmojiCategoriesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get unauthorized response a status code equal to that given +func (o *EmojiCategoriesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji categories get unauthorized response +func (o *EmojiCategoriesGetUnauthorized) Code() int { + return 401 +} + +func (o *EmojiCategoriesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetUnauthorized", 401) +} + +func (o *EmojiCategoriesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetUnauthorized", 401) +} + +func (o *EmojiCategoriesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetForbidden creates a EmojiCategoriesGetForbidden with default headers values +func NewEmojiCategoriesGetForbidden() *EmojiCategoriesGetForbidden { + return &EmojiCategoriesGetForbidden{} +} + +/* +EmojiCategoriesGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiCategoriesGetForbidden struct { +} + +// IsSuccess returns true when this emoji categories get forbidden response has a 2xx status code +func (o *EmojiCategoriesGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get forbidden response has a 3xx status code +func (o *EmojiCategoriesGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get forbidden response has a 4xx status code +func (o *EmojiCategoriesGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get forbidden response has a 5xx status code +func (o *EmojiCategoriesGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get forbidden response a status code equal to that given +func (o *EmojiCategoriesGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji categories get forbidden response +func (o *EmojiCategoriesGetForbidden) Code() int { + return 403 +} + +func (o *EmojiCategoriesGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetForbidden", 403) +} + +func (o *EmojiCategoriesGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetForbidden", 403) +} + +func (o *EmojiCategoriesGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetNotFound creates a EmojiCategoriesGetNotFound with default headers values +func NewEmojiCategoriesGetNotFound() *EmojiCategoriesGetNotFound { + return &EmojiCategoriesGetNotFound{} +} + +/* +EmojiCategoriesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiCategoriesGetNotFound struct { +} + +// IsSuccess returns true when this emoji categories get not found response has a 2xx status code +func (o *EmojiCategoriesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get not found response has a 3xx status code +func (o *EmojiCategoriesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get not found response has a 4xx status code +func (o *EmojiCategoriesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get not found response has a 5xx status code +func (o *EmojiCategoriesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get not found response a status code equal to that given +func (o *EmojiCategoriesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji categories get not found response +func (o *EmojiCategoriesGetNotFound) Code() int { + return 404 +} + +func (o *EmojiCategoriesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotFound", 404) +} + +func (o *EmojiCategoriesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotFound", 404) +} + +func (o *EmojiCategoriesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetNotAcceptable creates a EmojiCategoriesGetNotAcceptable with default headers values +func NewEmojiCategoriesGetNotAcceptable() *EmojiCategoriesGetNotAcceptable { + return &EmojiCategoriesGetNotAcceptable{} +} + +/* +EmojiCategoriesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiCategoriesGetNotAcceptable struct { +} + +// IsSuccess returns true when this emoji categories get not acceptable response has a 2xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get not acceptable response has a 3xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get not acceptable response has a 4xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji categories get not acceptable response has a 5xx status code +func (o *EmojiCategoriesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji categories get not acceptable response a status code equal to that given +func (o *EmojiCategoriesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji categories get not acceptable response +func (o *EmojiCategoriesGetNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiCategoriesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotAcceptable", 406) +} + +func (o *EmojiCategoriesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetNotAcceptable", 406) +} + +func (o *EmojiCategoriesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCategoriesGetInternalServerError creates a EmojiCategoriesGetInternalServerError with default headers values +func NewEmojiCategoriesGetInternalServerError() *EmojiCategoriesGetInternalServerError { + return &EmojiCategoriesGetInternalServerError{} +} + +/* +EmojiCategoriesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiCategoriesGetInternalServerError struct { +} + +// IsSuccess returns true when this emoji categories get internal server error response has a 2xx status code +func (o *EmojiCategoriesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji categories get internal server error response has a 3xx status code +func (o *EmojiCategoriesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji categories get internal server error response has a 4xx status code +func (o *EmojiCategoriesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji categories get internal server error response has a 5xx status code +func (o *EmojiCategoriesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji categories get internal server error response a status code equal to that given +func (o *EmojiCategoriesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji categories get internal server error response +func (o *EmojiCategoriesGetInternalServerError) Code() int { + return 500 +} + +func (o *EmojiCategoriesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetInternalServerError", 500) +} + +func (o *EmojiCategoriesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/categories][%d] emojiCategoriesGetInternalServerError", 500) +} + +func (o *EmojiCategoriesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/emoji_create_parameters.go b/client/admin/emoji_create_parameters.go new file mode 100644 index 0000000..4cd0fc1 --- /dev/null +++ b/client/admin/emoji_create_parameters.go @@ -0,0 +1,208 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewEmojiCreateParams creates a new EmojiCreateParams 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 NewEmojiCreateParams() *EmojiCreateParams { + return &EmojiCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiCreateParamsWithTimeout creates a new EmojiCreateParams object +// with the ability to set a timeout on a request. +func NewEmojiCreateParamsWithTimeout(timeout time.Duration) *EmojiCreateParams { + return &EmojiCreateParams{ + timeout: timeout, + } +} + +// NewEmojiCreateParamsWithContext creates a new EmojiCreateParams object +// with the ability to set a context for a request. +func NewEmojiCreateParamsWithContext(ctx context.Context) *EmojiCreateParams { + return &EmojiCreateParams{ + Context: ctx, + } +} + +// NewEmojiCreateParamsWithHTTPClient creates a new EmojiCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiCreateParamsWithHTTPClient(client *http.Client) *EmojiCreateParams { + return &EmojiCreateParams{ + HTTPClient: client, + } +} + +/* +EmojiCreateParams contains all the parameters to send to the API endpoint + + for the emoji create operation. + + Typically these are written to a http.Request. +*/ +type EmojiCreateParams struct { + + /* Category. + + Category in which to place the new emoji. If left blank, emoji will be uncategorized. If a category with the given name doesn't exist yet, it will be created. + */ + Category *string + + /* Image. + + A png or gif image of the emoji. Animated pngs work too! To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default. + */ + Image runtime.NamedReadCloser + + /* Shortcode. + + The code to use for the emoji, which will be used by instance denizens to select it. This must be unique on the instance. + */ + Shortcode string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCreateParams) WithDefaults() *EmojiCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji create params +func (o *EmojiCreateParams) WithTimeout(timeout time.Duration) *EmojiCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji create params +func (o *EmojiCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji create params +func (o *EmojiCreateParams) WithContext(ctx context.Context) *EmojiCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji create params +func (o *EmojiCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji create params +func (o *EmojiCreateParams) WithHTTPClient(client *http.Client) *EmojiCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji create params +func (o *EmojiCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCategory adds the category to the emoji create params +func (o *EmojiCreateParams) WithCategory(category *string) *EmojiCreateParams { + o.SetCategory(category) + return o +} + +// SetCategory adds the category to the emoji create params +func (o *EmojiCreateParams) SetCategory(category *string) { + o.Category = category +} + +// WithImage adds the image to the emoji create params +func (o *EmojiCreateParams) WithImage(image runtime.NamedReadCloser) *EmojiCreateParams { + o.SetImage(image) + return o +} + +// SetImage adds the image to the emoji create params +func (o *EmojiCreateParams) SetImage(image runtime.NamedReadCloser) { + o.Image = image +} + +// WithShortcode adds the shortcode to the emoji create params +func (o *EmojiCreateParams) WithShortcode(shortcode string) *EmojiCreateParams { + o.SetShortcode(shortcode) + return o +} + +// SetShortcode adds the shortcode to the emoji create params +func (o *EmojiCreateParams) SetShortcode(shortcode string) { + o.Shortcode = shortcode +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + 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 + } + } + } + // form file param image + if err := r.SetFileParam("image", o.Image); err != nil { + return err + } + + // form param shortcode + frShortcode := o.Shortcode + fShortcode := frShortcode + if fShortcode != "" { + if err := r.SetFormParam("shortcode", fShortcode); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/emoji_create_responses.go b/client/admin/emoji_create_responses.go new file mode 100644 index 0000000..e9336a1 --- /dev/null +++ b/client/admin/emoji_create_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiCreateReader is a Reader for the EmojiCreate structure. +type EmojiCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewEmojiCreateConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/custom_emojis] emojiCreate", response, response.Code()) + } +} + +// NewEmojiCreateOK creates a EmojiCreateOK with default headers values +func NewEmojiCreateOK() *EmojiCreateOK { + return &EmojiCreateOK{} +} + +/* +EmojiCreateOK describes a response with status code 200, with default header values. + +The newly-created emoji. +*/ +type EmojiCreateOK struct { + Payload *models.Emoji +} + +// IsSuccess returns true when this emoji create o k response has a 2xx status code +func (o *EmojiCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji create o k response has a 3xx status code +func (o *EmojiCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create o k response has a 4xx status code +func (o *EmojiCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji create o k response has a 5xx status code +func (o *EmojiCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create o k response a status code equal to that given +func (o *EmojiCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji create o k response +func (o *EmojiCreateOK) Code() int { + return 200 +} + +func (o *EmojiCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateOK %s", 200, payload) +} + +func (o *EmojiCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateOK %s", 200, payload) +} + +func (o *EmojiCreateOK) GetPayload() *models.Emoji { + return o.Payload +} + +func (o *EmojiCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Emoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiCreateBadRequest creates a EmojiCreateBadRequest with default headers values +func NewEmojiCreateBadRequest() *EmojiCreateBadRequest { + return &EmojiCreateBadRequest{} +} + +/* +EmojiCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiCreateBadRequest struct { +} + +// IsSuccess returns true when this emoji create bad request response has a 2xx status code +func (o *EmojiCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create bad request response has a 3xx status code +func (o *EmojiCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create bad request response has a 4xx status code +func (o *EmojiCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create bad request response has a 5xx status code +func (o *EmojiCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create bad request response a status code equal to that given +func (o *EmojiCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji create bad request response +func (o *EmojiCreateBadRequest) Code() int { + return 400 +} + +func (o *EmojiCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateBadRequest", 400) +} + +func (o *EmojiCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateBadRequest", 400) +} + +func (o *EmojiCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateUnauthorized creates a EmojiCreateUnauthorized with default headers values +func NewEmojiCreateUnauthorized() *EmojiCreateUnauthorized { + return &EmojiCreateUnauthorized{} +} + +/* +EmojiCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiCreateUnauthorized struct { +} + +// IsSuccess returns true when this emoji create unauthorized response has a 2xx status code +func (o *EmojiCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create unauthorized response has a 3xx status code +func (o *EmojiCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create unauthorized response has a 4xx status code +func (o *EmojiCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create unauthorized response has a 5xx status code +func (o *EmojiCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create unauthorized response a status code equal to that given +func (o *EmojiCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji create unauthorized response +func (o *EmojiCreateUnauthorized) Code() int { + return 401 +} + +func (o *EmojiCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateUnauthorized", 401) +} + +func (o *EmojiCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateUnauthorized", 401) +} + +func (o *EmojiCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateForbidden creates a EmojiCreateForbidden with default headers values +func NewEmojiCreateForbidden() *EmojiCreateForbidden { + return &EmojiCreateForbidden{} +} + +/* +EmojiCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiCreateForbidden struct { +} + +// IsSuccess returns true when this emoji create forbidden response has a 2xx status code +func (o *EmojiCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create forbidden response has a 3xx status code +func (o *EmojiCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create forbidden response has a 4xx status code +func (o *EmojiCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create forbidden response has a 5xx status code +func (o *EmojiCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create forbidden response a status code equal to that given +func (o *EmojiCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji create forbidden response +func (o *EmojiCreateForbidden) Code() int { + return 403 +} + +func (o *EmojiCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateForbidden", 403) +} + +func (o *EmojiCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateForbidden", 403) +} + +func (o *EmojiCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateNotFound creates a EmojiCreateNotFound with default headers values +func NewEmojiCreateNotFound() *EmojiCreateNotFound { + return &EmojiCreateNotFound{} +} + +/* +EmojiCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiCreateNotFound struct { +} + +// IsSuccess returns true when this emoji create not found response has a 2xx status code +func (o *EmojiCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create not found response has a 3xx status code +func (o *EmojiCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create not found response has a 4xx status code +func (o *EmojiCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create not found response has a 5xx status code +func (o *EmojiCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create not found response a status code equal to that given +func (o *EmojiCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji create not found response +func (o *EmojiCreateNotFound) Code() int { + return 404 +} + +func (o *EmojiCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotFound", 404) +} + +func (o *EmojiCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotFound", 404) +} + +func (o *EmojiCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateNotAcceptable creates a EmojiCreateNotAcceptable with default headers values +func NewEmojiCreateNotAcceptable() *EmojiCreateNotAcceptable { + return &EmojiCreateNotAcceptable{} +} + +/* +EmojiCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiCreateNotAcceptable struct { +} + +// IsSuccess returns true when this emoji create not acceptable response has a 2xx status code +func (o *EmojiCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create not acceptable response has a 3xx status code +func (o *EmojiCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create not acceptable response has a 4xx status code +func (o *EmojiCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create not acceptable response has a 5xx status code +func (o *EmojiCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create not acceptable response a status code equal to that given +func (o *EmojiCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji create not acceptable response +func (o *EmojiCreateNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotAcceptable", 406) +} + +func (o *EmojiCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateNotAcceptable", 406) +} + +func (o *EmojiCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateConflict creates a EmojiCreateConflict with default headers values +func NewEmojiCreateConflict() *EmojiCreateConflict { + return &EmojiCreateConflict{} +} + +/* +EmojiCreateConflict describes a response with status code 409, with default header values. + +conflict -- shortcode for this emoji is already in use +*/ +type EmojiCreateConflict struct { +} + +// IsSuccess returns true when this emoji create conflict response has a 2xx status code +func (o *EmojiCreateConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create conflict response has a 3xx status code +func (o *EmojiCreateConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create conflict response has a 4xx status code +func (o *EmojiCreateConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji create conflict response has a 5xx status code +func (o *EmojiCreateConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji create conflict response a status code equal to that given +func (o *EmojiCreateConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the emoji create conflict response +func (o *EmojiCreateConflict) Code() int { + return 409 +} + +func (o *EmojiCreateConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateConflict", 409) +} + +func (o *EmojiCreateConflict) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateConflict", 409) +} + +func (o *EmojiCreateConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiCreateInternalServerError creates a EmojiCreateInternalServerError with default headers values +func NewEmojiCreateInternalServerError() *EmojiCreateInternalServerError { + return &EmojiCreateInternalServerError{} +} + +/* +EmojiCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiCreateInternalServerError struct { +} + +// IsSuccess returns true when this emoji create internal server error response has a 2xx status code +func (o *EmojiCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji create internal server error response has a 3xx status code +func (o *EmojiCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji create internal server error response has a 4xx status code +func (o *EmojiCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji create internal server error response has a 5xx status code +func (o *EmojiCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji create internal server error response a status code equal to that given +func (o *EmojiCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji create internal server error response +func (o *EmojiCreateInternalServerError) Code() int { + return 500 +} + +func (o *EmojiCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateInternalServerError", 500) +} + +func (o *EmojiCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/custom_emojis][%d] emojiCreateInternalServerError", 500) +} + +func (o *EmojiCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/emoji_delete_parameters.go b/client/admin/emoji_delete_parameters.go new file mode 100644 index 0000000..70c7c69 --- /dev/null +++ b/client/admin/emoji_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewEmojiDeleteParams creates a new EmojiDeleteParams 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 NewEmojiDeleteParams() *EmojiDeleteParams { + return &EmojiDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiDeleteParamsWithTimeout creates a new EmojiDeleteParams object +// with the ability to set a timeout on a request. +func NewEmojiDeleteParamsWithTimeout(timeout time.Duration) *EmojiDeleteParams { + return &EmojiDeleteParams{ + timeout: timeout, + } +} + +// NewEmojiDeleteParamsWithContext creates a new EmojiDeleteParams object +// with the ability to set a context for a request. +func NewEmojiDeleteParamsWithContext(ctx context.Context) *EmojiDeleteParams { + return &EmojiDeleteParams{ + Context: ctx, + } +} + +// NewEmojiDeleteParamsWithHTTPClient creates a new EmojiDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiDeleteParamsWithHTTPClient(client *http.Client) *EmojiDeleteParams { + return &EmojiDeleteParams{ + HTTPClient: client, + } +} + +/* +EmojiDeleteParams contains all the parameters to send to the API endpoint + + for the emoji delete operation. + + Typically these are written to a http.Request. +*/ +type EmojiDeleteParams struct { + + /* ID. + + The id of the emoji. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiDeleteParams) WithDefaults() *EmojiDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji delete params +func (o *EmojiDeleteParams) WithTimeout(timeout time.Duration) *EmojiDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji delete params +func (o *EmojiDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji delete params +func (o *EmojiDeleteParams) WithContext(ctx context.Context) *EmojiDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji delete params +func (o *EmojiDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji delete params +func (o *EmojiDeleteParams) WithHTTPClient(client *http.Client) *EmojiDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji delete params +func (o *EmojiDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the emoji delete params +func (o *EmojiDeleteParams) WithID(id string) *EmojiDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the emoji delete params +func (o *EmojiDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/emoji_delete_responses.go b/client/admin/emoji_delete_responses.go new file mode 100644 index 0000000..52eb4bc --- /dev/null +++ b/client/admin/emoji_delete_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiDeleteReader is a Reader for the EmojiDelete structure. +type EmojiDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/custom_emojis/{id}] emojiDelete", response, response.Code()) + } +} + +// NewEmojiDeleteOK creates a EmojiDeleteOK with default headers values +func NewEmojiDeleteOK() *EmojiDeleteOK { + return &EmojiDeleteOK{} +} + +/* +EmojiDeleteOK describes a response with status code 200, with default header values. + +The deleted emoji will be returned to the caller in case further processing is necessary. +*/ +type EmojiDeleteOK struct { + Payload *models.AdminEmoji +} + +// IsSuccess returns true when this emoji delete o k response has a 2xx status code +func (o *EmojiDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji delete o k response has a 3xx status code +func (o *EmojiDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete o k response has a 4xx status code +func (o *EmojiDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji delete o k response has a 5xx status code +func (o *EmojiDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete o k response a status code equal to that given +func (o *EmojiDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji delete o k response +func (o *EmojiDeleteOK) Code() int { + return 200 +} + +func (o *EmojiDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteOK %s", 200, payload) +} + +func (o *EmojiDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteOK %s", 200, payload) +} + +func (o *EmojiDeleteOK) GetPayload() *models.AdminEmoji { + return o.Payload +} + +func (o *EmojiDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminEmoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiDeleteBadRequest creates a EmojiDeleteBadRequest with default headers values +func NewEmojiDeleteBadRequest() *EmojiDeleteBadRequest { + return &EmojiDeleteBadRequest{} +} + +/* +EmojiDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiDeleteBadRequest struct { +} + +// IsSuccess returns true when this emoji delete bad request response has a 2xx status code +func (o *EmojiDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete bad request response has a 3xx status code +func (o *EmojiDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete bad request response has a 4xx status code +func (o *EmojiDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete bad request response has a 5xx status code +func (o *EmojiDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete bad request response a status code equal to that given +func (o *EmojiDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji delete bad request response +func (o *EmojiDeleteBadRequest) Code() int { + return 400 +} + +func (o *EmojiDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteBadRequest", 400) +} + +func (o *EmojiDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteBadRequest", 400) +} + +func (o *EmojiDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteUnauthorized creates a EmojiDeleteUnauthorized with default headers values +func NewEmojiDeleteUnauthorized() *EmojiDeleteUnauthorized { + return &EmojiDeleteUnauthorized{} +} + +/* +EmojiDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiDeleteUnauthorized struct { +} + +// IsSuccess returns true when this emoji delete unauthorized response has a 2xx status code +func (o *EmojiDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete unauthorized response has a 3xx status code +func (o *EmojiDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete unauthorized response has a 4xx status code +func (o *EmojiDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete unauthorized response has a 5xx status code +func (o *EmojiDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete unauthorized response a status code equal to that given +func (o *EmojiDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji delete unauthorized response +func (o *EmojiDeleteUnauthorized) Code() int { + return 401 +} + +func (o *EmojiDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteUnauthorized", 401) +} + +func (o *EmojiDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteUnauthorized", 401) +} + +func (o *EmojiDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteForbidden creates a EmojiDeleteForbidden with default headers values +func NewEmojiDeleteForbidden() *EmojiDeleteForbidden { + return &EmojiDeleteForbidden{} +} + +/* +EmojiDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiDeleteForbidden struct { +} + +// IsSuccess returns true when this emoji delete forbidden response has a 2xx status code +func (o *EmojiDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete forbidden response has a 3xx status code +func (o *EmojiDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete forbidden response has a 4xx status code +func (o *EmojiDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete forbidden response has a 5xx status code +func (o *EmojiDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete forbidden response a status code equal to that given +func (o *EmojiDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji delete forbidden response +func (o *EmojiDeleteForbidden) Code() int { + return 403 +} + +func (o *EmojiDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteForbidden", 403) +} + +func (o *EmojiDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteForbidden", 403) +} + +func (o *EmojiDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteNotFound creates a EmojiDeleteNotFound with default headers values +func NewEmojiDeleteNotFound() *EmojiDeleteNotFound { + return &EmojiDeleteNotFound{} +} + +/* +EmojiDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiDeleteNotFound struct { +} + +// IsSuccess returns true when this emoji delete not found response has a 2xx status code +func (o *EmojiDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete not found response has a 3xx status code +func (o *EmojiDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete not found response has a 4xx status code +func (o *EmojiDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete not found response has a 5xx status code +func (o *EmojiDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete not found response a status code equal to that given +func (o *EmojiDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji delete not found response +func (o *EmojiDeleteNotFound) Code() int { + return 404 +} + +func (o *EmojiDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotFound", 404) +} + +func (o *EmojiDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotFound", 404) +} + +func (o *EmojiDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteNotAcceptable creates a EmojiDeleteNotAcceptable with default headers values +func NewEmojiDeleteNotAcceptable() *EmojiDeleteNotAcceptable { + return &EmojiDeleteNotAcceptable{} +} + +/* +EmojiDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this emoji delete not acceptable response has a 2xx status code +func (o *EmojiDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete not acceptable response has a 3xx status code +func (o *EmojiDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete not acceptable response has a 4xx status code +func (o *EmojiDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji delete not acceptable response has a 5xx status code +func (o *EmojiDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji delete not acceptable response a status code equal to that given +func (o *EmojiDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji delete not acceptable response +func (o *EmojiDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotAcceptable", 406) +} + +func (o *EmojiDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteNotAcceptable", 406) +} + +func (o *EmojiDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiDeleteInternalServerError creates a EmojiDeleteInternalServerError with default headers values +func NewEmojiDeleteInternalServerError() *EmojiDeleteInternalServerError { + return &EmojiDeleteInternalServerError{} +} + +/* +EmojiDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiDeleteInternalServerError struct { +} + +// IsSuccess returns true when this emoji delete internal server error response has a 2xx status code +func (o *EmojiDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji delete internal server error response has a 3xx status code +func (o *EmojiDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji delete internal server error response has a 4xx status code +func (o *EmojiDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji delete internal server error response has a 5xx status code +func (o *EmojiDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji delete internal server error response a status code equal to that given +func (o *EmojiDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji delete internal server error response +func (o *EmojiDeleteInternalServerError) Code() int { + return 500 +} + +func (o *EmojiDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteInternalServerError", 500) +} + +func (o *EmojiDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/custom_emojis/{id}][%d] emojiDeleteInternalServerError", 500) +} + +func (o *EmojiDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/emoji_get_parameters.go b/client/admin/emoji_get_parameters.go new file mode 100644 index 0000000..033573a --- /dev/null +++ b/client/admin/emoji_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewEmojiGetParams creates a new EmojiGetParams 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 NewEmojiGetParams() *EmojiGetParams { + return &EmojiGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiGetParamsWithTimeout creates a new EmojiGetParams object +// with the ability to set a timeout on a request. +func NewEmojiGetParamsWithTimeout(timeout time.Duration) *EmojiGetParams { + return &EmojiGetParams{ + timeout: timeout, + } +} + +// NewEmojiGetParamsWithContext creates a new EmojiGetParams object +// with the ability to set a context for a request. +func NewEmojiGetParamsWithContext(ctx context.Context) *EmojiGetParams { + return &EmojiGetParams{ + Context: ctx, + } +} + +// NewEmojiGetParamsWithHTTPClient creates a new EmojiGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiGetParamsWithHTTPClient(client *http.Client) *EmojiGetParams { + return &EmojiGetParams{ + HTTPClient: client, + } +} + +/* +EmojiGetParams contains all the parameters to send to the API endpoint + + for the emoji get operation. + + Typically these are written to a http.Request. +*/ +type EmojiGetParams struct { + + /* ID. + + The id of the emoji. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiGetParams) WithDefaults() *EmojiGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji get params +func (o *EmojiGetParams) WithTimeout(timeout time.Duration) *EmojiGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji get params +func (o *EmojiGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji get params +func (o *EmojiGetParams) WithContext(ctx context.Context) *EmojiGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji get params +func (o *EmojiGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji get params +func (o *EmojiGetParams) WithHTTPClient(client *http.Client) *EmojiGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji get params +func (o *EmojiGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the emoji get params +func (o *EmojiGetParams) WithID(id string) *EmojiGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the emoji get params +func (o *EmojiGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/emoji_get_responses.go b/client/admin/emoji_get_responses.go new file mode 100644 index 0000000..3f0693c --- /dev/null +++ b/client/admin/emoji_get_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiGetReader is a Reader for the EmojiGet structure. +type EmojiGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/custom_emojis/{id}] emojiGet", response, response.Code()) + } +} + +// NewEmojiGetOK creates a EmojiGetOK with default headers values +func NewEmojiGetOK() *EmojiGetOK { + return &EmojiGetOK{} +} + +/* +EmojiGetOK describes a response with status code 200, with default header values. + +A single emoji. +*/ +type EmojiGetOK struct { + Payload *models.AdminEmoji +} + +// IsSuccess returns true when this emoji get o k response has a 2xx status code +func (o *EmojiGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji get o k response has a 3xx status code +func (o *EmojiGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get o k response has a 4xx status code +func (o *EmojiGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji get o k response has a 5xx status code +func (o *EmojiGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get o k response a status code equal to that given +func (o *EmojiGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji get o k response +func (o *EmojiGetOK) Code() int { + return 200 +} + +func (o *EmojiGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetOK %s", 200, payload) +} + +func (o *EmojiGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetOK %s", 200, payload) +} + +func (o *EmojiGetOK) GetPayload() *models.AdminEmoji { + return o.Payload +} + +func (o *EmojiGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminEmoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiGetBadRequest creates a EmojiGetBadRequest with default headers values +func NewEmojiGetBadRequest() *EmojiGetBadRequest { + return &EmojiGetBadRequest{} +} + +/* +EmojiGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiGetBadRequest struct { +} + +// IsSuccess returns true when this emoji get bad request response has a 2xx status code +func (o *EmojiGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get bad request response has a 3xx status code +func (o *EmojiGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get bad request response has a 4xx status code +func (o *EmojiGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get bad request response has a 5xx status code +func (o *EmojiGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get bad request response a status code equal to that given +func (o *EmojiGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji get bad request response +func (o *EmojiGetBadRequest) Code() int { + return 400 +} + +func (o *EmojiGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetBadRequest", 400) +} + +func (o *EmojiGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetBadRequest", 400) +} + +func (o *EmojiGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetUnauthorized creates a EmojiGetUnauthorized with default headers values +func NewEmojiGetUnauthorized() *EmojiGetUnauthorized { + return &EmojiGetUnauthorized{} +} + +/* +EmojiGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiGetUnauthorized struct { +} + +// IsSuccess returns true when this emoji get unauthorized response has a 2xx status code +func (o *EmojiGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get unauthorized response has a 3xx status code +func (o *EmojiGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get unauthorized response has a 4xx status code +func (o *EmojiGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get unauthorized response has a 5xx status code +func (o *EmojiGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get unauthorized response a status code equal to that given +func (o *EmojiGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji get unauthorized response +func (o *EmojiGetUnauthorized) Code() int { + return 401 +} + +func (o *EmojiGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetUnauthorized", 401) +} + +func (o *EmojiGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetUnauthorized", 401) +} + +func (o *EmojiGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetForbidden creates a EmojiGetForbidden with default headers values +func NewEmojiGetForbidden() *EmojiGetForbidden { + return &EmojiGetForbidden{} +} + +/* +EmojiGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiGetForbidden struct { +} + +// IsSuccess returns true when this emoji get forbidden response has a 2xx status code +func (o *EmojiGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get forbidden response has a 3xx status code +func (o *EmojiGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get forbidden response has a 4xx status code +func (o *EmojiGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get forbidden response has a 5xx status code +func (o *EmojiGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get forbidden response a status code equal to that given +func (o *EmojiGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji get forbidden response +func (o *EmojiGetForbidden) Code() int { + return 403 +} + +func (o *EmojiGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetForbidden", 403) +} + +func (o *EmojiGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetForbidden", 403) +} + +func (o *EmojiGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetNotFound creates a EmojiGetNotFound with default headers values +func NewEmojiGetNotFound() *EmojiGetNotFound { + return &EmojiGetNotFound{} +} + +/* +EmojiGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiGetNotFound struct { +} + +// IsSuccess returns true when this emoji get not found response has a 2xx status code +func (o *EmojiGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get not found response has a 3xx status code +func (o *EmojiGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get not found response has a 4xx status code +func (o *EmojiGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get not found response has a 5xx status code +func (o *EmojiGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get not found response a status code equal to that given +func (o *EmojiGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji get not found response +func (o *EmojiGetNotFound) Code() int { + return 404 +} + +func (o *EmojiGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotFound", 404) +} + +func (o *EmojiGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotFound", 404) +} + +func (o *EmojiGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetNotAcceptable creates a EmojiGetNotAcceptable with default headers values +func NewEmojiGetNotAcceptable() *EmojiGetNotAcceptable { + return &EmojiGetNotAcceptable{} +} + +/* +EmojiGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiGetNotAcceptable struct { +} + +// IsSuccess returns true when this emoji get not acceptable response has a 2xx status code +func (o *EmojiGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get not acceptable response has a 3xx status code +func (o *EmojiGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get not acceptable response has a 4xx status code +func (o *EmojiGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji get not acceptable response has a 5xx status code +func (o *EmojiGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji get not acceptable response a status code equal to that given +func (o *EmojiGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji get not acceptable response +func (o *EmojiGetNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotAcceptable", 406) +} + +func (o *EmojiGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetNotAcceptable", 406) +} + +func (o *EmojiGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiGetInternalServerError creates a EmojiGetInternalServerError with default headers values +func NewEmojiGetInternalServerError() *EmojiGetInternalServerError { + return &EmojiGetInternalServerError{} +} + +/* +EmojiGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiGetInternalServerError struct { +} + +// IsSuccess returns true when this emoji get internal server error response has a 2xx status code +func (o *EmojiGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji get internal server error response has a 3xx status code +func (o *EmojiGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji get internal server error response has a 4xx status code +func (o *EmojiGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji get internal server error response has a 5xx status code +func (o *EmojiGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji get internal server error response a status code equal to that given +func (o *EmojiGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji get internal server error response +func (o *EmojiGetInternalServerError) Code() int { + return 500 +} + +func (o *EmojiGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetInternalServerError", 500) +} + +func (o *EmojiGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis/{id}][%d] emojiGetInternalServerError", 500) +} + +func (o *EmojiGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/emoji_update_parameters.go b/client/admin/emoji_update_parameters.go new file mode 100644 index 0000000..2bf0bd3 --- /dev/null +++ b/client/admin/emoji_update_parameters.go @@ -0,0 +1,270 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewEmojiUpdateParams creates a new EmojiUpdateParams 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 NewEmojiUpdateParams() *EmojiUpdateParams { + return &EmojiUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojiUpdateParamsWithTimeout creates a new EmojiUpdateParams object +// with the ability to set a timeout on a request. +func NewEmojiUpdateParamsWithTimeout(timeout time.Duration) *EmojiUpdateParams { + return &EmojiUpdateParams{ + timeout: timeout, + } +} + +// NewEmojiUpdateParamsWithContext creates a new EmojiUpdateParams object +// with the ability to set a context for a request. +func NewEmojiUpdateParamsWithContext(ctx context.Context) *EmojiUpdateParams { + return &EmojiUpdateParams{ + Context: ctx, + } +} + +// NewEmojiUpdateParamsWithHTTPClient creates a new EmojiUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojiUpdateParamsWithHTTPClient(client *http.Client) *EmojiUpdateParams { + return &EmojiUpdateParams{ + HTTPClient: client, + } +} + +/* +EmojiUpdateParams contains all the parameters to send to the API endpoint + + for the emoji update operation. + + Typically these are written to a http.Request. +*/ +type EmojiUpdateParams struct { + + /* Category. + + Category in which to place the emoji. If a category with the given name doesn't exist yet, it will be created. + */ + Category *string + + /* ID. + + The id of the emoji. + */ + ID string + + /* Image. + + A new png or gif image to use for the emoji. Animated pngs work too! To ensure compatibility with other fedi implementations, emoji size limit is 50kb by default. Works for LOCAL emojis only. + */ + Image runtime.NamedReadCloser + + /* Shortcode. + + The code to use for the emoji, which will be used by instance denizens to select it. This must be unique on the instance. Works for the `copy` action type only. + */ + Shortcode *string + + /* Type. + + Type of action to be taken. One of: (`disable`, `copy`, `modify`). + For REMOTE emojis, `copy` or `disable` are supported. + For LOCAL emojis, only `modify` is supported. + */ + Type string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emoji update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiUpdateParams) WithDefaults() *EmojiUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emoji update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojiUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the emoji update params +func (o *EmojiUpdateParams) WithTimeout(timeout time.Duration) *EmojiUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emoji update params +func (o *EmojiUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emoji update params +func (o *EmojiUpdateParams) WithContext(ctx context.Context) *EmojiUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emoji update params +func (o *EmojiUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emoji update params +func (o *EmojiUpdateParams) WithHTTPClient(client *http.Client) *EmojiUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emoji update params +func (o *EmojiUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithCategory adds the category to the emoji update params +func (o *EmojiUpdateParams) WithCategory(category *string) *EmojiUpdateParams { + o.SetCategory(category) + return o +} + +// SetCategory adds the category to the emoji update params +func (o *EmojiUpdateParams) SetCategory(category *string) { + o.Category = category +} + +// WithID adds the id to the emoji update params +func (o *EmojiUpdateParams) WithID(id string) *EmojiUpdateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the emoji update params +func (o *EmojiUpdateParams) SetID(id string) { + o.ID = id +} + +// WithImage adds the image to the emoji update params +func (o *EmojiUpdateParams) WithImage(image runtime.NamedReadCloser) *EmojiUpdateParams { + o.SetImage(image) + return o +} + +// SetImage adds the image to the emoji update params +func (o *EmojiUpdateParams) SetImage(image runtime.NamedReadCloser) { + o.Image = image +} + +// WithShortcode adds the shortcode to the emoji update params +func (o *EmojiUpdateParams) WithShortcode(shortcode *string) *EmojiUpdateParams { + o.SetShortcode(shortcode) + return o +} + +// SetShortcode adds the shortcode to the emoji update params +func (o *EmojiUpdateParams) SetShortcode(shortcode *string) { + o.Shortcode = shortcode +} + +// WithType adds the typeVar to the emoji update params +func (o *EmojiUpdateParams) WithType(typeVar string) *EmojiUpdateParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the emoji update params +func (o *EmojiUpdateParams) SetType(typeVar string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojiUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + 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 + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Image != nil { + + if o.Image != nil { + // form file param image + if err := r.SetFileParam("image", o.Image); err != nil { + return err + } + } + } + + if o.Shortcode != nil { + + // form param shortcode + var frShortcode string + if o.Shortcode != nil { + frShortcode = *o.Shortcode + } + fShortcode := frShortcode + if fShortcode != "" { + if err := r.SetFormParam("shortcode", fShortcode); err != nil { + return err + } + } + } + + // form param type + frType := o.Type + fType := frType + if fType != "" { + if err := r.SetFormParam("type", fType); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/emoji_update_responses.go b/client/admin/emoji_update_responses.go new file mode 100644 index 0000000..e41639f --- /dev/null +++ b/client/admin/emoji_update_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojiUpdateReader is a Reader for the EmojiUpdate structure. +type EmojiUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojiUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojiUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojiUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojiUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojiUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojiUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojiUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojiUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/admin/custom_emojis/{id}] emojiUpdate", response, response.Code()) + } +} + +// NewEmojiUpdateOK creates a EmojiUpdateOK with default headers values +func NewEmojiUpdateOK() *EmojiUpdateOK { + return &EmojiUpdateOK{} +} + +/* +EmojiUpdateOK describes a response with status code 200, with default header values. + +The updated emoji. +*/ +type EmojiUpdateOK struct { + Payload *models.AdminEmoji +} + +// IsSuccess returns true when this emoji update o k response has a 2xx status code +func (o *EmojiUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emoji update o k response has a 3xx status code +func (o *EmojiUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update o k response has a 4xx status code +func (o *EmojiUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji update o k response has a 5xx status code +func (o *EmojiUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update o k response a status code equal to that given +func (o *EmojiUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emoji update o k response +func (o *EmojiUpdateOK) Code() int { + return 200 +} + +func (o *EmojiUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateOK %s", 200, payload) +} + +func (o *EmojiUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateOK %s", 200, payload) +} + +func (o *EmojiUpdateOK) GetPayload() *models.AdminEmoji { + return o.Payload +} + +func (o *EmojiUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.AdminEmoji) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojiUpdateBadRequest creates a EmojiUpdateBadRequest with default headers values +func NewEmojiUpdateBadRequest() *EmojiUpdateBadRequest { + return &EmojiUpdateBadRequest{} +} + +/* +EmojiUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojiUpdateBadRequest struct { +} + +// IsSuccess returns true when this emoji update bad request response has a 2xx status code +func (o *EmojiUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update bad request response has a 3xx status code +func (o *EmojiUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update bad request response has a 4xx status code +func (o *EmojiUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update bad request response has a 5xx status code +func (o *EmojiUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update bad request response a status code equal to that given +func (o *EmojiUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emoji update bad request response +func (o *EmojiUpdateBadRequest) Code() int { + return 400 +} + +func (o *EmojiUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateBadRequest", 400) +} + +func (o *EmojiUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateBadRequest", 400) +} + +func (o *EmojiUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateUnauthorized creates a EmojiUpdateUnauthorized with default headers values +func NewEmojiUpdateUnauthorized() *EmojiUpdateUnauthorized { + return &EmojiUpdateUnauthorized{} +} + +/* +EmojiUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojiUpdateUnauthorized struct { +} + +// IsSuccess returns true when this emoji update unauthorized response has a 2xx status code +func (o *EmojiUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update unauthorized response has a 3xx status code +func (o *EmojiUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update unauthorized response has a 4xx status code +func (o *EmojiUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update unauthorized response has a 5xx status code +func (o *EmojiUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update unauthorized response a status code equal to that given +func (o *EmojiUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emoji update unauthorized response +func (o *EmojiUpdateUnauthorized) Code() int { + return 401 +} + +func (o *EmojiUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateUnauthorized", 401) +} + +func (o *EmojiUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateUnauthorized", 401) +} + +func (o *EmojiUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateForbidden creates a EmojiUpdateForbidden with default headers values +func NewEmojiUpdateForbidden() *EmojiUpdateForbidden { + return &EmojiUpdateForbidden{} +} + +/* +EmojiUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojiUpdateForbidden struct { +} + +// IsSuccess returns true when this emoji update forbidden response has a 2xx status code +func (o *EmojiUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update forbidden response has a 3xx status code +func (o *EmojiUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update forbidden response has a 4xx status code +func (o *EmojiUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update forbidden response has a 5xx status code +func (o *EmojiUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update forbidden response a status code equal to that given +func (o *EmojiUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emoji update forbidden response +func (o *EmojiUpdateForbidden) Code() int { + return 403 +} + +func (o *EmojiUpdateForbidden) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateForbidden", 403) +} + +func (o *EmojiUpdateForbidden) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateForbidden", 403) +} + +func (o *EmojiUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateNotFound creates a EmojiUpdateNotFound with default headers values +func NewEmojiUpdateNotFound() *EmojiUpdateNotFound { + return &EmojiUpdateNotFound{} +} + +/* +EmojiUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojiUpdateNotFound struct { +} + +// IsSuccess returns true when this emoji update not found response has a 2xx status code +func (o *EmojiUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update not found response has a 3xx status code +func (o *EmojiUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update not found response has a 4xx status code +func (o *EmojiUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update not found response has a 5xx status code +func (o *EmojiUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update not found response a status code equal to that given +func (o *EmojiUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emoji update not found response +func (o *EmojiUpdateNotFound) Code() int { + return 404 +} + +func (o *EmojiUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotFound", 404) +} + +func (o *EmojiUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotFound", 404) +} + +func (o *EmojiUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateNotAcceptable creates a EmojiUpdateNotAcceptable with default headers values +func NewEmojiUpdateNotAcceptable() *EmojiUpdateNotAcceptable { + return &EmojiUpdateNotAcceptable{} +} + +/* +EmojiUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojiUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this emoji update not acceptable response has a 2xx status code +func (o *EmojiUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update not acceptable response has a 3xx status code +func (o *EmojiUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update not acceptable response has a 4xx status code +func (o *EmojiUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emoji update not acceptable response has a 5xx status code +func (o *EmojiUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emoji update not acceptable response a status code equal to that given +func (o *EmojiUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emoji update not acceptable response +func (o *EmojiUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *EmojiUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotAcceptable", 406) +} + +func (o *EmojiUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateNotAcceptable", 406) +} + +func (o *EmojiUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojiUpdateInternalServerError creates a EmojiUpdateInternalServerError with default headers values +func NewEmojiUpdateInternalServerError() *EmojiUpdateInternalServerError { + return &EmojiUpdateInternalServerError{} +} + +/* +EmojiUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojiUpdateInternalServerError struct { +} + +// IsSuccess returns true when this emoji update internal server error response has a 2xx status code +func (o *EmojiUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emoji update internal server error response has a 3xx status code +func (o *EmojiUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emoji update internal server error response has a 4xx status code +func (o *EmojiUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emoji update internal server error response has a 5xx status code +func (o *EmojiUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emoji update internal server error response a status code equal to that given +func (o *EmojiUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emoji update internal server error response +func (o *EmojiUpdateInternalServerError) Code() int { + return 500 +} + +func (o *EmojiUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateInternalServerError", 500) +} + +func (o *EmojiUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/custom_emojis/{id}][%d] emojiUpdateInternalServerError", 500) +} + +func (o *EmojiUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/emojis_get_parameters.go b/client/admin/emojis_get_parameters.go new file mode 100644 index 0000000..f383367 --- /dev/null +++ b/client/admin/emojis_get_parameters.go @@ -0,0 +1,301 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewEmojisGetParams creates a new EmojisGetParams 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 NewEmojisGetParams() *EmojisGetParams { + return &EmojisGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewEmojisGetParamsWithTimeout creates a new EmojisGetParams object +// with the ability to set a timeout on a request. +func NewEmojisGetParamsWithTimeout(timeout time.Duration) *EmojisGetParams { + return &EmojisGetParams{ + timeout: timeout, + } +} + +// NewEmojisGetParamsWithContext creates a new EmojisGetParams object +// with the ability to set a context for a request. +func NewEmojisGetParamsWithContext(ctx context.Context) *EmojisGetParams { + return &EmojisGetParams{ + Context: ctx, + } +} + +// NewEmojisGetParamsWithHTTPClient creates a new EmojisGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewEmojisGetParamsWithHTTPClient(client *http.Client) *EmojisGetParams { + return &EmojisGetParams{ + HTTPClient: client, + } +} + +/* +EmojisGetParams contains all the parameters to send to the API endpoint + + for the emojis get operation. + + Typically these are written to a http.Request. +*/ +type EmojisGetParams struct { + + /* Filter. + + Comma-separated list of filters to apply to results. Recognized filters are: + + `domain:[domain]` -- show emojis from the given domain, eg `?filter=domain:example.org` will show emojis from `example.org` only. + Instead of giving a specific domain, you can also give either one of the key words `local` or `all` to show either local emojis only (`domain:local`) or show all emojis from all domains (`domain:all`). + Note: `domain:*` is equivalent to `domain:all` (including local). + If no domain filter is provided, `domain:all` will be assumed. + + `disabled` -- include emojis that have been disabled. + + `enabled` -- include emojis that are enabled. + + `shortcode:[shortcode]` -- show only emojis with the given shortcode, eg `?filter=shortcode:blob_cat_uwu` will show only emojis with the shortcode `blob_cat_uwu` (case sensitive). + + If neither `disabled` or `enabled` are provided, both disabled and enabled emojis will be shown. + + If no filter query string is provided, the default `domain:all` will be used, which will show all emojis from all domains. + + Default: "domain:all" + */ + Filter *string + + /* Limit. + + Number of emojis to return. Less than 1, or not set, means unlimited (all emojis). + + Default: 50 + */ + Limit *int64 + + /* MaxShortcodeDomain. + + Return only emojis with `[shortcode]@[domain]` *LOWER* (alphabetically) than given `[shortcode]@[domain]`. For example, if `max_shortcode_domain=beep@example.org`, then returned values might include emojis with `[shortcode]@[domain]`s like `car@example.org`, `debian@aaa.com`, `test@` (local emoji), etc. + Emoji with the given `[shortcode]@[domain]` will not be included in the result set. + */ + MaxShortcodeDomain *string + + /* MinShortcodeDomain. + + Return only emojis with `[shortcode]@[domain]` *HIGHER* (alphabetically) than given `[shortcode]@[domain]`. For example, if `max_shortcode_domain=beep@example.org`, then returned values might include emojis with `[shortcode]@[domain]`s like `arse@test.com`, `0101_binary@hackers.net`, `bee@` (local emoji), etc. + Emoji with the given `[shortcode]@[domain]` will not be included in the result set. + */ + MinShortcodeDomain *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojisGetParams) WithDefaults() *EmojisGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *EmojisGetParams) SetDefaults() { + var ( + filterDefault = string("domain:all") + + limitDefault = int64(50) + ) + + val := EmojisGetParams{ + Filter: &filterDefault, + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the emojis get params +func (o *EmojisGetParams) WithTimeout(timeout time.Duration) *EmojisGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the emojis get params +func (o *EmojisGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the emojis get params +func (o *EmojisGetParams) WithContext(ctx context.Context) *EmojisGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the emojis get params +func (o *EmojisGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the emojis get params +func (o *EmojisGetParams) WithHTTPClient(client *http.Client) *EmojisGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the emojis get params +func (o *EmojisGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilter adds the filter to the emojis get params +func (o *EmojisGetParams) WithFilter(filter *string) *EmojisGetParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the emojis get params +func (o *EmojisGetParams) SetFilter(filter *string) { + o.Filter = filter +} + +// WithLimit adds the limit to the emojis get params +func (o *EmojisGetParams) WithLimit(limit *int64) *EmojisGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the emojis get params +func (o *EmojisGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxShortcodeDomain adds the maxShortcodeDomain to the emojis get params +func (o *EmojisGetParams) WithMaxShortcodeDomain(maxShortcodeDomain *string) *EmojisGetParams { + o.SetMaxShortcodeDomain(maxShortcodeDomain) + return o +} + +// SetMaxShortcodeDomain adds the maxShortcodeDomain to the emojis get params +func (o *EmojisGetParams) SetMaxShortcodeDomain(maxShortcodeDomain *string) { + o.MaxShortcodeDomain = maxShortcodeDomain +} + +// WithMinShortcodeDomain adds the minShortcodeDomain to the emojis get params +func (o *EmojisGetParams) WithMinShortcodeDomain(minShortcodeDomain *string) *EmojisGetParams { + o.SetMinShortcodeDomain(minShortcodeDomain) + return o +} + +// SetMinShortcodeDomain adds the minShortcodeDomain to the emojis get params +func (o *EmojisGetParams) SetMinShortcodeDomain(minShortcodeDomain *string) { + o.MinShortcodeDomain = minShortcodeDomain +} + +// WriteToRequest writes these params to a swagger request +func (o *EmojisGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Filter != nil { + + // query param filter + var qrFilter string + + if o.Filter != nil { + qrFilter = *o.Filter + } + qFilter := qrFilter + if qFilter != "" { + + if err := r.SetQueryParam("filter", qFilter); err != nil { + return err + } + } + } + + 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.MaxShortcodeDomain != nil { + + // query param max_shortcode_domain + var qrMaxShortcodeDomain string + + if o.MaxShortcodeDomain != nil { + qrMaxShortcodeDomain = *o.MaxShortcodeDomain + } + qMaxShortcodeDomain := qrMaxShortcodeDomain + if qMaxShortcodeDomain != "" { + + if err := r.SetQueryParam("max_shortcode_domain", qMaxShortcodeDomain); err != nil { + return err + } + } + } + + if o.MinShortcodeDomain != nil { + + // query param min_shortcode_domain + var qrMinShortcodeDomain string + + if o.MinShortcodeDomain != nil { + qrMinShortcodeDomain = *o.MinShortcodeDomain + } + qMinShortcodeDomain := qrMinShortcodeDomain + if qMinShortcodeDomain != "" { + + if err := r.SetQueryParam("min_shortcode_domain", qMinShortcodeDomain); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/emojis_get_responses.go b/client/admin/emojis_get_responses.go new file mode 100644 index 0000000..795706d --- /dev/null +++ b/client/admin/emojis_get_responses.go @@ -0,0 +1,488 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// EmojisGetReader is a Reader for the EmojisGet structure. +type EmojisGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *EmojisGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewEmojisGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewEmojisGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewEmojisGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewEmojisGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewEmojisGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewEmojisGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewEmojisGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/custom_emojis] emojisGet", response, response.Code()) + } +} + +// NewEmojisGetOK creates a EmojisGetOK with default headers values +func NewEmojisGetOK() *EmojisGetOK { + return &EmojisGetOK{} +} + +/* +EmojisGetOK describes a response with status code 200, with default header values. + +An array of emojis, arranged alphabetically by shortcode and domain. +*/ +type EmojisGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.AdminEmoji +} + +// IsSuccess returns true when this emojis get o k response has a 2xx status code +func (o *EmojisGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this emojis get o k response has a 3xx status code +func (o *EmojisGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get o k response has a 4xx status code +func (o *EmojisGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this emojis get o k response has a 5xx status code +func (o *EmojisGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get o k response a status code equal to that given +func (o *EmojisGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the emojis get o k response +func (o *EmojisGetOK) Code() int { + return 200 +} + +func (o *EmojisGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetOK %s", 200, payload) +} + +func (o *EmojisGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetOK %s", 200, payload) +} + +func (o *EmojisGetOK) GetPayload() []*models.AdminEmoji { + return o.Payload +} + +func (o *EmojisGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewEmojisGetBadRequest creates a EmojisGetBadRequest with default headers values +func NewEmojisGetBadRequest() *EmojisGetBadRequest { + return &EmojisGetBadRequest{} +} + +/* +EmojisGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type EmojisGetBadRequest struct { +} + +// IsSuccess returns true when this emojis get bad request response has a 2xx status code +func (o *EmojisGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get bad request response has a 3xx status code +func (o *EmojisGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get bad request response has a 4xx status code +func (o *EmojisGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get bad request response has a 5xx status code +func (o *EmojisGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get bad request response a status code equal to that given +func (o *EmojisGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the emojis get bad request response +func (o *EmojisGetBadRequest) Code() int { + return 400 +} + +func (o *EmojisGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetBadRequest", 400) +} + +func (o *EmojisGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetBadRequest", 400) +} + +func (o *EmojisGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetUnauthorized creates a EmojisGetUnauthorized with default headers values +func NewEmojisGetUnauthorized() *EmojisGetUnauthorized { + return &EmojisGetUnauthorized{} +} + +/* +EmojisGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type EmojisGetUnauthorized struct { +} + +// IsSuccess returns true when this emojis get unauthorized response has a 2xx status code +func (o *EmojisGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get unauthorized response has a 3xx status code +func (o *EmojisGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get unauthorized response has a 4xx status code +func (o *EmojisGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get unauthorized response has a 5xx status code +func (o *EmojisGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get unauthorized response a status code equal to that given +func (o *EmojisGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the emojis get unauthorized response +func (o *EmojisGetUnauthorized) Code() int { + return 401 +} + +func (o *EmojisGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetUnauthorized", 401) +} + +func (o *EmojisGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetUnauthorized", 401) +} + +func (o *EmojisGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetForbidden creates a EmojisGetForbidden with default headers values +func NewEmojisGetForbidden() *EmojisGetForbidden { + return &EmojisGetForbidden{} +} + +/* +EmojisGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type EmojisGetForbidden struct { +} + +// IsSuccess returns true when this emojis get forbidden response has a 2xx status code +func (o *EmojisGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get forbidden response has a 3xx status code +func (o *EmojisGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get forbidden response has a 4xx status code +func (o *EmojisGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get forbidden response has a 5xx status code +func (o *EmojisGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get forbidden response a status code equal to that given +func (o *EmojisGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the emojis get forbidden response +func (o *EmojisGetForbidden) Code() int { + return 403 +} + +func (o *EmojisGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetForbidden", 403) +} + +func (o *EmojisGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetForbidden", 403) +} + +func (o *EmojisGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetNotFound creates a EmojisGetNotFound with default headers values +func NewEmojisGetNotFound() *EmojisGetNotFound { + return &EmojisGetNotFound{} +} + +/* +EmojisGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type EmojisGetNotFound struct { +} + +// IsSuccess returns true when this emojis get not found response has a 2xx status code +func (o *EmojisGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get not found response has a 3xx status code +func (o *EmojisGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get not found response has a 4xx status code +func (o *EmojisGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get not found response has a 5xx status code +func (o *EmojisGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get not found response a status code equal to that given +func (o *EmojisGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the emojis get not found response +func (o *EmojisGetNotFound) Code() int { + return 404 +} + +func (o *EmojisGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotFound", 404) +} + +func (o *EmojisGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotFound", 404) +} + +func (o *EmojisGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetNotAcceptable creates a EmojisGetNotAcceptable with default headers values +func NewEmojisGetNotAcceptable() *EmojisGetNotAcceptable { + return &EmojisGetNotAcceptable{} +} + +/* +EmojisGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type EmojisGetNotAcceptable struct { +} + +// IsSuccess returns true when this emojis get not acceptable response has a 2xx status code +func (o *EmojisGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get not acceptable response has a 3xx status code +func (o *EmojisGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get not acceptable response has a 4xx status code +func (o *EmojisGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this emojis get not acceptable response has a 5xx status code +func (o *EmojisGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this emojis get not acceptable response a status code equal to that given +func (o *EmojisGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the emojis get not acceptable response +func (o *EmojisGetNotAcceptable) Code() int { + return 406 +} + +func (o *EmojisGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotAcceptable", 406) +} + +func (o *EmojisGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetNotAcceptable", 406) +} + +func (o *EmojisGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewEmojisGetInternalServerError creates a EmojisGetInternalServerError with default headers values +func NewEmojisGetInternalServerError() *EmojisGetInternalServerError { + return &EmojisGetInternalServerError{} +} + +/* +EmojisGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type EmojisGetInternalServerError struct { +} + +// IsSuccess returns true when this emojis get internal server error response has a 2xx status code +func (o *EmojisGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this emojis get internal server error response has a 3xx status code +func (o *EmojisGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this emojis get internal server error response has a 4xx status code +func (o *EmojisGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this emojis get internal server error response has a 5xx status code +func (o *EmojisGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this emojis get internal server error response a status code equal to that given +func (o *EmojisGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the emojis get internal server error response +func (o *EmojisGetInternalServerError) Code() int { + return 500 +} + +func (o *EmojisGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetInternalServerError", 500) +} + +func (o *EmojisGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/custom_emojis][%d] emojisGetInternalServerError", 500) +} + +func (o *EmojisGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_allow_create_parameters.go b/client/admin/header_filter_allow_create_parameters.go new file mode 100644 index 0000000..5dc5507 --- /dev/null +++ b/client/admin/header_filter_allow_create_parameters.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterAllowCreateParams creates a new HeaderFilterAllowCreateParams 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 NewHeaderFilterAllowCreateParams() *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowCreateParamsWithTimeout creates a new HeaderFilterAllowCreateParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowCreateParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowCreateParamsWithContext creates a new HeaderFilterAllowCreateParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowCreateParamsWithContext(ctx context.Context) *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowCreateParamsWithHTTPClient creates a new HeaderFilterAllowCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowCreateParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowCreateParams { + return &HeaderFilterAllowCreateParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowCreateParams contains all the parameters to send to the API endpoint + + for the header filter allow create operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowCreateParams struct { + + /* Header. + + The HTTP header to match against (e.g. User-Agent). + */ + Header string + + /* Regex. + + The header value matching regular expression. + */ + Regex string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowCreateParams) WithDefaults() *HeaderFilterAllowCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allow create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithContext(ctx context.Context) *HeaderFilterAllowCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHeader adds the header to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithHeader(header string) *HeaderFilterAllowCreateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetHeader(header string) { + o.Header = header +} + +// WithRegex adds the regex to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) WithRegex(regex string) *HeaderFilterAllowCreateParams { + o.SetRegex(regex) + return o +} + +// SetRegex adds the regex to the header filter allow create params +func (o *HeaderFilterAllowCreateParams) SetRegex(regex string) { + o.Regex = regex +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param header + frHeader := o.Header + fHeader := frHeader + if fHeader != "" { + if err := r.SetFormParam("header", fHeader); err != nil { + return err + } + } + + // form param regex + frRegex := o.Regex + fRegex := frRegex + if fRegex != "" { + if err := r.SetFormParam("regex", fRegex); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_allow_create_responses.go b/client/admin/header_filter_allow_create_responses.go new file mode 100644 index 0000000..2800a6b --- /dev/null +++ b/client/admin/header_filter_allow_create_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterAllowCreateReader is a Reader for the HeaderFilterAllowCreate structure. +type HeaderFilterAllowCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterAllowCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/header_allows] headerFilterAllowCreate", response, response.Code()) + } +} + +// NewHeaderFilterAllowCreateOK creates a HeaderFilterAllowCreateOK with default headers values +func NewHeaderFilterAllowCreateOK() *HeaderFilterAllowCreateOK { + return &HeaderFilterAllowCreateOK{} +} + +/* +HeaderFilterAllowCreateOK describes a response with status code 200, with default header values. + +The newly created "allow" header filter. +*/ +type HeaderFilterAllowCreateOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter allow create o k response has a 2xx status code +func (o *HeaderFilterAllowCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allow create o k response has a 3xx status code +func (o *HeaderFilterAllowCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create o k response has a 4xx status code +func (o *HeaderFilterAllowCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow create o k response has a 5xx status code +func (o *HeaderFilterAllowCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create o k response a status code equal to that given +func (o *HeaderFilterAllowCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter allow create o k response +func (o *HeaderFilterAllowCreateOK) Code() int { + return 200 +} + +func (o *HeaderFilterAllowCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateOK %s", 200, payload) +} + +func (o *HeaderFilterAllowCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateOK %s", 200, payload) +} + +func (o *HeaderFilterAllowCreateOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterAllowCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterAllowCreateBadRequest creates a HeaderFilterAllowCreateBadRequest with default headers values +func NewHeaderFilterAllowCreateBadRequest() *HeaderFilterAllowCreateBadRequest { + return &HeaderFilterAllowCreateBadRequest{} +} + +/* +HeaderFilterAllowCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowCreateBadRequest struct { +} + +// IsSuccess returns true when this header filter allow create bad request response has a 2xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create bad request response has a 3xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create bad request response has a 4xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow create bad request response has a 5xx status code +func (o *HeaderFilterAllowCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create bad request response a status code equal to that given +func (o *HeaderFilterAllowCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allow create bad request response +func (o *HeaderFilterAllowCreateBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateBadRequest", 400) +} + +func (o *HeaderFilterAllowCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateBadRequest", 400) +} + +func (o *HeaderFilterAllowCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowCreateUnauthorized creates a HeaderFilterAllowCreateUnauthorized with default headers values +func NewHeaderFilterAllowCreateUnauthorized() *HeaderFilterAllowCreateUnauthorized { + return &HeaderFilterAllowCreateUnauthorized{} +} + +/* +HeaderFilterAllowCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowCreateUnauthorized struct { +} + +// IsSuccess returns true when this header filter allow create unauthorized response has a 2xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create unauthorized response has a 3xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create unauthorized response has a 4xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow create unauthorized response has a 5xx status code +func (o *HeaderFilterAllowCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create unauthorized response a status code equal to that given +func (o *HeaderFilterAllowCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allow create unauthorized response +func (o *HeaderFilterAllowCreateUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateUnauthorized", 401) +} + +func (o *HeaderFilterAllowCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateUnauthorized", 401) +} + +func (o *HeaderFilterAllowCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowCreateForbidden creates a HeaderFilterAllowCreateForbidden with default headers values +func NewHeaderFilterAllowCreateForbidden() *HeaderFilterAllowCreateForbidden { + return &HeaderFilterAllowCreateForbidden{} +} + +/* +HeaderFilterAllowCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowCreateForbidden struct { +} + +// IsSuccess returns true when this header filter allow create forbidden response has a 2xx status code +func (o *HeaderFilterAllowCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create forbidden response has a 3xx status code +func (o *HeaderFilterAllowCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create forbidden response has a 4xx status code +func (o *HeaderFilterAllowCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow create forbidden response has a 5xx status code +func (o *HeaderFilterAllowCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow create forbidden response a status code equal to that given +func (o *HeaderFilterAllowCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allow create forbidden response +func (o *HeaderFilterAllowCreateForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateForbidden", 403) +} + +func (o *HeaderFilterAllowCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateForbidden", 403) +} + +func (o *HeaderFilterAllowCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowCreateInternalServerError creates a HeaderFilterAllowCreateInternalServerError with default headers values +func NewHeaderFilterAllowCreateInternalServerError() *HeaderFilterAllowCreateInternalServerError { + return &HeaderFilterAllowCreateInternalServerError{} +} + +/* +HeaderFilterAllowCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowCreateInternalServerError struct { +} + +// IsSuccess returns true when this header filter allow create internal server error response has a 2xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow create internal server error response has a 3xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow create internal server error response has a 4xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow create internal server error response has a 5xx status code +func (o *HeaderFilterAllowCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allow create internal server error response a status code equal to that given +func (o *HeaderFilterAllowCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allow create internal server error response +func (o *HeaderFilterAllowCreateInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateInternalServerError", 500) +} + +func (o *HeaderFilterAllowCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_allows][%d] headerFilterAllowCreateInternalServerError", 500) +} + +func (o *HeaderFilterAllowCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_allow_delete_parameters.go b/client/admin/header_filter_allow_delete_parameters.go new file mode 100644 index 0000000..64437e8 --- /dev/null +++ b/client/admin/header_filter_allow_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterAllowDeleteParams creates a new HeaderFilterAllowDeleteParams 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 NewHeaderFilterAllowDeleteParams() *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowDeleteParamsWithTimeout creates a new HeaderFilterAllowDeleteParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowDeleteParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowDeleteParamsWithContext creates a new HeaderFilterAllowDeleteParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowDeleteParamsWithContext(ctx context.Context) *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowDeleteParamsWithHTTPClient creates a new HeaderFilterAllowDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowDeleteParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowDeleteParams { + return &HeaderFilterAllowDeleteParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowDeleteParams contains all the parameters to send to the API endpoint + + for the header filter allow delete operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowDeleteParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowDeleteParams) WithDefaults() *HeaderFilterAllowDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allow delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithContext(ctx context.Context) *HeaderFilterAllowDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) WithID(id string) *HeaderFilterAllowDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter allow delete params +func (o *HeaderFilterAllowDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_allow_delete_responses.go b/client/admin/header_filter_allow_delete_responses.go new file mode 100644 index 0000000..bc1d27c --- /dev/null +++ b/client/admin/header_filter_allow_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// HeaderFilterAllowDeleteReader is a Reader for the HeaderFilterAllowDelete structure. +type HeaderFilterAllowDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewHeaderFilterAllowDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterAllowDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/header_allows/{id}] headerFilterAllowDelete", response, response.Code()) + } +} + +// NewHeaderFilterAllowDeleteAccepted creates a HeaderFilterAllowDeleteAccepted with default headers values +func NewHeaderFilterAllowDeleteAccepted() *HeaderFilterAllowDeleteAccepted { + return &HeaderFilterAllowDeleteAccepted{} +} + +/* +HeaderFilterAllowDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type HeaderFilterAllowDeleteAccepted struct { +} + +// IsSuccess returns true when this header filter allow delete accepted response has a 2xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allow delete accepted response has a 3xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete accepted response has a 4xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow delete accepted response has a 5xx status code +func (o *HeaderFilterAllowDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete accepted response a status code equal to that given +func (o *HeaderFilterAllowDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the header filter allow delete accepted response +func (o *HeaderFilterAllowDeleteAccepted) Code() int { + return 202 +} + +func (o *HeaderFilterAllowDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteAccepted", 202) +} + +func (o *HeaderFilterAllowDeleteAccepted) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteAccepted", 202) +} + +func (o *HeaderFilterAllowDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteBadRequest creates a HeaderFilterAllowDeleteBadRequest with default headers values +func NewHeaderFilterAllowDeleteBadRequest() *HeaderFilterAllowDeleteBadRequest { + return &HeaderFilterAllowDeleteBadRequest{} +} + +/* +HeaderFilterAllowDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowDeleteBadRequest struct { +} + +// IsSuccess returns true when this header filter allow delete bad request response has a 2xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete bad request response has a 3xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete bad request response has a 4xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete bad request response has a 5xx status code +func (o *HeaderFilterAllowDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete bad request response a status code equal to that given +func (o *HeaderFilterAllowDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allow delete bad request response +func (o *HeaderFilterAllowDeleteBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteBadRequest", 400) +} + +func (o *HeaderFilterAllowDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteBadRequest", 400) +} + +func (o *HeaderFilterAllowDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteUnauthorized creates a HeaderFilterAllowDeleteUnauthorized with default headers values +func NewHeaderFilterAllowDeleteUnauthorized() *HeaderFilterAllowDeleteUnauthorized { + return &HeaderFilterAllowDeleteUnauthorized{} +} + +/* +HeaderFilterAllowDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowDeleteUnauthorized struct { +} + +// IsSuccess returns true when this header filter allow delete unauthorized response has a 2xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete unauthorized response has a 3xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete unauthorized response has a 4xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete unauthorized response has a 5xx status code +func (o *HeaderFilterAllowDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete unauthorized response a status code equal to that given +func (o *HeaderFilterAllowDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allow delete unauthorized response +func (o *HeaderFilterAllowDeleteUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteUnauthorized", 401) +} + +func (o *HeaderFilterAllowDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteUnauthorized", 401) +} + +func (o *HeaderFilterAllowDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteForbidden creates a HeaderFilterAllowDeleteForbidden with default headers values +func NewHeaderFilterAllowDeleteForbidden() *HeaderFilterAllowDeleteForbidden { + return &HeaderFilterAllowDeleteForbidden{} +} + +/* +HeaderFilterAllowDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowDeleteForbidden struct { +} + +// IsSuccess returns true when this header filter allow delete forbidden response has a 2xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete forbidden response has a 3xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete forbidden response has a 4xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete forbidden response has a 5xx status code +func (o *HeaderFilterAllowDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete forbidden response a status code equal to that given +func (o *HeaderFilterAllowDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allow delete forbidden response +func (o *HeaderFilterAllowDeleteForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteForbidden", 403) +} + +func (o *HeaderFilterAllowDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteForbidden", 403) +} + +func (o *HeaderFilterAllowDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteNotFound creates a HeaderFilterAllowDeleteNotFound with default headers values +func NewHeaderFilterAllowDeleteNotFound() *HeaderFilterAllowDeleteNotFound { + return &HeaderFilterAllowDeleteNotFound{} +} + +/* +HeaderFilterAllowDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterAllowDeleteNotFound struct { +} + +// IsSuccess returns true when this header filter allow delete not found response has a 2xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete not found response has a 3xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete not found response has a 4xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow delete not found response has a 5xx status code +func (o *HeaderFilterAllowDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow delete not found response a status code equal to that given +func (o *HeaderFilterAllowDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter allow delete not found response +func (o *HeaderFilterAllowDeleteNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterAllowDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteNotFound", 404) +} + +func (o *HeaderFilterAllowDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteNotFound", 404) +} + +func (o *HeaderFilterAllowDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowDeleteInternalServerError creates a HeaderFilterAllowDeleteInternalServerError with default headers values +func NewHeaderFilterAllowDeleteInternalServerError() *HeaderFilterAllowDeleteInternalServerError { + return &HeaderFilterAllowDeleteInternalServerError{} +} + +/* +HeaderFilterAllowDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowDeleteInternalServerError struct { +} + +// IsSuccess returns true when this header filter allow delete internal server error response has a 2xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow delete internal server error response has a 3xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow delete internal server error response has a 4xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow delete internal server error response has a 5xx status code +func (o *HeaderFilterAllowDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allow delete internal server error response a status code equal to that given +func (o *HeaderFilterAllowDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allow delete internal server error response +func (o *HeaderFilterAllowDeleteInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteInternalServerError", 500) +} + +func (o *HeaderFilterAllowDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_allows/{id}][%d] headerFilterAllowDeleteInternalServerError", 500) +} + +func (o *HeaderFilterAllowDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_allow_get_parameters.go b/client/admin/header_filter_allow_get_parameters.go new file mode 100644 index 0000000..ad4f975 --- /dev/null +++ b/client/admin/header_filter_allow_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterAllowGetParams creates a new HeaderFilterAllowGetParams 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 NewHeaderFilterAllowGetParams() *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowGetParamsWithTimeout creates a new HeaderFilterAllowGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowGetParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowGetParamsWithContext creates a new HeaderFilterAllowGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowGetParamsWithContext(ctx context.Context) *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowGetParamsWithHTTPClient creates a new HeaderFilterAllowGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowGetParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowGetParams { + return &HeaderFilterAllowGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowGetParams contains all the parameters to send to the API endpoint + + for the header filter allow get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowGetParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowGetParams) WithDefaults() *HeaderFilterAllowGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allow get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithContext(ctx context.Context) *HeaderFilterAllowGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter allow get params +func (o *HeaderFilterAllowGetParams) WithID(id string) *HeaderFilterAllowGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter allow get params +func (o *HeaderFilterAllowGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_allow_get_responses.go b/client/admin/header_filter_allow_get_responses.go new file mode 100644 index 0000000..1372012 --- /dev/null +++ b/client/admin/header_filter_allow_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterAllowGetReader is a Reader for the HeaderFilterAllowGet structure. +type HeaderFilterAllowGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterAllowGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterAllowGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_allows/{id}] headerFilterAllowGet", response, response.Code()) + } +} + +// NewHeaderFilterAllowGetOK creates a HeaderFilterAllowGetOK with default headers values +func NewHeaderFilterAllowGetOK() *HeaderFilterAllowGetOK { + return &HeaderFilterAllowGetOK{} +} + +/* +HeaderFilterAllowGetOK describes a response with status code 200, with default header values. + +The requested "allow" header filter. +*/ +type HeaderFilterAllowGetOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter allow get o k response has a 2xx status code +func (o *HeaderFilterAllowGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allow get o k response has a 3xx status code +func (o *HeaderFilterAllowGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get o k response has a 4xx status code +func (o *HeaderFilterAllowGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow get o k response has a 5xx status code +func (o *HeaderFilterAllowGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get o k response a status code equal to that given +func (o *HeaderFilterAllowGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter allow get o k response +func (o *HeaderFilterAllowGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterAllowGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowGetOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterAllowGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterAllowGetBadRequest creates a HeaderFilterAllowGetBadRequest with default headers values +func NewHeaderFilterAllowGetBadRequest() *HeaderFilterAllowGetBadRequest { + return &HeaderFilterAllowGetBadRequest{} +} + +/* +HeaderFilterAllowGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowGetBadRequest struct { +} + +// IsSuccess returns true when this header filter allow get bad request response has a 2xx status code +func (o *HeaderFilterAllowGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get bad request response has a 3xx status code +func (o *HeaderFilterAllowGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get bad request response has a 4xx status code +func (o *HeaderFilterAllowGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get bad request response has a 5xx status code +func (o *HeaderFilterAllowGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get bad request response a status code equal to that given +func (o *HeaderFilterAllowGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allow get bad request response +func (o *HeaderFilterAllowGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetBadRequest", 400) +} + +func (o *HeaderFilterAllowGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetBadRequest", 400) +} + +func (o *HeaderFilterAllowGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetUnauthorized creates a HeaderFilterAllowGetUnauthorized with default headers values +func NewHeaderFilterAllowGetUnauthorized() *HeaderFilterAllowGetUnauthorized { + return &HeaderFilterAllowGetUnauthorized{} +} + +/* +HeaderFilterAllowGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter allow get unauthorized response has a 2xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get unauthorized response has a 3xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get unauthorized response has a 4xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get unauthorized response has a 5xx status code +func (o *HeaderFilterAllowGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get unauthorized response a status code equal to that given +func (o *HeaderFilterAllowGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allow get unauthorized response +func (o *HeaderFilterAllowGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetForbidden creates a HeaderFilterAllowGetForbidden with default headers values +func NewHeaderFilterAllowGetForbidden() *HeaderFilterAllowGetForbidden { + return &HeaderFilterAllowGetForbidden{} +} + +/* +HeaderFilterAllowGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowGetForbidden struct { +} + +// IsSuccess returns true when this header filter allow get forbidden response has a 2xx status code +func (o *HeaderFilterAllowGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get forbidden response has a 3xx status code +func (o *HeaderFilterAllowGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get forbidden response has a 4xx status code +func (o *HeaderFilterAllowGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get forbidden response has a 5xx status code +func (o *HeaderFilterAllowGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get forbidden response a status code equal to that given +func (o *HeaderFilterAllowGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allow get forbidden response +func (o *HeaderFilterAllowGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetForbidden", 403) +} + +func (o *HeaderFilterAllowGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetForbidden", 403) +} + +func (o *HeaderFilterAllowGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetNotFound creates a HeaderFilterAllowGetNotFound with default headers values +func NewHeaderFilterAllowGetNotFound() *HeaderFilterAllowGetNotFound { + return &HeaderFilterAllowGetNotFound{} +} + +/* +HeaderFilterAllowGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterAllowGetNotFound struct { +} + +// IsSuccess returns true when this header filter allow get not found response has a 2xx status code +func (o *HeaderFilterAllowGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get not found response has a 3xx status code +func (o *HeaderFilterAllowGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get not found response has a 4xx status code +func (o *HeaderFilterAllowGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allow get not found response has a 5xx status code +func (o *HeaderFilterAllowGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allow get not found response a status code equal to that given +func (o *HeaderFilterAllowGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter allow get not found response +func (o *HeaderFilterAllowGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterAllowGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetNotFound", 404) +} + +func (o *HeaderFilterAllowGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetNotFound", 404) +} + +func (o *HeaderFilterAllowGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowGetInternalServerError creates a HeaderFilterAllowGetInternalServerError with default headers values +func NewHeaderFilterAllowGetInternalServerError() *HeaderFilterAllowGetInternalServerError { + return &HeaderFilterAllowGetInternalServerError{} +} + +/* +HeaderFilterAllowGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter allow get internal server error response has a 2xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allow get internal server error response has a 3xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allow get internal server error response has a 4xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allow get internal server error response has a 5xx status code +func (o *HeaderFilterAllowGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allow get internal server error response a status code equal to that given +func (o *HeaderFilterAllowGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allow get internal server error response +func (o *HeaderFilterAllowGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows/{id}][%d] headerFilterAllowGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_allows_get_parameters.go b/client/admin/header_filter_allows_get_parameters.go new file mode 100644 index 0000000..d7f55be --- /dev/null +++ b/client/admin/header_filter_allows_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterAllowsGetParams creates a new HeaderFilterAllowsGetParams 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 NewHeaderFilterAllowsGetParams() *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterAllowsGetParamsWithTimeout creates a new HeaderFilterAllowsGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterAllowsGetParamsWithTimeout(timeout time.Duration) *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterAllowsGetParamsWithContext creates a new HeaderFilterAllowsGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterAllowsGetParamsWithContext(ctx context.Context) *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterAllowsGetParamsWithHTTPClient creates a new HeaderFilterAllowsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterAllowsGetParamsWithHTTPClient(client *http.Client) *HeaderFilterAllowsGetParams { + return &HeaderFilterAllowsGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterAllowsGetParams contains all the parameters to send to the API endpoint + + for the header filter allows get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterAllowsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowsGetParams) WithDefaults() *HeaderFilterAllowsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter allows get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterAllowsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) WithTimeout(timeout time.Duration) *HeaderFilterAllowsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) WithContext(ctx context.Context) *HeaderFilterAllowsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) WithHTTPClient(client *http.Client) *HeaderFilterAllowsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter allows get params +func (o *HeaderFilterAllowsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterAllowsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_allows_get_responses.go b/client/admin/header_filter_allows_get_responses.go new file mode 100644 index 0000000..425213c --- /dev/null +++ b/client/admin/header_filter_allows_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterAllowsGetReader is a Reader for the HeaderFilterAllowsGet structure. +type HeaderFilterAllowsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterAllowsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterAllowsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterAllowsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterAllowsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterAllowsGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterAllowsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterAllowsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_allows] headerFilterAllowsGet", response, response.Code()) + } +} + +// NewHeaderFilterAllowsGetOK creates a HeaderFilterAllowsGetOK with default headers values +func NewHeaderFilterAllowsGetOK() *HeaderFilterAllowsGetOK { + return &HeaderFilterAllowsGetOK{} +} + +/* +HeaderFilterAllowsGetOK describes a response with status code 200, with default header values. + +All "allow" header filters currently in place. +*/ +type HeaderFilterAllowsGetOK struct { + Payload []*models.HeaderFilter +} + +// IsSuccess returns true when this header filter allows get o k response has a 2xx status code +func (o *HeaderFilterAllowsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter allows get o k response has a 3xx status code +func (o *HeaderFilterAllowsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get o k response has a 4xx status code +func (o *HeaderFilterAllowsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allows get o k response has a 5xx status code +func (o *HeaderFilterAllowsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get o k response a status code equal to that given +func (o *HeaderFilterAllowsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter allows get o k response +func (o *HeaderFilterAllowsGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterAllowsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetOK %s", 200, payload) +} + +func (o *HeaderFilterAllowsGetOK) GetPayload() []*models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterAllowsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterAllowsGetBadRequest creates a HeaderFilterAllowsGetBadRequest with default headers values +func NewHeaderFilterAllowsGetBadRequest() *HeaderFilterAllowsGetBadRequest { + return &HeaderFilterAllowsGetBadRequest{} +} + +/* +HeaderFilterAllowsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterAllowsGetBadRequest struct { +} + +// IsSuccess returns true when this header filter allows get bad request response has a 2xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get bad request response has a 3xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get bad request response has a 4xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get bad request response has a 5xx status code +func (o *HeaderFilterAllowsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get bad request response a status code equal to that given +func (o *HeaderFilterAllowsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter allows get bad request response +func (o *HeaderFilterAllowsGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterAllowsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetBadRequest", 400) +} + +func (o *HeaderFilterAllowsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetBadRequest", 400) +} + +func (o *HeaderFilterAllowsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetUnauthorized creates a HeaderFilterAllowsGetUnauthorized with default headers values +func NewHeaderFilterAllowsGetUnauthorized() *HeaderFilterAllowsGetUnauthorized { + return &HeaderFilterAllowsGetUnauthorized{} +} + +/* +HeaderFilterAllowsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterAllowsGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter allows get unauthorized response has a 2xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get unauthorized response has a 3xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get unauthorized response has a 4xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get unauthorized response has a 5xx status code +func (o *HeaderFilterAllowsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get unauthorized response a status code equal to that given +func (o *HeaderFilterAllowsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter allows get unauthorized response +func (o *HeaderFilterAllowsGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterAllowsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetUnauthorized", 401) +} + +func (o *HeaderFilterAllowsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetForbidden creates a HeaderFilterAllowsGetForbidden with default headers values +func NewHeaderFilterAllowsGetForbidden() *HeaderFilterAllowsGetForbidden { + return &HeaderFilterAllowsGetForbidden{} +} + +/* +HeaderFilterAllowsGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterAllowsGetForbidden struct { +} + +// IsSuccess returns true when this header filter allows get forbidden response has a 2xx status code +func (o *HeaderFilterAllowsGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get forbidden response has a 3xx status code +func (o *HeaderFilterAllowsGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get forbidden response has a 4xx status code +func (o *HeaderFilterAllowsGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get forbidden response has a 5xx status code +func (o *HeaderFilterAllowsGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get forbidden response a status code equal to that given +func (o *HeaderFilterAllowsGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter allows get forbidden response +func (o *HeaderFilterAllowsGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterAllowsGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetForbidden", 403) +} + +func (o *HeaderFilterAllowsGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetForbidden", 403) +} + +func (o *HeaderFilterAllowsGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetNotFound creates a HeaderFilterAllowsGetNotFound with default headers values +func NewHeaderFilterAllowsGetNotFound() *HeaderFilterAllowsGetNotFound { + return &HeaderFilterAllowsGetNotFound{} +} + +/* +HeaderFilterAllowsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterAllowsGetNotFound struct { +} + +// IsSuccess returns true when this header filter allows get not found response has a 2xx status code +func (o *HeaderFilterAllowsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get not found response has a 3xx status code +func (o *HeaderFilterAllowsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get not found response has a 4xx status code +func (o *HeaderFilterAllowsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter allows get not found response has a 5xx status code +func (o *HeaderFilterAllowsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter allows get not found response a status code equal to that given +func (o *HeaderFilterAllowsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter allows get not found response +func (o *HeaderFilterAllowsGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterAllowsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetNotFound", 404) +} + +func (o *HeaderFilterAllowsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetNotFound", 404) +} + +func (o *HeaderFilterAllowsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterAllowsGetInternalServerError creates a HeaderFilterAllowsGetInternalServerError with default headers values +func NewHeaderFilterAllowsGetInternalServerError() *HeaderFilterAllowsGetInternalServerError { + return &HeaderFilterAllowsGetInternalServerError{} +} + +/* +HeaderFilterAllowsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterAllowsGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter allows get internal server error response has a 2xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter allows get internal server error response has a 3xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter allows get internal server error response has a 4xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter allows get internal server error response has a 5xx status code +func (o *HeaderFilterAllowsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter allows get internal server error response a status code equal to that given +func (o *HeaderFilterAllowsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter allows get internal server error response +func (o *HeaderFilterAllowsGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterAllowsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_allows][%d] headerFilterAllowsGetInternalServerError", 500) +} + +func (o *HeaderFilterAllowsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_block_create_parameters.go b/client/admin/header_filter_block_create_parameters.go new file mode 100644 index 0000000..50f2edc --- /dev/null +++ b/client/admin/header_filter_block_create_parameters.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterBlockCreateParams creates a new HeaderFilterBlockCreateParams 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 NewHeaderFilterBlockCreateParams() *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlockCreateParamsWithTimeout creates a new HeaderFilterBlockCreateParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlockCreateParamsWithTimeout(timeout time.Duration) *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlockCreateParamsWithContext creates a new HeaderFilterBlockCreateParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlockCreateParamsWithContext(ctx context.Context) *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlockCreateParamsWithHTTPClient creates a new HeaderFilterBlockCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlockCreateParamsWithHTTPClient(client *http.Client) *HeaderFilterBlockCreateParams { + return &HeaderFilterBlockCreateParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlockCreateParams contains all the parameters to send to the API endpoint + + for the header filter block create operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlockCreateParams struct { + + /* Header. + + The HTTP header to match against (e.g. User-Agent). + */ + Header string + + /* Regex. + + The header value matching regular expression. + */ + Regex string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockCreateParams) WithDefaults() *HeaderFilterBlockCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter block create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithTimeout(timeout time.Duration) *HeaderFilterBlockCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithContext(ctx context.Context) *HeaderFilterBlockCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithHTTPClient(client *http.Client) *HeaderFilterBlockCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHeader adds the header to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithHeader(header string) *HeaderFilterBlockCreateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetHeader(header string) { + o.Header = header +} + +// WithRegex adds the regex to the header filter block create params +func (o *HeaderFilterBlockCreateParams) WithRegex(regex string) *HeaderFilterBlockCreateParams { + o.SetRegex(regex) + return o +} + +// SetRegex adds the regex to the header filter block create params +func (o *HeaderFilterBlockCreateParams) SetRegex(regex string) { + o.Regex = regex +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlockCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param header + frHeader := o.Header + fHeader := frHeader + if fHeader != "" { + if err := r.SetFormParam("header", fHeader); err != nil { + return err + } + } + + // form param regex + frRegex := o.Regex + fRegex := frRegex + if fRegex != "" { + if err := r.SetFormParam("regex", fRegex); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_block_create_responses.go b/client/admin/header_filter_block_create_responses.go new file mode 100644 index 0000000..670f230 --- /dev/null +++ b/client/admin/header_filter_block_create_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterBlockCreateReader is a Reader for the HeaderFilterBlockCreate structure. +type HeaderFilterBlockCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlockCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterBlockCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlockCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlockCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlockCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlockCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/header_blocks] headerFilterBlockCreate", response, response.Code()) + } +} + +// NewHeaderFilterBlockCreateOK creates a HeaderFilterBlockCreateOK with default headers values +func NewHeaderFilterBlockCreateOK() *HeaderFilterBlockCreateOK { + return &HeaderFilterBlockCreateOK{} +} + +/* +HeaderFilterBlockCreateOK describes a response with status code 200, with default header values. + +The newly created "block" header filter. +*/ +type HeaderFilterBlockCreateOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter block create o k response has a 2xx status code +func (o *HeaderFilterBlockCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter block create o k response has a 3xx status code +func (o *HeaderFilterBlockCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create o k response has a 4xx status code +func (o *HeaderFilterBlockCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block create o k response has a 5xx status code +func (o *HeaderFilterBlockCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create o k response a status code equal to that given +func (o *HeaderFilterBlockCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter block create o k response +func (o *HeaderFilterBlockCreateOK) Code() int { + return 200 +} + +func (o *HeaderFilterBlockCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateOK %s", 200, payload) +} + +func (o *HeaderFilterBlockCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateOK %s", 200, payload) +} + +func (o *HeaderFilterBlockCreateOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterBlockCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterBlockCreateBadRequest creates a HeaderFilterBlockCreateBadRequest with default headers values +func NewHeaderFilterBlockCreateBadRequest() *HeaderFilterBlockCreateBadRequest { + return &HeaderFilterBlockCreateBadRequest{} +} + +/* +HeaderFilterBlockCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlockCreateBadRequest struct { +} + +// IsSuccess returns true when this header filter block create bad request response has a 2xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create bad request response has a 3xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create bad request response has a 4xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block create bad request response has a 5xx status code +func (o *HeaderFilterBlockCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create bad request response a status code equal to that given +func (o *HeaderFilterBlockCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter block create bad request response +func (o *HeaderFilterBlockCreateBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlockCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateBadRequest", 400) +} + +func (o *HeaderFilterBlockCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateBadRequest", 400) +} + +func (o *HeaderFilterBlockCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockCreateUnauthorized creates a HeaderFilterBlockCreateUnauthorized with default headers values +func NewHeaderFilterBlockCreateUnauthorized() *HeaderFilterBlockCreateUnauthorized { + return &HeaderFilterBlockCreateUnauthorized{} +} + +/* +HeaderFilterBlockCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlockCreateUnauthorized struct { +} + +// IsSuccess returns true when this header filter block create unauthorized response has a 2xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create unauthorized response has a 3xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create unauthorized response has a 4xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block create unauthorized response has a 5xx status code +func (o *HeaderFilterBlockCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create unauthorized response a status code equal to that given +func (o *HeaderFilterBlockCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter block create unauthorized response +func (o *HeaderFilterBlockCreateUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlockCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateUnauthorized", 401) +} + +func (o *HeaderFilterBlockCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateUnauthorized", 401) +} + +func (o *HeaderFilterBlockCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockCreateForbidden creates a HeaderFilterBlockCreateForbidden with default headers values +func NewHeaderFilterBlockCreateForbidden() *HeaderFilterBlockCreateForbidden { + return &HeaderFilterBlockCreateForbidden{} +} + +/* +HeaderFilterBlockCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlockCreateForbidden struct { +} + +// IsSuccess returns true when this header filter block create forbidden response has a 2xx status code +func (o *HeaderFilterBlockCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create forbidden response has a 3xx status code +func (o *HeaderFilterBlockCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create forbidden response has a 4xx status code +func (o *HeaderFilterBlockCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block create forbidden response has a 5xx status code +func (o *HeaderFilterBlockCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block create forbidden response a status code equal to that given +func (o *HeaderFilterBlockCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter block create forbidden response +func (o *HeaderFilterBlockCreateForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlockCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateForbidden", 403) +} + +func (o *HeaderFilterBlockCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateForbidden", 403) +} + +func (o *HeaderFilterBlockCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockCreateInternalServerError creates a HeaderFilterBlockCreateInternalServerError with default headers values +func NewHeaderFilterBlockCreateInternalServerError() *HeaderFilterBlockCreateInternalServerError { + return &HeaderFilterBlockCreateInternalServerError{} +} + +/* +HeaderFilterBlockCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlockCreateInternalServerError struct { +} + +// IsSuccess returns true when this header filter block create internal server error response has a 2xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block create internal server error response has a 3xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block create internal server error response has a 4xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block create internal server error response has a 5xx status code +func (o *HeaderFilterBlockCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter block create internal server error response a status code equal to that given +func (o *HeaderFilterBlockCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter block create internal server error response +func (o *HeaderFilterBlockCreateInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlockCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateInternalServerError", 500) +} + +func (o *HeaderFilterBlockCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/header_blocks][%d] headerFilterBlockCreateInternalServerError", 500) +} + +func (o *HeaderFilterBlockCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_block_delete_parameters.go b/client/admin/header_filter_block_delete_parameters.go new file mode 100644 index 0000000..7b22913 --- /dev/null +++ b/client/admin/header_filter_block_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterBlockDeleteParams creates a new HeaderFilterBlockDeleteParams 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 NewHeaderFilterBlockDeleteParams() *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlockDeleteParamsWithTimeout creates a new HeaderFilterBlockDeleteParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlockDeleteParamsWithTimeout(timeout time.Duration) *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlockDeleteParamsWithContext creates a new HeaderFilterBlockDeleteParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlockDeleteParamsWithContext(ctx context.Context) *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlockDeleteParamsWithHTTPClient creates a new HeaderFilterBlockDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlockDeleteParamsWithHTTPClient(client *http.Client) *HeaderFilterBlockDeleteParams { + return &HeaderFilterBlockDeleteParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlockDeleteParams contains all the parameters to send to the API endpoint + + for the header filter block delete operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlockDeleteParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockDeleteParams) WithDefaults() *HeaderFilterBlockDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter block delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithTimeout(timeout time.Duration) *HeaderFilterBlockDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithContext(ctx context.Context) *HeaderFilterBlockDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithHTTPClient(client *http.Client) *HeaderFilterBlockDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) WithID(id string) *HeaderFilterBlockDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter block delete params +func (o *HeaderFilterBlockDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlockDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_block_delete_responses.go b/client/admin/header_filter_block_delete_responses.go new file mode 100644 index 0000000..fe533f9 --- /dev/null +++ b/client/admin/header_filter_block_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// HeaderFilterBlockDeleteReader is a Reader for the HeaderFilterBlockDelete structure. +type HeaderFilterBlockDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlockDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewHeaderFilterBlockDeleteAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlockDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlockDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlockDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterBlockDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlockDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/header_blocks/{id}] headerFilterBlockDelete", response, response.Code()) + } +} + +// NewHeaderFilterBlockDeleteAccepted creates a HeaderFilterBlockDeleteAccepted with default headers values +func NewHeaderFilterBlockDeleteAccepted() *HeaderFilterBlockDeleteAccepted { + return &HeaderFilterBlockDeleteAccepted{} +} + +/* +HeaderFilterBlockDeleteAccepted describes a response with status code 202, with default header values. + +Accepted +*/ +type HeaderFilterBlockDeleteAccepted struct { +} + +// IsSuccess returns true when this header filter block delete accepted response has a 2xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter block delete accepted response has a 3xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete accepted response has a 4xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block delete accepted response has a 5xx status code +func (o *HeaderFilterBlockDeleteAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete accepted response a status code equal to that given +func (o *HeaderFilterBlockDeleteAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the header filter block delete accepted response +func (o *HeaderFilterBlockDeleteAccepted) Code() int { + return 202 +} + +func (o *HeaderFilterBlockDeleteAccepted) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteAccepted", 202) +} + +func (o *HeaderFilterBlockDeleteAccepted) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteAccepted", 202) +} + +func (o *HeaderFilterBlockDeleteAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteBadRequest creates a HeaderFilterBlockDeleteBadRequest with default headers values +func NewHeaderFilterBlockDeleteBadRequest() *HeaderFilterBlockDeleteBadRequest { + return &HeaderFilterBlockDeleteBadRequest{} +} + +/* +HeaderFilterBlockDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlockDeleteBadRequest struct { +} + +// IsSuccess returns true when this header filter block delete bad request response has a 2xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete bad request response has a 3xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete bad request response has a 4xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete bad request response has a 5xx status code +func (o *HeaderFilterBlockDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete bad request response a status code equal to that given +func (o *HeaderFilterBlockDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter block delete bad request response +func (o *HeaderFilterBlockDeleteBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlockDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteBadRequest", 400) +} + +func (o *HeaderFilterBlockDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteBadRequest", 400) +} + +func (o *HeaderFilterBlockDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteUnauthorized creates a HeaderFilterBlockDeleteUnauthorized with default headers values +func NewHeaderFilterBlockDeleteUnauthorized() *HeaderFilterBlockDeleteUnauthorized { + return &HeaderFilterBlockDeleteUnauthorized{} +} + +/* +HeaderFilterBlockDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlockDeleteUnauthorized struct { +} + +// IsSuccess returns true when this header filter block delete unauthorized response has a 2xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete unauthorized response has a 3xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete unauthorized response has a 4xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete unauthorized response has a 5xx status code +func (o *HeaderFilterBlockDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete unauthorized response a status code equal to that given +func (o *HeaderFilterBlockDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter block delete unauthorized response +func (o *HeaderFilterBlockDeleteUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlockDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteUnauthorized", 401) +} + +func (o *HeaderFilterBlockDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteUnauthorized", 401) +} + +func (o *HeaderFilterBlockDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteForbidden creates a HeaderFilterBlockDeleteForbidden with default headers values +func NewHeaderFilterBlockDeleteForbidden() *HeaderFilterBlockDeleteForbidden { + return &HeaderFilterBlockDeleteForbidden{} +} + +/* +HeaderFilterBlockDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlockDeleteForbidden struct { +} + +// IsSuccess returns true when this header filter block delete forbidden response has a 2xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete forbidden response has a 3xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete forbidden response has a 4xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete forbidden response has a 5xx status code +func (o *HeaderFilterBlockDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete forbidden response a status code equal to that given +func (o *HeaderFilterBlockDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter block delete forbidden response +func (o *HeaderFilterBlockDeleteForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlockDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteForbidden", 403) +} + +func (o *HeaderFilterBlockDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteForbidden", 403) +} + +func (o *HeaderFilterBlockDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteNotFound creates a HeaderFilterBlockDeleteNotFound with default headers values +func NewHeaderFilterBlockDeleteNotFound() *HeaderFilterBlockDeleteNotFound { + return &HeaderFilterBlockDeleteNotFound{} +} + +/* +HeaderFilterBlockDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterBlockDeleteNotFound struct { +} + +// IsSuccess returns true when this header filter block delete not found response has a 2xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete not found response has a 3xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete not found response has a 4xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block delete not found response has a 5xx status code +func (o *HeaderFilterBlockDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block delete not found response a status code equal to that given +func (o *HeaderFilterBlockDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter block delete not found response +func (o *HeaderFilterBlockDeleteNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterBlockDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteNotFound", 404) +} + +func (o *HeaderFilterBlockDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteNotFound", 404) +} + +func (o *HeaderFilterBlockDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockDeleteInternalServerError creates a HeaderFilterBlockDeleteInternalServerError with default headers values +func NewHeaderFilterBlockDeleteInternalServerError() *HeaderFilterBlockDeleteInternalServerError { + return &HeaderFilterBlockDeleteInternalServerError{} +} + +/* +HeaderFilterBlockDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlockDeleteInternalServerError struct { +} + +// IsSuccess returns true when this header filter block delete internal server error response has a 2xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block delete internal server error response has a 3xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block delete internal server error response has a 4xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block delete internal server error response has a 5xx status code +func (o *HeaderFilterBlockDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter block delete internal server error response a status code equal to that given +func (o *HeaderFilterBlockDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter block delete internal server error response +func (o *HeaderFilterBlockDeleteInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlockDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteInternalServerError", 500) +} + +func (o *HeaderFilterBlockDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockDeleteInternalServerError", 500) +} + +func (o *HeaderFilterBlockDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_block_get_parameters.go b/client/admin/header_filter_block_get_parameters.go new file mode 100644 index 0000000..45a0b37 --- /dev/null +++ b/client/admin/header_filter_block_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterBlockGetParams creates a new HeaderFilterBlockGetParams 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 NewHeaderFilterBlockGetParams() *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlockGetParamsWithTimeout creates a new HeaderFilterBlockGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlockGetParamsWithTimeout(timeout time.Duration) *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlockGetParamsWithContext creates a new HeaderFilterBlockGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlockGetParamsWithContext(ctx context.Context) *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlockGetParamsWithHTTPClient creates a new HeaderFilterBlockGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlockGetParamsWithHTTPClient(client *http.Client) *HeaderFilterBlockGetParams { + return &HeaderFilterBlockGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlockGetParams contains all the parameters to send to the API endpoint + + for the header filter block get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlockGetParams struct { + + /* ID. + + Target header filter ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockGetParams) WithDefaults() *HeaderFilterBlockGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter block get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlockGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithTimeout(timeout time.Duration) *HeaderFilterBlockGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithContext(ctx context.Context) *HeaderFilterBlockGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithHTTPClient(client *http.Client) *HeaderFilterBlockGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the header filter block get params +func (o *HeaderFilterBlockGetParams) WithID(id string) *HeaderFilterBlockGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the header filter block get params +func (o *HeaderFilterBlockGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlockGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_block_get_responses.go b/client/admin/header_filter_block_get_responses.go new file mode 100644 index 0000000..d4ecc7d --- /dev/null +++ b/client/admin/header_filter_block_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterBlockGetReader is a Reader for the HeaderFilterBlockGet structure. +type HeaderFilterBlockGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlockGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterBlockGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlockGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlockGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlockGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterBlockGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlockGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_blocks/{id}] headerFilterBlockGet", response, response.Code()) + } +} + +// NewHeaderFilterBlockGetOK creates a HeaderFilterBlockGetOK with default headers values +func NewHeaderFilterBlockGetOK() *HeaderFilterBlockGetOK { + return &HeaderFilterBlockGetOK{} +} + +/* +HeaderFilterBlockGetOK describes a response with status code 200, with default header values. + +The requested "block" header filter. +*/ +type HeaderFilterBlockGetOK struct { + Payload *models.HeaderFilter +} + +// IsSuccess returns true when this header filter block get o k response has a 2xx status code +func (o *HeaderFilterBlockGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter block get o k response has a 3xx status code +func (o *HeaderFilterBlockGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get o k response has a 4xx status code +func (o *HeaderFilterBlockGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block get o k response has a 5xx status code +func (o *HeaderFilterBlockGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get o k response a status code equal to that given +func (o *HeaderFilterBlockGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter block get o k response +func (o *HeaderFilterBlockGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterBlockGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlockGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlockGetOK) GetPayload() *models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterBlockGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HeaderFilter) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterBlockGetBadRequest creates a HeaderFilterBlockGetBadRequest with default headers values +func NewHeaderFilterBlockGetBadRequest() *HeaderFilterBlockGetBadRequest { + return &HeaderFilterBlockGetBadRequest{} +} + +/* +HeaderFilterBlockGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlockGetBadRequest struct { +} + +// IsSuccess returns true when this header filter block get bad request response has a 2xx status code +func (o *HeaderFilterBlockGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get bad request response has a 3xx status code +func (o *HeaderFilterBlockGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get bad request response has a 4xx status code +func (o *HeaderFilterBlockGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get bad request response has a 5xx status code +func (o *HeaderFilterBlockGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get bad request response a status code equal to that given +func (o *HeaderFilterBlockGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter block get bad request response +func (o *HeaderFilterBlockGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlockGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetBadRequest", 400) +} + +func (o *HeaderFilterBlockGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetBadRequest", 400) +} + +func (o *HeaderFilterBlockGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetUnauthorized creates a HeaderFilterBlockGetUnauthorized with default headers values +func NewHeaderFilterBlockGetUnauthorized() *HeaderFilterBlockGetUnauthorized { + return &HeaderFilterBlockGetUnauthorized{} +} + +/* +HeaderFilterBlockGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlockGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter block get unauthorized response has a 2xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get unauthorized response has a 3xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get unauthorized response has a 4xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get unauthorized response has a 5xx status code +func (o *HeaderFilterBlockGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get unauthorized response a status code equal to that given +func (o *HeaderFilterBlockGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter block get unauthorized response +func (o *HeaderFilterBlockGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlockGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetUnauthorized", 401) +} + +func (o *HeaderFilterBlockGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetUnauthorized", 401) +} + +func (o *HeaderFilterBlockGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetForbidden creates a HeaderFilterBlockGetForbidden with default headers values +func NewHeaderFilterBlockGetForbidden() *HeaderFilterBlockGetForbidden { + return &HeaderFilterBlockGetForbidden{} +} + +/* +HeaderFilterBlockGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlockGetForbidden struct { +} + +// IsSuccess returns true when this header filter block get forbidden response has a 2xx status code +func (o *HeaderFilterBlockGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get forbidden response has a 3xx status code +func (o *HeaderFilterBlockGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get forbidden response has a 4xx status code +func (o *HeaderFilterBlockGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get forbidden response has a 5xx status code +func (o *HeaderFilterBlockGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get forbidden response a status code equal to that given +func (o *HeaderFilterBlockGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter block get forbidden response +func (o *HeaderFilterBlockGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlockGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetForbidden", 403) +} + +func (o *HeaderFilterBlockGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetForbidden", 403) +} + +func (o *HeaderFilterBlockGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetNotFound creates a HeaderFilterBlockGetNotFound with default headers values +func NewHeaderFilterBlockGetNotFound() *HeaderFilterBlockGetNotFound { + return &HeaderFilterBlockGetNotFound{} +} + +/* +HeaderFilterBlockGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterBlockGetNotFound struct { +} + +// IsSuccess returns true when this header filter block get not found response has a 2xx status code +func (o *HeaderFilterBlockGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get not found response has a 3xx status code +func (o *HeaderFilterBlockGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get not found response has a 4xx status code +func (o *HeaderFilterBlockGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter block get not found response has a 5xx status code +func (o *HeaderFilterBlockGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter block get not found response a status code equal to that given +func (o *HeaderFilterBlockGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter block get not found response +func (o *HeaderFilterBlockGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterBlockGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetNotFound", 404) +} + +func (o *HeaderFilterBlockGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetNotFound", 404) +} + +func (o *HeaderFilterBlockGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlockGetInternalServerError creates a HeaderFilterBlockGetInternalServerError with default headers values +func NewHeaderFilterBlockGetInternalServerError() *HeaderFilterBlockGetInternalServerError { + return &HeaderFilterBlockGetInternalServerError{} +} + +/* +HeaderFilterBlockGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlockGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter block get internal server error response has a 2xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter block get internal server error response has a 3xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter block get internal server error response has a 4xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter block get internal server error response has a 5xx status code +func (o *HeaderFilterBlockGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter block get internal server error response a status code equal to that given +func (o *HeaderFilterBlockGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter block get internal server error response +func (o *HeaderFilterBlockGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlockGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetInternalServerError", 500) +} + +func (o *HeaderFilterBlockGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks/{id}][%d] headerFilterBlockGetInternalServerError", 500) +} + +func (o *HeaderFilterBlockGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/header_filter_blocks_get_parameters.go b/client/admin/header_filter_blocks_get_parameters.go new file mode 100644 index 0000000..989801b --- /dev/null +++ b/client/admin/header_filter_blocks_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewHeaderFilterBlocksGetParams creates a new HeaderFilterBlocksGetParams 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 NewHeaderFilterBlocksGetParams() *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHeaderFilterBlocksGetParamsWithTimeout creates a new HeaderFilterBlocksGetParams object +// with the ability to set a timeout on a request. +func NewHeaderFilterBlocksGetParamsWithTimeout(timeout time.Duration) *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + timeout: timeout, + } +} + +// NewHeaderFilterBlocksGetParamsWithContext creates a new HeaderFilterBlocksGetParams object +// with the ability to set a context for a request. +func NewHeaderFilterBlocksGetParamsWithContext(ctx context.Context) *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + Context: ctx, + } +} + +// NewHeaderFilterBlocksGetParamsWithHTTPClient creates a new HeaderFilterBlocksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHeaderFilterBlocksGetParamsWithHTTPClient(client *http.Client) *HeaderFilterBlocksGetParams { + return &HeaderFilterBlocksGetParams{ + HTTPClient: client, + } +} + +/* +HeaderFilterBlocksGetParams contains all the parameters to send to the API endpoint + + for the header filter blocks get operation. + + Typically these are written to a http.Request. +*/ +type HeaderFilterBlocksGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the header filter blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlocksGetParams) WithDefaults() *HeaderFilterBlocksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the header filter blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HeaderFilterBlocksGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) WithTimeout(timeout time.Duration) *HeaderFilterBlocksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) WithContext(ctx context.Context) *HeaderFilterBlocksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) WithHTTPClient(client *http.Client) *HeaderFilterBlocksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the header filter blocks get params +func (o *HeaderFilterBlocksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HeaderFilterBlocksGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/header_filter_blocks_get_responses.go b/client/admin/header_filter_blocks_get_responses.go new file mode 100644 index 0000000..5d63ccc --- /dev/null +++ b/client/admin/header_filter_blocks_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HeaderFilterBlocksGetReader is a Reader for the HeaderFilterBlocksGet structure. +type HeaderFilterBlocksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HeaderFilterBlocksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHeaderFilterBlocksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHeaderFilterBlocksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHeaderFilterBlocksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewHeaderFilterBlocksGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewHeaderFilterBlocksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewHeaderFilterBlocksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/header_blocks] headerFilterBlocksGet", response, response.Code()) + } +} + +// NewHeaderFilterBlocksGetOK creates a HeaderFilterBlocksGetOK with default headers values +func NewHeaderFilterBlocksGetOK() *HeaderFilterBlocksGetOK { + return &HeaderFilterBlocksGetOK{} +} + +/* +HeaderFilterBlocksGetOK describes a response with status code 200, with default header values. + +All "block" header filters currently in place. +*/ +type HeaderFilterBlocksGetOK struct { + Payload []*models.HeaderFilter +} + +// IsSuccess returns true when this header filter blocks get o k response has a 2xx status code +func (o *HeaderFilterBlocksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this header filter blocks get o k response has a 3xx status code +func (o *HeaderFilterBlocksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get o k response has a 4xx status code +func (o *HeaderFilterBlocksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter blocks get o k response has a 5xx status code +func (o *HeaderFilterBlocksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get o k response a status code equal to that given +func (o *HeaderFilterBlocksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the header filter blocks get o k response +func (o *HeaderFilterBlocksGetOK) Code() int { + return 200 +} + +func (o *HeaderFilterBlocksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlocksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetOK %s", 200, payload) +} + +func (o *HeaderFilterBlocksGetOK) GetPayload() []*models.HeaderFilter { + return o.Payload +} + +func (o *HeaderFilterBlocksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHeaderFilterBlocksGetBadRequest creates a HeaderFilterBlocksGetBadRequest with default headers values +func NewHeaderFilterBlocksGetBadRequest() *HeaderFilterBlocksGetBadRequest { + return &HeaderFilterBlocksGetBadRequest{} +} + +/* +HeaderFilterBlocksGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HeaderFilterBlocksGetBadRequest struct { +} + +// IsSuccess returns true when this header filter blocks get bad request response has a 2xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get bad request response has a 3xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get bad request response has a 4xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get bad request response has a 5xx status code +func (o *HeaderFilterBlocksGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get bad request response a status code equal to that given +func (o *HeaderFilterBlocksGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the header filter blocks get bad request response +func (o *HeaderFilterBlocksGetBadRequest) Code() int { + return 400 +} + +func (o *HeaderFilterBlocksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetBadRequest", 400) +} + +func (o *HeaderFilterBlocksGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetBadRequest", 400) +} + +func (o *HeaderFilterBlocksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetUnauthorized creates a HeaderFilterBlocksGetUnauthorized with default headers values +func NewHeaderFilterBlocksGetUnauthorized() *HeaderFilterBlocksGetUnauthorized { + return &HeaderFilterBlocksGetUnauthorized{} +} + +/* +HeaderFilterBlocksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HeaderFilterBlocksGetUnauthorized struct { +} + +// IsSuccess returns true when this header filter blocks get unauthorized response has a 2xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get unauthorized response has a 3xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get unauthorized response has a 4xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get unauthorized response has a 5xx status code +func (o *HeaderFilterBlocksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get unauthorized response a status code equal to that given +func (o *HeaderFilterBlocksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the header filter blocks get unauthorized response +func (o *HeaderFilterBlocksGetUnauthorized) Code() int { + return 401 +} + +func (o *HeaderFilterBlocksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetUnauthorized", 401) +} + +func (o *HeaderFilterBlocksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetUnauthorized", 401) +} + +func (o *HeaderFilterBlocksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetForbidden creates a HeaderFilterBlocksGetForbidden with default headers values +func NewHeaderFilterBlocksGetForbidden() *HeaderFilterBlocksGetForbidden { + return &HeaderFilterBlocksGetForbidden{} +} + +/* +HeaderFilterBlocksGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type HeaderFilterBlocksGetForbidden struct { +} + +// IsSuccess returns true when this header filter blocks get forbidden response has a 2xx status code +func (o *HeaderFilterBlocksGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get forbidden response has a 3xx status code +func (o *HeaderFilterBlocksGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get forbidden response has a 4xx status code +func (o *HeaderFilterBlocksGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get forbidden response has a 5xx status code +func (o *HeaderFilterBlocksGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get forbidden response a status code equal to that given +func (o *HeaderFilterBlocksGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the header filter blocks get forbidden response +func (o *HeaderFilterBlocksGetForbidden) Code() int { + return 403 +} + +func (o *HeaderFilterBlocksGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetForbidden", 403) +} + +func (o *HeaderFilterBlocksGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetForbidden", 403) +} + +func (o *HeaderFilterBlocksGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetNotFound creates a HeaderFilterBlocksGetNotFound with default headers values +func NewHeaderFilterBlocksGetNotFound() *HeaderFilterBlocksGetNotFound { + return &HeaderFilterBlocksGetNotFound{} +} + +/* +HeaderFilterBlocksGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type HeaderFilterBlocksGetNotFound struct { +} + +// IsSuccess returns true when this header filter blocks get not found response has a 2xx status code +func (o *HeaderFilterBlocksGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get not found response has a 3xx status code +func (o *HeaderFilterBlocksGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get not found response has a 4xx status code +func (o *HeaderFilterBlocksGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this header filter blocks get not found response has a 5xx status code +func (o *HeaderFilterBlocksGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this header filter blocks get not found response a status code equal to that given +func (o *HeaderFilterBlocksGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the header filter blocks get not found response +func (o *HeaderFilterBlocksGetNotFound) Code() int { + return 404 +} + +func (o *HeaderFilterBlocksGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetNotFound", 404) +} + +func (o *HeaderFilterBlocksGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetNotFound", 404) +} + +func (o *HeaderFilterBlocksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHeaderFilterBlocksGetInternalServerError creates a HeaderFilterBlocksGetInternalServerError with default headers values +func NewHeaderFilterBlocksGetInternalServerError() *HeaderFilterBlocksGetInternalServerError { + return &HeaderFilterBlocksGetInternalServerError{} +} + +/* +HeaderFilterBlocksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type HeaderFilterBlocksGetInternalServerError struct { +} + +// IsSuccess returns true when this header filter blocks get internal server error response has a 2xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this header filter blocks get internal server error response has a 3xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this header filter blocks get internal server error response has a 4xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this header filter blocks get internal server error response has a 5xx status code +func (o *HeaderFilterBlocksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this header filter blocks get internal server error response a status code equal to that given +func (o *HeaderFilterBlocksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the header filter blocks get internal server error response +func (o *HeaderFilterBlocksGetInternalServerError) Code() int { + return 500 +} + +func (o *HeaderFilterBlocksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetInternalServerError", 500) +} + +func (o *HeaderFilterBlocksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/header_blocks][%d] headerFilterBlocksGetInternalServerError", 500) +} + +func (o *HeaderFilterBlocksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/media_cleanup_parameters.go b/client/admin/media_cleanup_parameters.go new file mode 100644 index 0000000..16b6b72 --- /dev/null +++ b/client/admin/media_cleanup_parameters.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewMediaCleanupParams creates a new MediaCleanupParams 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 NewMediaCleanupParams() *MediaCleanupParams { + return &MediaCleanupParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaCleanupParamsWithTimeout creates a new MediaCleanupParams object +// with the ability to set a timeout on a request. +func NewMediaCleanupParamsWithTimeout(timeout time.Duration) *MediaCleanupParams { + return &MediaCleanupParams{ + timeout: timeout, + } +} + +// NewMediaCleanupParamsWithContext creates a new MediaCleanupParams object +// with the ability to set a context for a request. +func NewMediaCleanupParamsWithContext(ctx context.Context) *MediaCleanupParams { + return &MediaCleanupParams{ + Context: ctx, + } +} + +// NewMediaCleanupParamsWithHTTPClient creates a new MediaCleanupParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaCleanupParamsWithHTTPClient(client *http.Client) *MediaCleanupParams { + return &MediaCleanupParams{ + HTTPClient: client, + } +} + +/* +MediaCleanupParams contains all the parameters to send to the API endpoint + + for the media cleanup operation. + + Typically these are written to a http.Request. +*/ +type MediaCleanupParams struct { + + /* RemoteCacheDays. + + Number of days of remote media to keep. Native values will be treated as 0. + If value is not specified, the value of media-remote-cache-days in the server config will be used. + + Format: int64 + */ + RemoteCacheDays *int64 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media cleanup params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCleanupParams) WithDefaults() *MediaCleanupParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media cleanup params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCleanupParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the media cleanup params +func (o *MediaCleanupParams) WithTimeout(timeout time.Duration) *MediaCleanupParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media cleanup params +func (o *MediaCleanupParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media cleanup params +func (o *MediaCleanupParams) WithContext(ctx context.Context) *MediaCleanupParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media cleanup params +func (o *MediaCleanupParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media cleanup params +func (o *MediaCleanupParams) WithHTTPClient(client *http.Client) *MediaCleanupParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media cleanup params +func (o *MediaCleanupParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithRemoteCacheDays adds the remoteCacheDays to the media cleanup params +func (o *MediaCleanupParams) WithRemoteCacheDays(remoteCacheDays *int64) *MediaCleanupParams { + o.SetRemoteCacheDays(remoteCacheDays) + return o +} + +// SetRemoteCacheDays adds the remoteCacheDays to the media cleanup params +func (o *MediaCleanupParams) SetRemoteCacheDays(remoteCacheDays *int64) { + o.RemoteCacheDays = remoteCacheDays +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaCleanupParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.RemoteCacheDays != nil { + + // query param remote_cache_days + var qrRemoteCacheDays int64 + + if o.RemoteCacheDays != nil { + qrRemoteCacheDays = *o.RemoteCacheDays + } + qRemoteCacheDays := swag.FormatInt64(qrRemoteCacheDays) + if qRemoteCacheDays != "" { + + if err := r.SetQueryParam("remote_cache_days", qRemoteCacheDays); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/media_cleanup_responses.go b/client/admin/media_cleanup_responses.go new file mode 100644 index 0000000..d2b0a24 --- /dev/null +++ b/client/admin/media_cleanup_responses.go @@ -0,0 +1,460 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// MediaCleanupReader is a Reader for the MediaCleanup structure. +type MediaCleanupReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaCleanupReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaCleanupOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaCleanupBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaCleanupUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewMediaCleanupForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaCleanupNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaCleanupNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaCleanupInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/media_cleanup] mediaCleanup", response, response.Code()) + } +} + +// NewMediaCleanupOK creates a MediaCleanupOK with default headers values +func NewMediaCleanupOK() *MediaCleanupOK { + return &MediaCleanupOK{} +} + +/* +MediaCleanupOK describes a response with status code 200, with default header values. + +Echos the number of days requested. The cleanup is performed asynchronously after the request completes. +*/ +type MediaCleanupOK struct { +} + +// IsSuccess returns true when this media cleanup o k response has a 2xx status code +func (o *MediaCleanupOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media cleanup o k response has a 3xx status code +func (o *MediaCleanupOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup o k response has a 4xx status code +func (o *MediaCleanupOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media cleanup o k response has a 5xx status code +func (o *MediaCleanupOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup o k response a status code equal to that given +func (o *MediaCleanupOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media cleanup o k response +func (o *MediaCleanupOK) Code() int { + return 200 +} + +func (o *MediaCleanupOK) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupOK", 200) +} + +func (o *MediaCleanupOK) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupOK", 200) +} + +func (o *MediaCleanupOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupBadRequest creates a MediaCleanupBadRequest with default headers values +func NewMediaCleanupBadRequest() *MediaCleanupBadRequest { + return &MediaCleanupBadRequest{} +} + +/* +MediaCleanupBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaCleanupBadRequest struct { +} + +// IsSuccess returns true when this media cleanup bad request response has a 2xx status code +func (o *MediaCleanupBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup bad request response has a 3xx status code +func (o *MediaCleanupBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup bad request response has a 4xx status code +func (o *MediaCleanupBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup bad request response has a 5xx status code +func (o *MediaCleanupBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup bad request response a status code equal to that given +func (o *MediaCleanupBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media cleanup bad request response +func (o *MediaCleanupBadRequest) Code() int { + return 400 +} + +func (o *MediaCleanupBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupBadRequest", 400) +} + +func (o *MediaCleanupBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupBadRequest", 400) +} + +func (o *MediaCleanupBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupUnauthorized creates a MediaCleanupUnauthorized with default headers values +func NewMediaCleanupUnauthorized() *MediaCleanupUnauthorized { + return &MediaCleanupUnauthorized{} +} + +/* +MediaCleanupUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaCleanupUnauthorized struct { +} + +// IsSuccess returns true when this media cleanup unauthorized response has a 2xx status code +func (o *MediaCleanupUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup unauthorized response has a 3xx status code +func (o *MediaCleanupUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup unauthorized response has a 4xx status code +func (o *MediaCleanupUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup unauthorized response has a 5xx status code +func (o *MediaCleanupUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup unauthorized response a status code equal to that given +func (o *MediaCleanupUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media cleanup unauthorized response +func (o *MediaCleanupUnauthorized) Code() int { + return 401 +} + +func (o *MediaCleanupUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupUnauthorized", 401) +} + +func (o *MediaCleanupUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupUnauthorized", 401) +} + +func (o *MediaCleanupUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupForbidden creates a MediaCleanupForbidden with default headers values +func NewMediaCleanupForbidden() *MediaCleanupForbidden { + return &MediaCleanupForbidden{} +} + +/* +MediaCleanupForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type MediaCleanupForbidden struct { +} + +// IsSuccess returns true when this media cleanup forbidden response has a 2xx status code +func (o *MediaCleanupForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup forbidden response has a 3xx status code +func (o *MediaCleanupForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup forbidden response has a 4xx status code +func (o *MediaCleanupForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup forbidden response has a 5xx status code +func (o *MediaCleanupForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup forbidden response a status code equal to that given +func (o *MediaCleanupForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the media cleanup forbidden response +func (o *MediaCleanupForbidden) Code() int { + return 403 +} + +func (o *MediaCleanupForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupForbidden", 403) +} + +func (o *MediaCleanupForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupForbidden", 403) +} + +func (o *MediaCleanupForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupNotFound creates a MediaCleanupNotFound with default headers values +func NewMediaCleanupNotFound() *MediaCleanupNotFound { + return &MediaCleanupNotFound{} +} + +/* +MediaCleanupNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaCleanupNotFound struct { +} + +// IsSuccess returns true when this media cleanup not found response has a 2xx status code +func (o *MediaCleanupNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup not found response has a 3xx status code +func (o *MediaCleanupNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup not found response has a 4xx status code +func (o *MediaCleanupNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup not found response has a 5xx status code +func (o *MediaCleanupNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup not found response a status code equal to that given +func (o *MediaCleanupNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media cleanup not found response +func (o *MediaCleanupNotFound) Code() int { + return 404 +} + +func (o *MediaCleanupNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotFound", 404) +} + +func (o *MediaCleanupNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotFound", 404) +} + +func (o *MediaCleanupNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupNotAcceptable creates a MediaCleanupNotAcceptable with default headers values +func NewMediaCleanupNotAcceptable() *MediaCleanupNotAcceptable { + return &MediaCleanupNotAcceptable{} +} + +/* +MediaCleanupNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaCleanupNotAcceptable struct { +} + +// IsSuccess returns true when this media cleanup not acceptable response has a 2xx status code +func (o *MediaCleanupNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup not acceptable response has a 3xx status code +func (o *MediaCleanupNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup not acceptable response has a 4xx status code +func (o *MediaCleanupNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media cleanup not acceptable response has a 5xx status code +func (o *MediaCleanupNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media cleanup not acceptable response a status code equal to that given +func (o *MediaCleanupNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media cleanup not acceptable response +func (o *MediaCleanupNotAcceptable) Code() int { + return 406 +} + +func (o *MediaCleanupNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotAcceptable", 406) +} + +func (o *MediaCleanupNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupNotAcceptable", 406) +} + +func (o *MediaCleanupNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCleanupInternalServerError creates a MediaCleanupInternalServerError with default headers values +func NewMediaCleanupInternalServerError() *MediaCleanupInternalServerError { + return &MediaCleanupInternalServerError{} +} + +/* +MediaCleanupInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaCleanupInternalServerError struct { +} + +// IsSuccess returns true when this media cleanup internal server error response has a 2xx status code +func (o *MediaCleanupInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media cleanup internal server error response has a 3xx status code +func (o *MediaCleanupInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media cleanup internal server error response has a 4xx status code +func (o *MediaCleanupInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media cleanup internal server error response has a 5xx status code +func (o *MediaCleanupInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media cleanup internal server error response a status code equal to that given +func (o *MediaCleanupInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media cleanup internal server error response +func (o *MediaCleanupInternalServerError) Code() int { + return 500 +} + +func (o *MediaCleanupInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupInternalServerError", 500) +} + +func (o *MediaCleanupInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_cleanup][%d] mediaCleanupInternalServerError", 500) +} + +func (o *MediaCleanupInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/media_refetch_parameters.go b/client/admin/media_refetch_parameters.go new file mode 100644 index 0000000..e706909 --- /dev/null +++ b/client/admin/media_refetch_parameters.go @@ -0,0 +1,163 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewMediaRefetchParams creates a new MediaRefetchParams 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 NewMediaRefetchParams() *MediaRefetchParams { + return &MediaRefetchParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaRefetchParamsWithTimeout creates a new MediaRefetchParams object +// with the ability to set a timeout on a request. +func NewMediaRefetchParamsWithTimeout(timeout time.Duration) *MediaRefetchParams { + return &MediaRefetchParams{ + timeout: timeout, + } +} + +// NewMediaRefetchParamsWithContext creates a new MediaRefetchParams object +// with the ability to set a context for a request. +func NewMediaRefetchParamsWithContext(ctx context.Context) *MediaRefetchParams { + return &MediaRefetchParams{ + Context: ctx, + } +} + +// NewMediaRefetchParamsWithHTTPClient creates a new MediaRefetchParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaRefetchParamsWithHTTPClient(client *http.Client) *MediaRefetchParams { + return &MediaRefetchParams{ + HTTPClient: client, + } +} + +/* +MediaRefetchParams contains all the parameters to send to the API endpoint + + for the media refetch operation. + + Typically these are written to a http.Request. +*/ +type MediaRefetchParams struct { + + /* Domain. + + Domain to refetch media from. If empty, all domains will be refetched. + */ + Domain *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media refetch params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaRefetchParams) WithDefaults() *MediaRefetchParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media refetch params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaRefetchParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the media refetch params +func (o *MediaRefetchParams) WithTimeout(timeout time.Duration) *MediaRefetchParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media refetch params +func (o *MediaRefetchParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media refetch params +func (o *MediaRefetchParams) WithContext(ctx context.Context) *MediaRefetchParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media refetch params +func (o *MediaRefetchParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media refetch params +func (o *MediaRefetchParams) WithHTTPClient(client *http.Client) *MediaRefetchParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media refetch params +func (o *MediaRefetchParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDomain adds the domain to the media refetch params +func (o *MediaRefetchParams) WithDomain(domain *string) *MediaRefetchParams { + o.SetDomain(domain) + return o +} + +// SetDomain adds the domain to the media refetch params +func (o *MediaRefetchParams) SetDomain(domain *string) { + o.Domain = domain +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaRefetchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Domain != nil { + + // query param domain + var qrDomain string + + if o.Domain != nil { + qrDomain = *o.Domain + } + qDomain := qrDomain + if qDomain != "" { + + if err := r.SetQueryParam("domain", qDomain); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/media_refetch_responses.go b/client/admin/media_refetch_responses.go new file mode 100644 index 0000000..993ffd2 --- /dev/null +++ b/client/admin/media_refetch_responses.go @@ -0,0 +1,460 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// MediaRefetchReader is a Reader for the MediaRefetch structure. +type MediaRefetchReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaRefetchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewMediaRefetchAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaRefetchBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaRefetchUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewMediaRefetchForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaRefetchNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaRefetchNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaRefetchInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/media_refetch] mediaRefetch", response, response.Code()) + } +} + +// NewMediaRefetchAccepted creates a MediaRefetchAccepted with default headers values +func NewMediaRefetchAccepted() *MediaRefetchAccepted { + return &MediaRefetchAccepted{} +} + +/* +MediaRefetchAccepted describes a response with status code 202, with default header values. + +Request accepted and will be processed. Check the logs for progress / errors. +*/ +type MediaRefetchAccepted struct { +} + +// IsSuccess returns true when this media refetch accepted response has a 2xx status code +func (o *MediaRefetchAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media refetch accepted response has a 3xx status code +func (o *MediaRefetchAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch accepted response has a 4xx status code +func (o *MediaRefetchAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this media refetch accepted response has a 5xx status code +func (o *MediaRefetchAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch accepted response a status code equal to that given +func (o *MediaRefetchAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the media refetch accepted response +func (o *MediaRefetchAccepted) Code() int { + return 202 +} + +func (o *MediaRefetchAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchAccepted", 202) +} + +func (o *MediaRefetchAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchAccepted", 202) +} + +func (o *MediaRefetchAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchBadRequest creates a MediaRefetchBadRequest with default headers values +func NewMediaRefetchBadRequest() *MediaRefetchBadRequest { + return &MediaRefetchBadRequest{} +} + +/* +MediaRefetchBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaRefetchBadRequest struct { +} + +// IsSuccess returns true when this media refetch bad request response has a 2xx status code +func (o *MediaRefetchBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch bad request response has a 3xx status code +func (o *MediaRefetchBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch bad request response has a 4xx status code +func (o *MediaRefetchBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch bad request response has a 5xx status code +func (o *MediaRefetchBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch bad request response a status code equal to that given +func (o *MediaRefetchBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media refetch bad request response +func (o *MediaRefetchBadRequest) Code() int { + return 400 +} + +func (o *MediaRefetchBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchBadRequest", 400) +} + +func (o *MediaRefetchBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchBadRequest", 400) +} + +func (o *MediaRefetchBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchUnauthorized creates a MediaRefetchUnauthorized with default headers values +func NewMediaRefetchUnauthorized() *MediaRefetchUnauthorized { + return &MediaRefetchUnauthorized{} +} + +/* +MediaRefetchUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaRefetchUnauthorized struct { +} + +// IsSuccess returns true when this media refetch unauthorized response has a 2xx status code +func (o *MediaRefetchUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch unauthorized response has a 3xx status code +func (o *MediaRefetchUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch unauthorized response has a 4xx status code +func (o *MediaRefetchUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch unauthorized response has a 5xx status code +func (o *MediaRefetchUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch unauthorized response a status code equal to that given +func (o *MediaRefetchUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media refetch unauthorized response +func (o *MediaRefetchUnauthorized) Code() int { + return 401 +} + +func (o *MediaRefetchUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchUnauthorized", 401) +} + +func (o *MediaRefetchUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchUnauthorized", 401) +} + +func (o *MediaRefetchUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchForbidden creates a MediaRefetchForbidden with default headers values +func NewMediaRefetchForbidden() *MediaRefetchForbidden { + return &MediaRefetchForbidden{} +} + +/* +MediaRefetchForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type MediaRefetchForbidden struct { +} + +// IsSuccess returns true when this media refetch forbidden response has a 2xx status code +func (o *MediaRefetchForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch forbidden response has a 3xx status code +func (o *MediaRefetchForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch forbidden response has a 4xx status code +func (o *MediaRefetchForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch forbidden response has a 5xx status code +func (o *MediaRefetchForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch forbidden response a status code equal to that given +func (o *MediaRefetchForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the media refetch forbidden response +func (o *MediaRefetchForbidden) Code() int { + return 403 +} + +func (o *MediaRefetchForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchForbidden", 403) +} + +func (o *MediaRefetchForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchForbidden", 403) +} + +func (o *MediaRefetchForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchNotFound creates a MediaRefetchNotFound with default headers values +func NewMediaRefetchNotFound() *MediaRefetchNotFound { + return &MediaRefetchNotFound{} +} + +/* +MediaRefetchNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaRefetchNotFound struct { +} + +// IsSuccess returns true when this media refetch not found response has a 2xx status code +func (o *MediaRefetchNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch not found response has a 3xx status code +func (o *MediaRefetchNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch not found response has a 4xx status code +func (o *MediaRefetchNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch not found response has a 5xx status code +func (o *MediaRefetchNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch not found response a status code equal to that given +func (o *MediaRefetchNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media refetch not found response +func (o *MediaRefetchNotFound) Code() int { + return 404 +} + +func (o *MediaRefetchNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotFound", 404) +} + +func (o *MediaRefetchNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotFound", 404) +} + +func (o *MediaRefetchNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchNotAcceptable creates a MediaRefetchNotAcceptable with default headers values +func NewMediaRefetchNotAcceptable() *MediaRefetchNotAcceptable { + return &MediaRefetchNotAcceptable{} +} + +/* +MediaRefetchNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaRefetchNotAcceptable struct { +} + +// IsSuccess returns true when this media refetch not acceptable response has a 2xx status code +func (o *MediaRefetchNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch not acceptable response has a 3xx status code +func (o *MediaRefetchNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch not acceptable response has a 4xx status code +func (o *MediaRefetchNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media refetch not acceptable response has a 5xx status code +func (o *MediaRefetchNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media refetch not acceptable response a status code equal to that given +func (o *MediaRefetchNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media refetch not acceptable response +func (o *MediaRefetchNotAcceptable) Code() int { + return 406 +} + +func (o *MediaRefetchNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotAcceptable", 406) +} + +func (o *MediaRefetchNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchNotAcceptable", 406) +} + +func (o *MediaRefetchNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaRefetchInternalServerError creates a MediaRefetchInternalServerError with default headers values +func NewMediaRefetchInternalServerError() *MediaRefetchInternalServerError { + return &MediaRefetchInternalServerError{} +} + +/* +MediaRefetchInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaRefetchInternalServerError struct { +} + +// IsSuccess returns true when this media refetch internal server error response has a 2xx status code +func (o *MediaRefetchInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media refetch internal server error response has a 3xx status code +func (o *MediaRefetchInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media refetch internal server error response has a 4xx status code +func (o *MediaRefetchInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media refetch internal server error response has a 5xx status code +func (o *MediaRefetchInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media refetch internal server error response a status code equal to that given +func (o *MediaRefetchInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media refetch internal server error response +func (o *MediaRefetchInternalServerError) Code() int { + return 500 +} + +func (o *MediaRefetchInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchInternalServerError", 500) +} + +func (o *MediaRefetchInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/media_refetch][%d] mediaRefetchInternalServerError", 500) +} + +func (o *MediaRefetchInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/rule_create_parameters.go b/client/admin/rule_create_parameters.go new file mode 100644 index 0000000..6f729da --- /dev/null +++ b/client/admin/rule_create_parameters.go @@ -0,0 +1,155 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewRuleCreateParams creates a new RuleCreateParams 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 NewRuleCreateParams() *RuleCreateParams { + return &RuleCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRuleCreateParamsWithTimeout creates a new RuleCreateParams object +// with the ability to set a timeout on a request. +func NewRuleCreateParamsWithTimeout(timeout time.Duration) *RuleCreateParams { + return &RuleCreateParams{ + timeout: timeout, + } +} + +// NewRuleCreateParamsWithContext creates a new RuleCreateParams object +// with the ability to set a context for a request. +func NewRuleCreateParamsWithContext(ctx context.Context) *RuleCreateParams { + return &RuleCreateParams{ + Context: ctx, + } +} + +// NewRuleCreateParamsWithHTTPClient creates a new RuleCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewRuleCreateParamsWithHTTPClient(client *http.Client) *RuleCreateParams { + return &RuleCreateParams{ + HTTPClient: client, + } +} + +/* +RuleCreateParams contains all the parameters to send to the API endpoint + + for the rule create operation. + + Typically these are written to a http.Request. +*/ +type RuleCreateParams struct { + + /* Text. + + Text body for the instance rule, plaintext. + */ + Text string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rule create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleCreateParams) WithDefaults() *RuleCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rule create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rule create params +func (o *RuleCreateParams) WithTimeout(timeout time.Duration) *RuleCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rule create params +func (o *RuleCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rule create params +func (o *RuleCreateParams) WithContext(ctx context.Context) *RuleCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rule create params +func (o *RuleCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rule create params +func (o *RuleCreateParams) WithHTTPClient(client *http.Client) *RuleCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rule create params +func (o *RuleCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithText adds the text to the rule create params +func (o *RuleCreateParams) WithText(text string) *RuleCreateParams { + o.SetText(text) + return o +} + +// SetText adds the text to the rule create params +func (o *RuleCreateParams) SetText(text string) { + o.Text = text +} + +// WriteToRequest writes these params to a swagger request +func (o *RuleCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param text + frText := o.Text + fText := frText + if fText != "" { + if err := r.SetFormParam("text", fText); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/rule_create_responses.go b/client/admin/rule_create_responses.go new file mode 100644 index 0000000..b300512 --- /dev/null +++ b/client/admin/rule_create_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RuleCreateReader is a Reader for the RuleCreate structure. +type RuleCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RuleCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRuleCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRuleCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRuleCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewRuleCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRuleCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRuleCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRuleCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/instance/rules] ruleCreate", response, response.Code()) + } +} + +// NewRuleCreateOK creates a RuleCreateOK with default headers values +func NewRuleCreateOK() *RuleCreateOK { + return &RuleCreateOK{} +} + +/* +RuleCreateOK describes a response with status code 200, with default header values. + +The newly-created instance rule. +*/ +type RuleCreateOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this rule create o k response has a 2xx status code +func (o *RuleCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rule create o k response has a 3xx status code +func (o *RuleCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create o k response has a 4xx status code +func (o *RuleCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule create o k response has a 5xx status code +func (o *RuleCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create o k response a status code equal to that given +func (o *RuleCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rule create o k response +func (o *RuleCreateOK) Code() int { + return 200 +} + +func (o *RuleCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateOK %s", 200, payload) +} + +func (o *RuleCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateOK %s", 200, payload) +} + +func (o *RuleCreateOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *RuleCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRuleCreateBadRequest creates a RuleCreateBadRequest with default headers values +func NewRuleCreateBadRequest() *RuleCreateBadRequest { + return &RuleCreateBadRequest{} +} + +/* +RuleCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RuleCreateBadRequest struct { +} + +// IsSuccess returns true when this rule create bad request response has a 2xx status code +func (o *RuleCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create bad request response has a 3xx status code +func (o *RuleCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create bad request response has a 4xx status code +func (o *RuleCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create bad request response has a 5xx status code +func (o *RuleCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create bad request response a status code equal to that given +func (o *RuleCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rule create bad request response +func (o *RuleCreateBadRequest) Code() int { + return 400 +} + +func (o *RuleCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateBadRequest", 400) +} + +func (o *RuleCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateBadRequest", 400) +} + +func (o *RuleCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateUnauthorized creates a RuleCreateUnauthorized with default headers values +func NewRuleCreateUnauthorized() *RuleCreateUnauthorized { + return &RuleCreateUnauthorized{} +} + +/* +RuleCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RuleCreateUnauthorized struct { +} + +// IsSuccess returns true when this rule create unauthorized response has a 2xx status code +func (o *RuleCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create unauthorized response has a 3xx status code +func (o *RuleCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create unauthorized response has a 4xx status code +func (o *RuleCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create unauthorized response has a 5xx status code +func (o *RuleCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create unauthorized response a status code equal to that given +func (o *RuleCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the rule create unauthorized response +func (o *RuleCreateUnauthorized) Code() int { + return 401 +} + +func (o *RuleCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateUnauthorized", 401) +} + +func (o *RuleCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateUnauthorized", 401) +} + +func (o *RuleCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateForbidden creates a RuleCreateForbidden with default headers values +func NewRuleCreateForbidden() *RuleCreateForbidden { + return &RuleCreateForbidden{} +} + +/* +RuleCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type RuleCreateForbidden struct { +} + +// IsSuccess returns true when this rule create forbidden response has a 2xx status code +func (o *RuleCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create forbidden response has a 3xx status code +func (o *RuleCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create forbidden response has a 4xx status code +func (o *RuleCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create forbidden response has a 5xx status code +func (o *RuleCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create forbidden response a status code equal to that given +func (o *RuleCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the rule create forbidden response +func (o *RuleCreateForbidden) Code() int { + return 403 +} + +func (o *RuleCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateForbidden", 403) +} + +func (o *RuleCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateForbidden", 403) +} + +func (o *RuleCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateNotFound creates a RuleCreateNotFound with default headers values +func NewRuleCreateNotFound() *RuleCreateNotFound { + return &RuleCreateNotFound{} +} + +/* +RuleCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RuleCreateNotFound struct { +} + +// IsSuccess returns true when this rule create not found response has a 2xx status code +func (o *RuleCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create not found response has a 3xx status code +func (o *RuleCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create not found response has a 4xx status code +func (o *RuleCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create not found response has a 5xx status code +func (o *RuleCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create not found response a status code equal to that given +func (o *RuleCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rule create not found response +func (o *RuleCreateNotFound) Code() int { + return 404 +} + +func (o *RuleCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotFound", 404) +} + +func (o *RuleCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotFound", 404) +} + +func (o *RuleCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateNotAcceptable creates a RuleCreateNotAcceptable with default headers values +func NewRuleCreateNotAcceptable() *RuleCreateNotAcceptable { + return &RuleCreateNotAcceptable{} +} + +/* +RuleCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RuleCreateNotAcceptable struct { +} + +// IsSuccess returns true when this rule create not acceptable response has a 2xx status code +func (o *RuleCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create not acceptable response has a 3xx status code +func (o *RuleCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create not acceptable response has a 4xx status code +func (o *RuleCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule create not acceptable response has a 5xx status code +func (o *RuleCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rule create not acceptable response a status code equal to that given +func (o *RuleCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rule create not acceptable response +func (o *RuleCreateNotAcceptable) Code() int { + return 406 +} + +func (o *RuleCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotAcceptable", 406) +} + +func (o *RuleCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateNotAcceptable", 406) +} + +func (o *RuleCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleCreateInternalServerError creates a RuleCreateInternalServerError with default headers values +func NewRuleCreateInternalServerError() *RuleCreateInternalServerError { + return &RuleCreateInternalServerError{} +} + +/* +RuleCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RuleCreateInternalServerError struct { +} + +// IsSuccess returns true when this rule create internal server error response has a 2xx status code +func (o *RuleCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule create internal server error response has a 3xx status code +func (o *RuleCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule create internal server error response has a 4xx status code +func (o *RuleCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule create internal server error response has a 5xx status code +func (o *RuleCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rule create internal server error response a status code equal to that given +func (o *RuleCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rule create internal server error response +func (o *RuleCreateInternalServerError) Code() int { + return 500 +} + +func (o *RuleCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateInternalServerError", 500) +} + +func (o *RuleCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/instance/rules][%d] ruleCreateInternalServerError", 500) +} + +func (o *RuleCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/rule_delete_parameters.go b/client/admin/rule_delete_parameters.go new file mode 100644 index 0000000..6e9bc8d --- /dev/null +++ b/client/admin/rule_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewRuleDeleteParams creates a new RuleDeleteParams 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 NewRuleDeleteParams() *RuleDeleteParams { + return &RuleDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRuleDeleteParamsWithTimeout creates a new RuleDeleteParams object +// with the ability to set a timeout on a request. +func NewRuleDeleteParamsWithTimeout(timeout time.Duration) *RuleDeleteParams { + return &RuleDeleteParams{ + timeout: timeout, + } +} + +// NewRuleDeleteParamsWithContext creates a new RuleDeleteParams object +// with the ability to set a context for a request. +func NewRuleDeleteParamsWithContext(ctx context.Context) *RuleDeleteParams { + return &RuleDeleteParams{ + Context: ctx, + } +} + +// NewRuleDeleteParamsWithHTTPClient creates a new RuleDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewRuleDeleteParamsWithHTTPClient(client *http.Client) *RuleDeleteParams { + return &RuleDeleteParams{ + HTTPClient: client, + } +} + +/* +RuleDeleteParams contains all the parameters to send to the API endpoint + + for the rule delete operation. + + Typically these are written to a http.Request. +*/ +type RuleDeleteParams struct { + + /* ID. + + The id of the rule to delete. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rule delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleDeleteParams) WithDefaults() *RuleDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rule delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rule delete params +func (o *RuleDeleteParams) WithTimeout(timeout time.Duration) *RuleDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rule delete params +func (o *RuleDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rule delete params +func (o *RuleDeleteParams) WithContext(ctx context.Context) *RuleDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rule delete params +func (o *RuleDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rule delete params +func (o *RuleDeleteParams) WithHTTPClient(client *http.Client) *RuleDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rule delete params +func (o *RuleDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the rule delete params +func (o *RuleDeleteParams) WithID(id string) *RuleDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the rule delete params +func (o *RuleDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *RuleDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/rule_delete_responses.go b/client/admin/rule_delete_responses.go new file mode 100644 index 0000000..1a5d9a7 --- /dev/null +++ b/client/admin/rule_delete_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RuleDeleteReader is a Reader for the RuleDelete structure. +type RuleDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RuleDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRuleDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRuleDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRuleDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewRuleDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRuleDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRuleDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRuleDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/admin/instance/rules/{id}] ruleDelete", response, response.Code()) + } +} + +// NewRuleDeleteOK creates a RuleDeleteOK with default headers values +func NewRuleDeleteOK() *RuleDeleteOK { + return &RuleDeleteOK{} +} + +/* +RuleDeleteOK describes a response with status code 200, with default header values. + +The deleted instance rule. +*/ +type RuleDeleteOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this rule delete o k response has a 2xx status code +func (o *RuleDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rule delete o k response has a 3xx status code +func (o *RuleDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete o k response has a 4xx status code +func (o *RuleDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule delete o k response has a 5xx status code +func (o *RuleDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete o k response a status code equal to that given +func (o *RuleDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rule delete o k response +func (o *RuleDeleteOK) Code() int { + return 200 +} + +func (o *RuleDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteOK %s", 200, payload) +} + +func (o *RuleDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteOK %s", 200, payload) +} + +func (o *RuleDeleteOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *RuleDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRuleDeleteBadRequest creates a RuleDeleteBadRequest with default headers values +func NewRuleDeleteBadRequest() *RuleDeleteBadRequest { + return &RuleDeleteBadRequest{} +} + +/* +RuleDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RuleDeleteBadRequest struct { +} + +// IsSuccess returns true when this rule delete bad request response has a 2xx status code +func (o *RuleDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete bad request response has a 3xx status code +func (o *RuleDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete bad request response has a 4xx status code +func (o *RuleDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete bad request response has a 5xx status code +func (o *RuleDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete bad request response a status code equal to that given +func (o *RuleDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rule delete bad request response +func (o *RuleDeleteBadRequest) Code() int { + return 400 +} + +func (o *RuleDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteBadRequest", 400) +} + +func (o *RuleDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteBadRequest", 400) +} + +func (o *RuleDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteUnauthorized creates a RuleDeleteUnauthorized with default headers values +func NewRuleDeleteUnauthorized() *RuleDeleteUnauthorized { + return &RuleDeleteUnauthorized{} +} + +/* +RuleDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RuleDeleteUnauthorized struct { +} + +// IsSuccess returns true when this rule delete unauthorized response has a 2xx status code +func (o *RuleDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete unauthorized response has a 3xx status code +func (o *RuleDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete unauthorized response has a 4xx status code +func (o *RuleDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete unauthorized response has a 5xx status code +func (o *RuleDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete unauthorized response a status code equal to that given +func (o *RuleDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the rule delete unauthorized response +func (o *RuleDeleteUnauthorized) Code() int { + return 401 +} + +func (o *RuleDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteUnauthorized", 401) +} + +func (o *RuleDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteUnauthorized", 401) +} + +func (o *RuleDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteForbidden creates a RuleDeleteForbidden with default headers values +func NewRuleDeleteForbidden() *RuleDeleteForbidden { + return &RuleDeleteForbidden{} +} + +/* +RuleDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type RuleDeleteForbidden struct { +} + +// IsSuccess returns true when this rule delete forbidden response has a 2xx status code +func (o *RuleDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete forbidden response has a 3xx status code +func (o *RuleDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete forbidden response has a 4xx status code +func (o *RuleDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete forbidden response has a 5xx status code +func (o *RuleDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete forbidden response a status code equal to that given +func (o *RuleDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the rule delete forbidden response +func (o *RuleDeleteForbidden) Code() int { + return 403 +} + +func (o *RuleDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteForbidden", 403) +} + +func (o *RuleDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteForbidden", 403) +} + +func (o *RuleDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteNotFound creates a RuleDeleteNotFound with default headers values +func NewRuleDeleteNotFound() *RuleDeleteNotFound { + return &RuleDeleteNotFound{} +} + +/* +RuleDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RuleDeleteNotFound struct { +} + +// IsSuccess returns true when this rule delete not found response has a 2xx status code +func (o *RuleDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete not found response has a 3xx status code +func (o *RuleDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete not found response has a 4xx status code +func (o *RuleDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete not found response has a 5xx status code +func (o *RuleDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete not found response a status code equal to that given +func (o *RuleDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rule delete not found response +func (o *RuleDeleteNotFound) Code() int { + return 404 +} + +func (o *RuleDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotFound", 404) +} + +func (o *RuleDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotFound", 404) +} + +func (o *RuleDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteNotAcceptable creates a RuleDeleteNotAcceptable with default headers values +func NewRuleDeleteNotAcceptable() *RuleDeleteNotAcceptable { + return &RuleDeleteNotAcceptable{} +} + +/* +RuleDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RuleDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this rule delete not acceptable response has a 2xx status code +func (o *RuleDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete not acceptable response has a 3xx status code +func (o *RuleDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete not acceptable response has a 4xx status code +func (o *RuleDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule delete not acceptable response has a 5xx status code +func (o *RuleDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rule delete not acceptable response a status code equal to that given +func (o *RuleDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rule delete not acceptable response +func (o *RuleDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *RuleDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotAcceptable", 406) +} + +func (o *RuleDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteNotAcceptable", 406) +} + +func (o *RuleDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleDeleteInternalServerError creates a RuleDeleteInternalServerError with default headers values +func NewRuleDeleteInternalServerError() *RuleDeleteInternalServerError { + return &RuleDeleteInternalServerError{} +} + +/* +RuleDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RuleDeleteInternalServerError struct { +} + +// IsSuccess returns true when this rule delete internal server error response has a 2xx status code +func (o *RuleDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule delete internal server error response has a 3xx status code +func (o *RuleDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule delete internal server error response has a 4xx status code +func (o *RuleDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule delete internal server error response has a 5xx status code +func (o *RuleDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rule delete internal server error response a status code equal to that given +func (o *RuleDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rule delete internal server error response +func (o *RuleDeleteInternalServerError) Code() int { + return 500 +} + +func (o *RuleDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteInternalServerError", 500) +} + +func (o *RuleDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/admin/instance/rules/{id}][%d] ruleDeleteInternalServerError", 500) +} + +func (o *RuleDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/rule_update_parameters.go b/client/admin/rule_update_parameters.go new file mode 100644 index 0000000..94fcdb5 --- /dev/null +++ b/client/admin/rule_update_parameters.go @@ -0,0 +1,177 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewRuleUpdateParams creates a new RuleUpdateParams 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 NewRuleUpdateParams() *RuleUpdateParams { + return &RuleUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRuleUpdateParamsWithTimeout creates a new RuleUpdateParams object +// with the ability to set a timeout on a request. +func NewRuleUpdateParamsWithTimeout(timeout time.Duration) *RuleUpdateParams { + return &RuleUpdateParams{ + timeout: timeout, + } +} + +// NewRuleUpdateParamsWithContext creates a new RuleUpdateParams object +// with the ability to set a context for a request. +func NewRuleUpdateParamsWithContext(ctx context.Context) *RuleUpdateParams { + return &RuleUpdateParams{ + Context: ctx, + } +} + +// NewRuleUpdateParamsWithHTTPClient creates a new RuleUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewRuleUpdateParamsWithHTTPClient(client *http.Client) *RuleUpdateParams { + return &RuleUpdateParams{ + HTTPClient: client, + } +} + +/* +RuleUpdateParams contains all the parameters to send to the API endpoint + + for the rule update operation. + + Typically these are written to a http.Request. +*/ +type RuleUpdateParams struct { + + /* ID. + + The id of the rule to update. + */ + ID string + + /* Text. + + Text body for the updated instance rule, plaintext. + */ + Text string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rule update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleUpdateParams) WithDefaults() *RuleUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rule update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RuleUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rule update params +func (o *RuleUpdateParams) WithTimeout(timeout time.Duration) *RuleUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rule update params +func (o *RuleUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rule update params +func (o *RuleUpdateParams) WithContext(ctx context.Context) *RuleUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rule update params +func (o *RuleUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rule update params +func (o *RuleUpdateParams) WithHTTPClient(client *http.Client) *RuleUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rule update params +func (o *RuleUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the rule update params +func (o *RuleUpdateParams) WithID(id string) *RuleUpdateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the rule update params +func (o *RuleUpdateParams) SetID(id string) { + o.ID = id +} + +// WithText adds the text to the rule update params +func (o *RuleUpdateParams) WithText(text string) *RuleUpdateParams { + o.SetText(text) + return o +} + +// SetText adds the text to the rule update params +func (o *RuleUpdateParams) SetText(text string) { + o.Text = text +} + +// WriteToRequest writes these params to a swagger request +func (o *RuleUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param text + frText := o.Text + fText := frText + if fText != "" { + if err := r.SetFormParam("text", fText); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/rule_update_responses.go b/client/admin/rule_update_responses.go new file mode 100644 index 0000000..d56f500 --- /dev/null +++ b/client/admin/rule_update_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RuleUpdateReader is a Reader for the RuleUpdate structure. +type RuleUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RuleUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRuleUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRuleUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRuleUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewRuleUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRuleUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRuleUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRuleUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/admin/instance/rules/{id}] ruleUpdate", response, response.Code()) + } +} + +// NewRuleUpdateOK creates a RuleUpdateOK with default headers values +func NewRuleUpdateOK() *RuleUpdateOK { + return &RuleUpdateOK{} +} + +/* +RuleUpdateOK describes a response with status code 200, with default header values. + +The updated instance rule. +*/ +type RuleUpdateOK struct { + Payload *models.InstanceRule +} + +// IsSuccess returns true when this rule update o k response has a 2xx status code +func (o *RuleUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rule update o k response has a 3xx status code +func (o *RuleUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update o k response has a 4xx status code +func (o *RuleUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule update o k response has a 5xx status code +func (o *RuleUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update o k response a status code equal to that given +func (o *RuleUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rule update o k response +func (o *RuleUpdateOK) Code() int { + return 200 +} + +func (o *RuleUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateOK %s", 200, payload) +} + +func (o *RuleUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateOK %s", 200, payload) +} + +func (o *RuleUpdateOK) GetPayload() *models.InstanceRule { + return o.Payload +} + +func (o *RuleUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceRule) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRuleUpdateBadRequest creates a RuleUpdateBadRequest with default headers values +func NewRuleUpdateBadRequest() *RuleUpdateBadRequest { + return &RuleUpdateBadRequest{} +} + +/* +RuleUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RuleUpdateBadRequest struct { +} + +// IsSuccess returns true when this rule update bad request response has a 2xx status code +func (o *RuleUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update bad request response has a 3xx status code +func (o *RuleUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update bad request response has a 4xx status code +func (o *RuleUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update bad request response has a 5xx status code +func (o *RuleUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update bad request response a status code equal to that given +func (o *RuleUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rule update bad request response +func (o *RuleUpdateBadRequest) Code() int { + return 400 +} + +func (o *RuleUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateBadRequest", 400) +} + +func (o *RuleUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateBadRequest", 400) +} + +func (o *RuleUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateUnauthorized creates a RuleUpdateUnauthorized with default headers values +func NewRuleUpdateUnauthorized() *RuleUpdateUnauthorized { + return &RuleUpdateUnauthorized{} +} + +/* +RuleUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RuleUpdateUnauthorized struct { +} + +// IsSuccess returns true when this rule update unauthorized response has a 2xx status code +func (o *RuleUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update unauthorized response has a 3xx status code +func (o *RuleUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update unauthorized response has a 4xx status code +func (o *RuleUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update unauthorized response has a 5xx status code +func (o *RuleUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update unauthorized response a status code equal to that given +func (o *RuleUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the rule update unauthorized response +func (o *RuleUpdateUnauthorized) Code() int { + return 401 +} + +func (o *RuleUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateUnauthorized", 401) +} + +func (o *RuleUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateUnauthorized", 401) +} + +func (o *RuleUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateForbidden creates a RuleUpdateForbidden with default headers values +func NewRuleUpdateForbidden() *RuleUpdateForbidden { + return &RuleUpdateForbidden{} +} + +/* +RuleUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type RuleUpdateForbidden struct { +} + +// IsSuccess returns true when this rule update forbidden response has a 2xx status code +func (o *RuleUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update forbidden response has a 3xx status code +func (o *RuleUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update forbidden response has a 4xx status code +func (o *RuleUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update forbidden response has a 5xx status code +func (o *RuleUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update forbidden response a status code equal to that given +func (o *RuleUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the rule update forbidden response +func (o *RuleUpdateForbidden) Code() int { + return 403 +} + +func (o *RuleUpdateForbidden) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateForbidden", 403) +} + +func (o *RuleUpdateForbidden) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateForbidden", 403) +} + +func (o *RuleUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateNotFound creates a RuleUpdateNotFound with default headers values +func NewRuleUpdateNotFound() *RuleUpdateNotFound { + return &RuleUpdateNotFound{} +} + +/* +RuleUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RuleUpdateNotFound struct { +} + +// IsSuccess returns true when this rule update not found response has a 2xx status code +func (o *RuleUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update not found response has a 3xx status code +func (o *RuleUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update not found response has a 4xx status code +func (o *RuleUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update not found response has a 5xx status code +func (o *RuleUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update not found response a status code equal to that given +func (o *RuleUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rule update not found response +func (o *RuleUpdateNotFound) Code() int { + return 404 +} + +func (o *RuleUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotFound", 404) +} + +func (o *RuleUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotFound", 404) +} + +func (o *RuleUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateNotAcceptable creates a RuleUpdateNotAcceptable with default headers values +func NewRuleUpdateNotAcceptable() *RuleUpdateNotAcceptable { + return &RuleUpdateNotAcceptable{} +} + +/* +RuleUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RuleUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this rule update not acceptable response has a 2xx status code +func (o *RuleUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update not acceptable response has a 3xx status code +func (o *RuleUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update not acceptable response has a 4xx status code +func (o *RuleUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rule update not acceptable response has a 5xx status code +func (o *RuleUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rule update not acceptable response a status code equal to that given +func (o *RuleUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rule update not acceptable response +func (o *RuleUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *RuleUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotAcceptable", 406) +} + +func (o *RuleUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateNotAcceptable", 406) +} + +func (o *RuleUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRuleUpdateInternalServerError creates a RuleUpdateInternalServerError with default headers values +func NewRuleUpdateInternalServerError() *RuleUpdateInternalServerError { + return &RuleUpdateInternalServerError{} +} + +/* +RuleUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RuleUpdateInternalServerError struct { +} + +// IsSuccess returns true when this rule update internal server error response has a 2xx status code +func (o *RuleUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rule update internal server error response has a 3xx status code +func (o *RuleUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rule update internal server error response has a 4xx status code +func (o *RuleUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rule update internal server error response has a 5xx status code +func (o *RuleUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rule update internal server error response a status code equal to that given +func (o *RuleUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rule update internal server error response +func (o *RuleUpdateInternalServerError) Code() int { + return 500 +} + +func (o *RuleUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateInternalServerError", 500) +} + +func (o *RuleUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/admin/instance/rules/{id}][%d] ruleUpdateInternalServerError", 500) +} + +func (o *RuleUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/admin/test_email_send_parameters.go b/client/admin/test_email_send_parameters.go new file mode 100644 index 0000000..72f4973 --- /dev/null +++ b/client/admin/test_email_send_parameters.go @@ -0,0 +1,187 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// 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" +) + +// NewTestEmailSendParams creates a new TestEmailSendParams 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 NewTestEmailSendParams() *TestEmailSendParams { + return &TestEmailSendParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTestEmailSendParamsWithTimeout creates a new TestEmailSendParams object +// with the ability to set a timeout on a request. +func NewTestEmailSendParamsWithTimeout(timeout time.Duration) *TestEmailSendParams { + return &TestEmailSendParams{ + timeout: timeout, + } +} + +// NewTestEmailSendParamsWithContext creates a new TestEmailSendParams object +// with the ability to set a context for a request. +func NewTestEmailSendParamsWithContext(ctx context.Context) *TestEmailSendParams { + return &TestEmailSendParams{ + Context: ctx, + } +} + +// NewTestEmailSendParamsWithHTTPClient creates a new TestEmailSendParams object +// with the ability to set a custom HTTPClient for a request. +func NewTestEmailSendParamsWithHTTPClient(client *http.Client) *TestEmailSendParams { + return &TestEmailSendParams{ + HTTPClient: client, + } +} + +/* +TestEmailSendParams contains all the parameters to send to the API endpoint + + for the test email send operation. + + Typically these are written to a http.Request. +*/ +type TestEmailSendParams struct { + + /* Email. + + The email address that the test email should be sent to. + */ + Email string + + /* Message. + + Optional message to include in the email. + */ + Message *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the test email send params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TestEmailSendParams) WithDefaults() *TestEmailSendParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the test email send params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TestEmailSendParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the test email send params +func (o *TestEmailSendParams) WithTimeout(timeout time.Duration) *TestEmailSendParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the test email send params +func (o *TestEmailSendParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the test email send params +func (o *TestEmailSendParams) WithContext(ctx context.Context) *TestEmailSendParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the test email send params +func (o *TestEmailSendParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the test email send params +func (o *TestEmailSendParams) WithHTTPClient(client *http.Client) *TestEmailSendParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the test email send params +func (o *TestEmailSendParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithEmail adds the email to the test email send params +func (o *TestEmailSendParams) WithEmail(email string) *TestEmailSendParams { + o.SetEmail(email) + return o +} + +// SetEmail adds the email to the test email send params +func (o *TestEmailSendParams) SetEmail(email string) { + o.Email = email +} + +// WithMessage adds the message to the test email send params +func (o *TestEmailSendParams) WithMessage(message *string) *TestEmailSendParams { + o.SetMessage(message) + return o +} + +// SetMessage adds the message to the test email send params +func (o *TestEmailSendParams) SetMessage(message *string) { + o.Message = message +} + +// WriteToRequest writes these params to a swagger request +func (o *TestEmailSendParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param email + frEmail := o.Email + fEmail := frEmail + if fEmail != "" { + if err := r.SetFormParam("email", fEmail); err != nil { + return err + } + } + + if o.Message != nil { + + // form param message + var frMessage string + if o.Message != nil { + frMessage = *o.Message + } + fMessage := frMessage + if fMessage != "" { + if err := r.SetFormParam("message", fMessage); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/admin/test_email_send_responses.go b/client/admin/test_email_send_responses.go new file mode 100644 index 0000000..bad0b40 --- /dev/null +++ b/client/admin/test_email_send_responses.go @@ -0,0 +1,522 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package admin + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// TestEmailSendReader is a Reader for the TestEmailSend structure. +type TestEmailSendReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TestEmailSendReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewTestEmailSendAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewTestEmailSendBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewTestEmailSendUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewTestEmailSendForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewTestEmailSendNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewTestEmailSendNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewTestEmailSendUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewTestEmailSendInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/email/test] testEmailSend", response, response.Code()) + } +} + +// NewTestEmailSendAccepted creates a TestEmailSendAccepted with default headers values +func NewTestEmailSendAccepted() *TestEmailSendAccepted { + return &TestEmailSendAccepted{} +} + +/* +TestEmailSendAccepted describes a response with status code 202, with default header values. + +Test email was sent. +*/ +type TestEmailSendAccepted struct { +} + +// IsSuccess returns true when this test email send accepted response has a 2xx status code +func (o *TestEmailSendAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this test email send accepted response has a 3xx status code +func (o *TestEmailSendAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send accepted response has a 4xx status code +func (o *TestEmailSendAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this test email send accepted response has a 5xx status code +func (o *TestEmailSendAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send accepted response a status code equal to that given +func (o *TestEmailSendAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the test email send accepted response +func (o *TestEmailSendAccepted) Code() int { + return 202 +} + +func (o *TestEmailSendAccepted) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendAccepted", 202) +} + +func (o *TestEmailSendAccepted) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendAccepted", 202) +} + +func (o *TestEmailSendAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendBadRequest creates a TestEmailSendBadRequest with default headers values +func NewTestEmailSendBadRequest() *TestEmailSendBadRequest { + return &TestEmailSendBadRequest{} +} + +/* +TestEmailSendBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type TestEmailSendBadRequest struct { +} + +// IsSuccess returns true when this test email send bad request response has a 2xx status code +func (o *TestEmailSendBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send bad request response has a 3xx status code +func (o *TestEmailSendBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send bad request response has a 4xx status code +func (o *TestEmailSendBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send bad request response has a 5xx status code +func (o *TestEmailSendBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send bad request response a status code equal to that given +func (o *TestEmailSendBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the test email send bad request response +func (o *TestEmailSendBadRequest) Code() int { + return 400 +} + +func (o *TestEmailSendBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendBadRequest", 400) +} + +func (o *TestEmailSendBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendBadRequest", 400) +} + +func (o *TestEmailSendBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendUnauthorized creates a TestEmailSendUnauthorized with default headers values +func NewTestEmailSendUnauthorized() *TestEmailSendUnauthorized { + return &TestEmailSendUnauthorized{} +} + +/* +TestEmailSendUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type TestEmailSendUnauthorized struct { +} + +// IsSuccess returns true when this test email send unauthorized response has a 2xx status code +func (o *TestEmailSendUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send unauthorized response has a 3xx status code +func (o *TestEmailSendUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send unauthorized response has a 4xx status code +func (o *TestEmailSendUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send unauthorized response has a 5xx status code +func (o *TestEmailSendUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send unauthorized response a status code equal to that given +func (o *TestEmailSendUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the test email send unauthorized response +func (o *TestEmailSendUnauthorized) Code() int { + return 401 +} + +func (o *TestEmailSendUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnauthorized", 401) +} + +func (o *TestEmailSendUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnauthorized", 401) +} + +func (o *TestEmailSendUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendForbidden creates a TestEmailSendForbidden with default headers values +func NewTestEmailSendForbidden() *TestEmailSendForbidden { + return &TestEmailSendForbidden{} +} + +/* +TestEmailSendForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type TestEmailSendForbidden struct { +} + +// IsSuccess returns true when this test email send forbidden response has a 2xx status code +func (o *TestEmailSendForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send forbidden response has a 3xx status code +func (o *TestEmailSendForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send forbidden response has a 4xx status code +func (o *TestEmailSendForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send forbidden response has a 5xx status code +func (o *TestEmailSendForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send forbidden response a status code equal to that given +func (o *TestEmailSendForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the test email send forbidden response +func (o *TestEmailSendForbidden) Code() int { + return 403 +} + +func (o *TestEmailSendForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendForbidden", 403) +} + +func (o *TestEmailSendForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendForbidden", 403) +} + +func (o *TestEmailSendForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendNotFound creates a TestEmailSendNotFound with default headers values +func NewTestEmailSendNotFound() *TestEmailSendNotFound { + return &TestEmailSendNotFound{} +} + +/* +TestEmailSendNotFound describes a response with status code 404, with default header values. + +not found +*/ +type TestEmailSendNotFound struct { +} + +// IsSuccess returns true when this test email send not found response has a 2xx status code +func (o *TestEmailSendNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send not found response has a 3xx status code +func (o *TestEmailSendNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send not found response has a 4xx status code +func (o *TestEmailSendNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send not found response has a 5xx status code +func (o *TestEmailSendNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send not found response a status code equal to that given +func (o *TestEmailSendNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the test email send not found response +func (o *TestEmailSendNotFound) Code() int { + return 404 +} + +func (o *TestEmailSendNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotFound", 404) +} + +func (o *TestEmailSendNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotFound", 404) +} + +func (o *TestEmailSendNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendNotAcceptable creates a TestEmailSendNotAcceptable with default headers values +func NewTestEmailSendNotAcceptable() *TestEmailSendNotAcceptable { + return &TestEmailSendNotAcceptable{} +} + +/* +TestEmailSendNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type TestEmailSendNotAcceptable struct { +} + +// IsSuccess returns true when this test email send not acceptable response has a 2xx status code +func (o *TestEmailSendNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send not acceptable response has a 3xx status code +func (o *TestEmailSendNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send not acceptable response has a 4xx status code +func (o *TestEmailSendNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send not acceptable response has a 5xx status code +func (o *TestEmailSendNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send not acceptable response a status code equal to that given +func (o *TestEmailSendNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the test email send not acceptable response +func (o *TestEmailSendNotAcceptable) Code() int { + return 406 +} + +func (o *TestEmailSendNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotAcceptable", 406) +} + +func (o *TestEmailSendNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendNotAcceptable", 406) +} + +func (o *TestEmailSendNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendUnprocessableEntity creates a TestEmailSendUnprocessableEntity with default headers values +func NewTestEmailSendUnprocessableEntity() *TestEmailSendUnprocessableEntity { + return &TestEmailSendUnprocessableEntity{} +} + +/* +TestEmailSendUnprocessableEntity describes a response with status code 422, with default header values. + +An smtp occurred while the email attempt was in progress. Check the returned json for more information. The smtp error will be included, to help you debug communication with the smtp server. +*/ +type TestEmailSendUnprocessableEntity struct { +} + +// IsSuccess returns true when this test email send unprocessable entity response has a 2xx status code +func (o *TestEmailSendUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send unprocessable entity response has a 3xx status code +func (o *TestEmailSendUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send unprocessable entity response has a 4xx status code +func (o *TestEmailSendUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this test email send unprocessable entity response has a 5xx status code +func (o *TestEmailSendUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this test email send unprocessable entity response a status code equal to that given +func (o *TestEmailSendUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the test email send unprocessable entity response +func (o *TestEmailSendUnprocessableEntity) Code() int { + return 422 +} + +func (o *TestEmailSendUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnprocessableEntity", 422) +} + +func (o *TestEmailSendUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendUnprocessableEntity", 422) +} + +func (o *TestEmailSendUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTestEmailSendInternalServerError creates a TestEmailSendInternalServerError with default headers values +func NewTestEmailSendInternalServerError() *TestEmailSendInternalServerError { + return &TestEmailSendInternalServerError{} +} + +/* +TestEmailSendInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type TestEmailSendInternalServerError struct { +} + +// IsSuccess returns true when this test email send internal server error response has a 2xx status code +func (o *TestEmailSendInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this test email send internal server error response has a 3xx status code +func (o *TestEmailSendInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this test email send internal server error response has a 4xx status code +func (o *TestEmailSendInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this test email send internal server error response has a 5xx status code +func (o *TestEmailSendInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this test email send internal server error response a status code equal to that given +func (o *TestEmailSendInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the test email send internal server error response +func (o *TestEmailSendInternalServerError) Code() int { + return 500 +} + +func (o *TestEmailSendInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendInternalServerError", 500) +} + +func (o *TestEmailSendInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/email/test][%d] testEmailSendInternalServerError", 500) +} + +func (o *TestEmailSendInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/apps/app_create_parameters.go b/client/apps/app_create_parameters.go new file mode 100644 index 0000000..54e5805 --- /dev/null +++ b/client/apps/app_create_parameters.go @@ -0,0 +1,249 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package apps + +// 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" +) + +// NewAppCreateParams creates a new AppCreateParams 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 NewAppCreateParams() *AppCreateParams { + return &AppCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAppCreateParamsWithTimeout creates a new AppCreateParams object +// with the ability to set a timeout on a request. +func NewAppCreateParamsWithTimeout(timeout time.Duration) *AppCreateParams { + return &AppCreateParams{ + timeout: timeout, + } +} + +// NewAppCreateParamsWithContext creates a new AppCreateParams object +// with the ability to set a context for a request. +func NewAppCreateParamsWithContext(ctx context.Context) *AppCreateParams { + return &AppCreateParams{ + Context: ctx, + } +} + +// NewAppCreateParamsWithHTTPClient creates a new AppCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewAppCreateParamsWithHTTPClient(client *http.Client) *AppCreateParams { + return &AppCreateParams{ + HTTPClient: client, + } +} + +/* +AppCreateParams contains all the parameters to send to the API endpoint + + for the app create operation. + + Typically these are written to a http.Request. +*/ +type AppCreateParams struct { + + /* ClientName. + + The name of the application. + */ + ClientName string + + /* RedirectUris. + + Where the user should be redirected after authorization. + + To display the authorization code to the user instead of redirecting to a web page, use `urn:ietf:wg:oauth:2.0:oob` in this parameter. + */ + RedirectURIs string + + /* Scopes. + + Space separated list of scopes. + + If no scopes are provided, defaults to `read`. + */ + Scopes *string + + /* Website. + + A URL to the web page of the app (optional). + */ + Website *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the app create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AppCreateParams) WithDefaults() *AppCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the app create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AppCreateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the app create params +func (o *AppCreateParams) WithTimeout(timeout time.Duration) *AppCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the app create params +func (o *AppCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the app create params +func (o *AppCreateParams) WithContext(ctx context.Context) *AppCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the app create params +func (o *AppCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the app create params +func (o *AppCreateParams) WithHTTPClient(client *http.Client) *AppCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the app create params +func (o *AppCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithClientName adds the clientName to the app create params +func (o *AppCreateParams) WithClientName(clientName string) *AppCreateParams { + o.SetClientName(clientName) + return o +} + +// SetClientName adds the clientName to the app create params +func (o *AppCreateParams) SetClientName(clientName string) { + o.ClientName = clientName +} + +// WithRedirectURIs adds the redirectUris to the app create params +func (o *AppCreateParams) WithRedirectURIs(redirectUris string) *AppCreateParams { + o.SetRedirectURIs(redirectUris) + return o +} + +// SetRedirectURIs adds the redirectUris to the app create params +func (o *AppCreateParams) SetRedirectURIs(redirectUris string) { + o.RedirectURIs = redirectUris +} + +// WithScopes adds the scopes to the app create params +func (o *AppCreateParams) WithScopes(scopes *string) *AppCreateParams { + o.SetScopes(scopes) + return o +} + +// SetScopes adds the scopes to the app create params +func (o *AppCreateParams) SetScopes(scopes *string) { + o.Scopes = scopes +} + +// WithWebsite adds the website to the app create params +func (o *AppCreateParams) WithWebsite(website *string) *AppCreateParams { + o.SetWebsite(website) + return o +} + +// SetWebsite adds the website to the app create params +func (o *AppCreateParams) SetWebsite(website *string) { + o.Website = website +} + +// WriteToRequest writes these params to a swagger request +func (o *AppCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param client_name + frClientName := o.ClientName + fClientName := frClientName + if fClientName != "" { + if err := r.SetFormParam("client_name", fClientName); err != nil { + return err + } + } + + // form param redirect_uris + frRedirectUris := o.RedirectURIs + fRedirectUris := frRedirectUris + if fRedirectUris != "" { + if err := r.SetFormParam("redirect_uris", fRedirectUris); err != nil { + return err + } + } + + if o.Scopes != nil { + + // form param scopes + var frScopes string + if o.Scopes != nil { + frScopes = *o.Scopes + } + fScopes := frScopes + if fScopes != "" { + if err := r.SetFormParam("scopes", fScopes); err != nil { + return err + } + } + } + + if o.Website != nil { + + // form param website + var frWebsite string + if o.Website != nil { + frWebsite = *o.Website + } + fWebsite := frWebsite + if fWebsite != "" { + if err := r.SetFormParam("website", fWebsite); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/apps/app_create_responses.go b/client/apps/app_create_responses.go new file mode 100644 index 0000000..9ab5190 --- /dev/null +++ b/client/apps/app_create_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package apps + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AppCreateReader is a Reader for the AppCreate structure. +type AppCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AppCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAppCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAppCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAppCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewAppCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAppCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAppCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAppCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/apps] appCreate", response, response.Code()) + } +} + +// NewAppCreateOK creates a AppCreateOK with default headers values +func NewAppCreateOK() *AppCreateOK { + return &AppCreateOK{} +} + +/* +AppCreateOK describes a response with status code 200, with default header values. + +The newly-created application. +*/ +type AppCreateOK struct { + Payload *models.Application +} + +// IsSuccess returns true when this app create o k response has a 2xx status code +func (o *AppCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this app create o k response has a 3xx status code +func (o *AppCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create o k response has a 4xx status code +func (o *AppCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this app create o k response has a 5xx status code +func (o *AppCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this app create o k response a status code equal to that given +func (o *AppCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the app create o k response +func (o *AppCreateOK) Code() int { + return 200 +} + +func (o *AppCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateOK %s", 200, payload) +} + +func (o *AppCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateOK %s", 200, payload) +} + +func (o *AppCreateOK) GetPayload() *models.Application { + return o.Payload +} + +func (o *AppCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Application) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAppCreateBadRequest creates a AppCreateBadRequest with default headers values +func NewAppCreateBadRequest() *AppCreateBadRequest { + return &AppCreateBadRequest{} +} + +/* +AppCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AppCreateBadRequest struct { +} + +// IsSuccess returns true when this app create bad request response has a 2xx status code +func (o *AppCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create bad request response has a 3xx status code +func (o *AppCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create bad request response has a 4xx status code +func (o *AppCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create bad request response has a 5xx status code +func (o *AppCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this app create bad request response a status code equal to that given +func (o *AppCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the app create bad request response +func (o *AppCreateBadRequest) Code() int { + return 400 +} + +func (o *AppCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateBadRequest", 400) +} + +func (o *AppCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateBadRequest", 400) +} + +func (o *AppCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateUnauthorized creates a AppCreateUnauthorized with default headers values +func NewAppCreateUnauthorized() *AppCreateUnauthorized { + return &AppCreateUnauthorized{} +} + +/* +AppCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AppCreateUnauthorized struct { +} + +// IsSuccess returns true when this app create unauthorized response has a 2xx status code +func (o *AppCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create unauthorized response has a 3xx status code +func (o *AppCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create unauthorized response has a 4xx status code +func (o *AppCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create unauthorized response has a 5xx status code +func (o *AppCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this app create unauthorized response a status code equal to that given +func (o *AppCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the app create unauthorized response +func (o *AppCreateUnauthorized) Code() int { + return 401 +} + +func (o *AppCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateUnauthorized", 401) +} + +func (o *AppCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateUnauthorized", 401) +} + +func (o *AppCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateForbidden creates a AppCreateForbidden with default headers values +func NewAppCreateForbidden() *AppCreateForbidden { + return &AppCreateForbidden{} +} + +/* +AppCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type AppCreateForbidden struct { +} + +// IsSuccess returns true when this app create forbidden response has a 2xx status code +func (o *AppCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create forbidden response has a 3xx status code +func (o *AppCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create forbidden response has a 4xx status code +func (o *AppCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create forbidden response has a 5xx status code +func (o *AppCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this app create forbidden response a status code equal to that given +func (o *AppCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the app create forbidden response +func (o *AppCreateForbidden) Code() int { + return 403 +} + +func (o *AppCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateForbidden", 403) +} + +func (o *AppCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateForbidden", 403) +} + +func (o *AppCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateNotFound creates a AppCreateNotFound with default headers values +func NewAppCreateNotFound() *AppCreateNotFound { + return &AppCreateNotFound{} +} + +/* +AppCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AppCreateNotFound struct { +} + +// IsSuccess returns true when this app create not found response has a 2xx status code +func (o *AppCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create not found response has a 3xx status code +func (o *AppCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create not found response has a 4xx status code +func (o *AppCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create not found response has a 5xx status code +func (o *AppCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this app create not found response a status code equal to that given +func (o *AppCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the app create not found response +func (o *AppCreateNotFound) Code() int { + return 404 +} + +func (o *AppCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotFound", 404) +} + +func (o *AppCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotFound", 404) +} + +func (o *AppCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateNotAcceptable creates a AppCreateNotAcceptable with default headers values +func NewAppCreateNotAcceptable() *AppCreateNotAcceptable { + return &AppCreateNotAcceptable{} +} + +/* +AppCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AppCreateNotAcceptable struct { +} + +// IsSuccess returns true when this app create not acceptable response has a 2xx status code +func (o *AppCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create not acceptable response has a 3xx status code +func (o *AppCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create not acceptable response has a 4xx status code +func (o *AppCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this app create not acceptable response has a 5xx status code +func (o *AppCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this app create not acceptable response a status code equal to that given +func (o *AppCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the app create not acceptable response +func (o *AppCreateNotAcceptable) Code() int { + return 406 +} + +func (o *AppCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotAcceptable", 406) +} + +func (o *AppCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateNotAcceptable", 406) +} + +func (o *AppCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAppCreateInternalServerError creates a AppCreateInternalServerError with default headers values +func NewAppCreateInternalServerError() *AppCreateInternalServerError { + return &AppCreateInternalServerError{} +} + +/* +AppCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AppCreateInternalServerError struct { +} + +// IsSuccess returns true when this app create internal server error response has a 2xx status code +func (o *AppCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this app create internal server error response has a 3xx status code +func (o *AppCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this app create internal server error response has a 4xx status code +func (o *AppCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this app create internal server error response has a 5xx status code +func (o *AppCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this app create internal server error response a status code equal to that given +func (o *AppCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the app create internal server error response +func (o *AppCreateInternalServerError) Code() int { + return 500 +} + +func (o *AppCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateInternalServerError", 500) +} + +func (o *AppCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/apps][%d] appCreateInternalServerError", 500) +} + +func (o *AppCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/apps/apps_client.go b/client/apps/apps_client.go new file mode 100644 index 0000000..c8c79de --- /dev/null +++ b/client/apps/apps_client.go @@ -0,0 +1,141 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package apps + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new apps API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new apps API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new apps API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for apps API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AppCreate(params *AppCreateParams, opts ...ClientOption) (*AppCreateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + AppCreate registers a new application on this instance + + The registered application can be used to obtain an application token. + +This can then be used to register a new account, or (through user auth) obtain an access token. + +The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) AppCreate(params *AppCreateParams, opts ...ClientOption) (*AppCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAppCreateParams() + } + op := &runtime.ClientOperation{ + ID: "appCreate", + Method: "POST", + PathPattern: "/api/v1/apps", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AppCreateReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AppCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for appCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/blocks/blocks_client.go b/client/blocks/blocks_client.go new file mode 100644 index 0000000..0d16cf1 --- /dev/null +++ b/client/blocks/blocks_client.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package blocks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new blocks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new blocks API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new blocks API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for blocks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + BlocksGet(params *BlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BlocksGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + BlocksGet gets an array of accounts that requesting account has blocked + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) BlocksGet(params *BlocksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BlocksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewBlocksGetParams() + } + op := &runtime.ClientOperation{ + ID: "blocksGet", + Method: "GET", + PathPattern: "/api/v1/blocks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &BlocksGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*BlocksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for blocksGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/blocks/blocks_get_parameters.go b/client/blocks/blocks_get_parameters.go new file mode 100644 index 0000000..611fc61 --- /dev/null +++ b/client/blocks/blocks_get_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package blocks + +// 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" +) + +// NewBlocksGetParams creates a new BlocksGetParams 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 NewBlocksGetParams() *BlocksGetParams { + return &BlocksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewBlocksGetParamsWithTimeout creates a new BlocksGetParams object +// with the ability to set a timeout on a request. +func NewBlocksGetParamsWithTimeout(timeout time.Duration) *BlocksGetParams { + return &BlocksGetParams{ + timeout: timeout, + } +} + +// NewBlocksGetParamsWithContext creates a new BlocksGetParams object +// with the ability to set a context for a request. +func NewBlocksGetParamsWithContext(ctx context.Context) *BlocksGetParams { + return &BlocksGetParams{ + Context: ctx, + } +} + +// NewBlocksGetParamsWithHTTPClient creates a new BlocksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewBlocksGetParamsWithHTTPClient(client *http.Client) *BlocksGetParams { + return &BlocksGetParams{ + HTTPClient: client, + } +} + +/* +BlocksGetParams contains all the parameters to send to the API endpoint + + for the blocks get operation. + + Typically these are written to a http.Request. +*/ +type BlocksGetParams struct { + + /* Limit. + + Number of blocked accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only blocked accounts *OLDER* than the given max ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only blocked accounts *IMMEDIATELY NEWER* than the given min ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only blocked accounts *NEWER* than the given since ID. The blocked account with the specified ID will not be included in the response. NOTE: the ID is of the internal block, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BlocksGetParams) WithDefaults() *BlocksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the blocks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BlocksGetParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := BlocksGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the blocks get params +func (o *BlocksGetParams) WithTimeout(timeout time.Duration) *BlocksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the blocks get params +func (o *BlocksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the blocks get params +func (o *BlocksGetParams) WithContext(ctx context.Context) *BlocksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the blocks get params +func (o *BlocksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the blocks get params +func (o *BlocksGetParams) WithHTTPClient(client *http.Client) *BlocksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the blocks get params +func (o *BlocksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the blocks get params +func (o *BlocksGetParams) WithLimit(limit *int64) *BlocksGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the blocks get params +func (o *BlocksGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the blocks get params +func (o *BlocksGetParams) WithMaxID(maxID *string) *BlocksGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the blocks get params +func (o *BlocksGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the blocks get params +func (o *BlocksGetParams) WithMinID(minID *string) *BlocksGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the blocks get params +func (o *BlocksGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the blocks get params +func (o *BlocksGetParams) WithSinceID(sinceID *string) *BlocksGetParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the blocks get params +func (o *BlocksGetParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *BlocksGetParams) 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.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 +} diff --git a/client/blocks/blocks_get_responses.go b/client/blocks/blocks_get_responses.go new file mode 100644 index 0000000..03c5221 --- /dev/null +++ b/client/blocks/blocks_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package blocks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// BlocksGetReader is a Reader for the BlocksGet structure. +type BlocksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *BlocksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewBlocksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewBlocksGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewBlocksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewBlocksGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewBlocksGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewBlocksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/blocks] blocksGet", response, response.Code()) + } +} + +// NewBlocksGetOK creates a BlocksGetOK with default headers values +func NewBlocksGetOK() *BlocksGetOK { + return &BlocksGetOK{} +} + +/* +BlocksGetOK describes a response with status code 200, with default header values. + +BlocksGetOK blocks get o k +*/ +type BlocksGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this blocks get o k response has a 2xx status code +func (o *BlocksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this blocks get o k response has a 3xx status code +func (o *BlocksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get o k response has a 4xx status code +func (o *BlocksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this blocks get o k response has a 5xx status code +func (o *BlocksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get o k response a status code equal to that given +func (o *BlocksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the blocks get o k response +func (o *BlocksGetOK) Code() int { + return 200 +} + +func (o *BlocksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetOK %s", 200, payload) +} + +func (o *BlocksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetOK %s", 200, payload) +} + +func (o *BlocksGetOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *BlocksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewBlocksGetBadRequest creates a BlocksGetBadRequest with default headers values +func NewBlocksGetBadRequest() *BlocksGetBadRequest { + return &BlocksGetBadRequest{} +} + +/* +BlocksGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type BlocksGetBadRequest struct { +} + +// IsSuccess returns true when this blocks get bad request response has a 2xx status code +func (o *BlocksGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get bad request response has a 3xx status code +func (o *BlocksGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get bad request response has a 4xx status code +func (o *BlocksGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get bad request response has a 5xx status code +func (o *BlocksGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get bad request response a status code equal to that given +func (o *BlocksGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the blocks get bad request response +func (o *BlocksGetBadRequest) Code() int { + return 400 +} + +func (o *BlocksGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetBadRequest", 400) +} + +func (o *BlocksGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetBadRequest", 400) +} + +func (o *BlocksGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetUnauthorized creates a BlocksGetUnauthorized with default headers values +func NewBlocksGetUnauthorized() *BlocksGetUnauthorized { + return &BlocksGetUnauthorized{} +} + +/* +BlocksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type BlocksGetUnauthorized struct { +} + +// IsSuccess returns true when this blocks get unauthorized response has a 2xx status code +func (o *BlocksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get unauthorized response has a 3xx status code +func (o *BlocksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get unauthorized response has a 4xx status code +func (o *BlocksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get unauthorized response has a 5xx status code +func (o *BlocksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get unauthorized response a status code equal to that given +func (o *BlocksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the blocks get unauthorized response +func (o *BlocksGetUnauthorized) Code() int { + return 401 +} + +func (o *BlocksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetUnauthorized", 401) +} + +func (o *BlocksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetUnauthorized", 401) +} + +func (o *BlocksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetNotFound creates a BlocksGetNotFound with default headers values +func NewBlocksGetNotFound() *BlocksGetNotFound { + return &BlocksGetNotFound{} +} + +/* +BlocksGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type BlocksGetNotFound struct { +} + +// IsSuccess returns true when this blocks get not found response has a 2xx status code +func (o *BlocksGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get not found response has a 3xx status code +func (o *BlocksGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get not found response has a 4xx status code +func (o *BlocksGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get not found response has a 5xx status code +func (o *BlocksGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get not found response a status code equal to that given +func (o *BlocksGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the blocks get not found response +func (o *BlocksGetNotFound) Code() int { + return 404 +} + +func (o *BlocksGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotFound", 404) +} + +func (o *BlocksGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotFound", 404) +} + +func (o *BlocksGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetNotAcceptable creates a BlocksGetNotAcceptable with default headers values +func NewBlocksGetNotAcceptable() *BlocksGetNotAcceptable { + return &BlocksGetNotAcceptable{} +} + +/* +BlocksGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type BlocksGetNotAcceptable struct { +} + +// IsSuccess returns true when this blocks get not acceptable response has a 2xx status code +func (o *BlocksGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get not acceptable response has a 3xx status code +func (o *BlocksGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get not acceptable response has a 4xx status code +func (o *BlocksGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this blocks get not acceptable response has a 5xx status code +func (o *BlocksGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this blocks get not acceptable response a status code equal to that given +func (o *BlocksGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the blocks get not acceptable response +func (o *BlocksGetNotAcceptable) Code() int { + return 406 +} + +func (o *BlocksGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotAcceptable", 406) +} + +func (o *BlocksGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetNotAcceptable", 406) +} + +func (o *BlocksGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBlocksGetInternalServerError creates a BlocksGetInternalServerError with default headers values +func NewBlocksGetInternalServerError() *BlocksGetInternalServerError { + return &BlocksGetInternalServerError{} +} + +/* +BlocksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type BlocksGetInternalServerError struct { +} + +// IsSuccess returns true when this blocks get internal server error response has a 2xx status code +func (o *BlocksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this blocks get internal server error response has a 3xx status code +func (o *BlocksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this blocks get internal server error response has a 4xx status code +func (o *BlocksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this blocks get internal server error response has a 5xx status code +func (o *BlocksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this blocks get internal server error response a status code equal to that given +func (o *BlocksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the blocks get internal server error response +func (o *BlocksGetInternalServerError) Code() int { + return 500 +} + +func (o *BlocksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetInternalServerError", 500) +} + +func (o *BlocksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/blocks][%d] blocksGetInternalServerError", 500) +} + +func (o *BlocksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/bookmarks/bookmarks_client.go b/client/bookmarks/bookmarks_client.go new file mode 100644 index 0000000..e6535d8 --- /dev/null +++ b/client/bookmarks/bookmarks_client.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bookmarks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new bookmarks API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new bookmarks API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new bookmarks API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for bookmarks API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + BookmarksGet(params *BookmarksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BookmarksGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +BookmarksGet Get an array of statuses bookmarked in the instance +*/ +func (a *Client) BookmarksGet(params *BookmarksGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*BookmarksGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewBookmarksGetParams() + } + op := &runtime.ClientOperation{ + ID: "bookmarksGet", + Method: "GET", + PathPattern: "/api/v1/bookmarks", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &BookmarksGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*BookmarksGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for bookmarksGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/bookmarks/bookmarks_get_parameters.go b/client/bookmarks/bookmarks_get_parameters.go new file mode 100644 index 0000000..5d83307 --- /dev/null +++ b/client/bookmarks/bookmarks_get_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bookmarks + +// 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" +) + +// NewBookmarksGetParams creates a new BookmarksGetParams 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 NewBookmarksGetParams() *BookmarksGetParams { + return &BookmarksGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewBookmarksGetParamsWithTimeout creates a new BookmarksGetParams object +// with the ability to set a timeout on a request. +func NewBookmarksGetParamsWithTimeout(timeout time.Duration) *BookmarksGetParams { + return &BookmarksGetParams{ + timeout: timeout, + } +} + +// NewBookmarksGetParamsWithContext creates a new BookmarksGetParams object +// with the ability to set a context for a request. +func NewBookmarksGetParamsWithContext(ctx context.Context) *BookmarksGetParams { + return &BookmarksGetParams{ + Context: ctx, + } +} + +// NewBookmarksGetParamsWithHTTPClient creates a new BookmarksGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewBookmarksGetParamsWithHTTPClient(client *http.Client) *BookmarksGetParams { + return &BookmarksGetParams{ + HTTPClient: client, + } +} + +/* +BookmarksGetParams contains all the parameters to send to the API endpoint + + for the bookmarks get operation. + + Typically these are written to a http.Request. +*/ +type BookmarksGetParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 30 + */ + Limit *int64 + + /* MaxID. + + Return only bookmarked statuses *OLDER* than the given bookmark ID. The status with the corresponding bookmark ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only bookmarked statuses *NEWER* than the given bookmark ID. The status with the corresponding bookmark ID will not be included in the response. + */ + MinID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the bookmarks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BookmarksGetParams) WithDefaults() *BookmarksGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the bookmarks get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *BookmarksGetParams) SetDefaults() { + var ( + limitDefault = int64(30) + ) + + val := BookmarksGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the bookmarks get params +func (o *BookmarksGetParams) WithTimeout(timeout time.Duration) *BookmarksGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the bookmarks get params +func (o *BookmarksGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the bookmarks get params +func (o *BookmarksGetParams) WithContext(ctx context.Context) *BookmarksGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the bookmarks get params +func (o *BookmarksGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the bookmarks get params +func (o *BookmarksGetParams) WithHTTPClient(client *http.Client) *BookmarksGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the bookmarks get params +func (o *BookmarksGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the bookmarks get params +func (o *BookmarksGetParams) WithLimit(limit *int64) *BookmarksGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the bookmarks get params +func (o *BookmarksGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the bookmarks get params +func (o *BookmarksGetParams) WithMaxID(maxID *string) *BookmarksGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the bookmarks get params +func (o *BookmarksGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the bookmarks get params +func (o *BookmarksGetParams) WithMinID(minID *string) *BookmarksGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the bookmarks get params +func (o *BookmarksGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WriteToRequest writes these params to a swagger request +func (o *BookmarksGetParams) 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.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 len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/bookmarks/bookmarks_get_responses.go b/client/bookmarks/bookmarks_get_responses.go new file mode 100644 index 0000000..312db02 --- /dev/null +++ b/client/bookmarks/bookmarks_get_responses.go @@ -0,0 +1,302 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package bookmarks + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// BookmarksGetReader is a Reader for the BookmarksGet structure. +type BookmarksGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *BookmarksGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewBookmarksGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewBookmarksGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewBookmarksGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewBookmarksGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/bookmarks] bookmarksGet", response, response.Code()) + } +} + +// NewBookmarksGetOK creates a BookmarksGetOK with default headers values +func NewBookmarksGetOK() *BookmarksGetOK { + return &BookmarksGetOK{} +} + +/* +BookmarksGetOK describes a response with status code 200, with default header values. + +Array of bookmarked statuses +*/ +type BookmarksGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this bookmarks get o k response has a 2xx status code +func (o *BookmarksGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this bookmarks get o k response has a 3xx status code +func (o *BookmarksGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get o k response has a 4xx status code +func (o *BookmarksGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this bookmarks get o k response has a 5xx status code +func (o *BookmarksGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this bookmarks get o k response a status code equal to that given +func (o *BookmarksGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the bookmarks get o k response +func (o *BookmarksGetOK) Code() int { + return 200 +} + +func (o *BookmarksGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetOK %s", 200, payload) +} + +func (o *BookmarksGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetOK %s", 200, payload) +} + +func (o *BookmarksGetOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *BookmarksGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewBookmarksGetUnauthorized creates a BookmarksGetUnauthorized with default headers values +func NewBookmarksGetUnauthorized() *BookmarksGetUnauthorized { + return &BookmarksGetUnauthorized{} +} + +/* +BookmarksGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type BookmarksGetUnauthorized struct { +} + +// IsSuccess returns true when this bookmarks get unauthorized response has a 2xx status code +func (o *BookmarksGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this bookmarks get unauthorized response has a 3xx status code +func (o *BookmarksGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get unauthorized response has a 4xx status code +func (o *BookmarksGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this bookmarks get unauthorized response has a 5xx status code +func (o *BookmarksGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this bookmarks get unauthorized response a status code equal to that given +func (o *BookmarksGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the bookmarks get unauthorized response +func (o *BookmarksGetUnauthorized) Code() int { + return 401 +} + +func (o *BookmarksGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetUnauthorized", 401) +} + +func (o *BookmarksGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetUnauthorized", 401) +} + +func (o *BookmarksGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBookmarksGetNotAcceptable creates a BookmarksGetNotAcceptable with default headers values +func NewBookmarksGetNotAcceptable() *BookmarksGetNotAcceptable { + return &BookmarksGetNotAcceptable{} +} + +/* +BookmarksGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type BookmarksGetNotAcceptable struct { +} + +// IsSuccess returns true when this bookmarks get not acceptable response has a 2xx status code +func (o *BookmarksGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this bookmarks get not acceptable response has a 3xx status code +func (o *BookmarksGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get not acceptable response has a 4xx status code +func (o *BookmarksGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this bookmarks get not acceptable response has a 5xx status code +func (o *BookmarksGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this bookmarks get not acceptable response a status code equal to that given +func (o *BookmarksGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the bookmarks get not acceptable response +func (o *BookmarksGetNotAcceptable) Code() int { + return 406 +} + +func (o *BookmarksGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetNotAcceptable", 406) +} + +func (o *BookmarksGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetNotAcceptable", 406) +} + +func (o *BookmarksGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewBookmarksGetInternalServerError creates a BookmarksGetInternalServerError with default headers values +func NewBookmarksGetInternalServerError() *BookmarksGetInternalServerError { + return &BookmarksGetInternalServerError{} +} + +/* +BookmarksGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type BookmarksGetInternalServerError struct { +} + +// IsSuccess returns true when this bookmarks get internal server error response has a 2xx status code +func (o *BookmarksGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this bookmarks get internal server error response has a 3xx status code +func (o *BookmarksGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this bookmarks get internal server error response has a 4xx status code +func (o *BookmarksGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this bookmarks get internal server error response has a 5xx status code +func (o *BookmarksGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this bookmarks get internal server error response a status code equal to that given +func (o *BookmarksGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the bookmarks get internal server error response +func (o *BookmarksGetInternalServerError) Code() int { + return 500 +} + +func (o *BookmarksGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetInternalServerError", 500) +} + +func (o *BookmarksGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/bookmarks][%d] bookmarksGetInternalServerError", 500) +} + +func (o *BookmarksGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/conversations/conversation_delete_parameters.go b/client/conversations/conversation_delete_parameters.go new file mode 100644 index 0000000..7b8c85f --- /dev/null +++ b/client/conversations/conversation_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" +) + +// NewConversationDeleteParams creates a new ConversationDeleteParams 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 NewConversationDeleteParams() *ConversationDeleteParams { + return &ConversationDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewConversationDeleteParamsWithTimeout creates a new ConversationDeleteParams object +// with the ability to set a timeout on a request. +func NewConversationDeleteParamsWithTimeout(timeout time.Duration) *ConversationDeleteParams { + return &ConversationDeleteParams{ + timeout: timeout, + } +} + +// NewConversationDeleteParamsWithContext creates a new ConversationDeleteParams object +// with the ability to set a context for a request. +func NewConversationDeleteParamsWithContext(ctx context.Context) *ConversationDeleteParams { + return &ConversationDeleteParams{ + Context: ctx, + } +} + +// NewConversationDeleteParamsWithHTTPClient creates a new ConversationDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewConversationDeleteParamsWithHTTPClient(client *http.Client) *ConversationDeleteParams { + return &ConversationDeleteParams{ + HTTPClient: client, + } +} + +/* +ConversationDeleteParams contains all the parameters to send to the API endpoint + + for the conversation delete operation. + + Typically these are written to a http.Request. +*/ +type ConversationDeleteParams struct { + + /* ID. + + ID of the conversation + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the conversation delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationDeleteParams) WithDefaults() *ConversationDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the conversation delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the conversation delete params +func (o *ConversationDeleteParams) WithTimeout(timeout time.Duration) *ConversationDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the conversation delete params +func (o *ConversationDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the conversation delete params +func (o *ConversationDeleteParams) WithContext(ctx context.Context) *ConversationDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the conversation delete params +func (o *ConversationDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the conversation delete params +func (o *ConversationDeleteParams) WithHTTPClient(client *http.Client) *ConversationDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the conversation delete params +func (o *ConversationDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the conversation delete params +func (o *ConversationDeleteParams) WithID(id string) *ConversationDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the conversation delete params +func (o *ConversationDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ConversationDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/conversations/conversation_delete_responses.go b/client/conversations/conversation_delete_responses.go new file mode 100644 index 0000000..091123b --- /dev/null +++ b/client/conversations/conversation_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// ConversationDeleteReader is a Reader for the ConversationDelete structure. +type ConversationDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConversationDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConversationDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewConversationDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewConversationDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewConversationDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewConversationDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewConversationDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/conversations/{id}] conversationDelete", response, response.Code()) + } +} + +// NewConversationDeleteOK creates a ConversationDeleteOK with default headers values +func NewConversationDeleteOK() *ConversationDeleteOK { + return &ConversationDeleteOK{} +} + +/* +ConversationDeleteOK describes a response with status code 200, with default header values. + +conversation deleted +*/ +type ConversationDeleteOK struct { +} + +// IsSuccess returns true when this conversation delete o k response has a 2xx status code +func (o *ConversationDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this conversation delete o k response has a 3xx status code +func (o *ConversationDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete o k response has a 4xx status code +func (o *ConversationDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation delete o k response has a 5xx status code +func (o *ConversationDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete o k response a status code equal to that given +func (o *ConversationDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the conversation delete o k response +func (o *ConversationDeleteOK) Code() int { + return 200 +} + +func (o *ConversationDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteOK", 200) +} + +func (o *ConversationDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteOK", 200) +} + +func (o *ConversationDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteBadRequest creates a ConversationDeleteBadRequest with default headers values +func NewConversationDeleteBadRequest() *ConversationDeleteBadRequest { + return &ConversationDeleteBadRequest{} +} + +/* +ConversationDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ConversationDeleteBadRequest struct { +} + +// IsSuccess returns true when this conversation delete bad request response has a 2xx status code +func (o *ConversationDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete bad request response has a 3xx status code +func (o *ConversationDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete bad request response has a 4xx status code +func (o *ConversationDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete bad request response has a 5xx status code +func (o *ConversationDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete bad request response a status code equal to that given +func (o *ConversationDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the conversation delete bad request response +func (o *ConversationDeleteBadRequest) Code() int { + return 400 +} + +func (o *ConversationDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteBadRequest", 400) +} + +func (o *ConversationDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteBadRequest", 400) +} + +func (o *ConversationDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteUnauthorized creates a ConversationDeleteUnauthorized with default headers values +func NewConversationDeleteUnauthorized() *ConversationDeleteUnauthorized { + return &ConversationDeleteUnauthorized{} +} + +/* +ConversationDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ConversationDeleteUnauthorized struct { +} + +// IsSuccess returns true when this conversation delete unauthorized response has a 2xx status code +func (o *ConversationDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete unauthorized response has a 3xx status code +func (o *ConversationDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete unauthorized response has a 4xx status code +func (o *ConversationDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete unauthorized response has a 5xx status code +func (o *ConversationDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete unauthorized response a status code equal to that given +func (o *ConversationDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the conversation delete unauthorized response +func (o *ConversationDeleteUnauthorized) Code() int { + return 401 +} + +func (o *ConversationDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteUnauthorized", 401) +} + +func (o *ConversationDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteUnauthorized", 401) +} + +func (o *ConversationDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteNotFound creates a ConversationDeleteNotFound with default headers values +func NewConversationDeleteNotFound() *ConversationDeleteNotFound { + return &ConversationDeleteNotFound{} +} + +/* +ConversationDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ConversationDeleteNotFound struct { +} + +// IsSuccess returns true when this conversation delete not found response has a 2xx status code +func (o *ConversationDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete not found response has a 3xx status code +func (o *ConversationDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete not found response has a 4xx status code +func (o *ConversationDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete not found response has a 5xx status code +func (o *ConversationDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete not found response a status code equal to that given +func (o *ConversationDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the conversation delete not found response +func (o *ConversationDeleteNotFound) Code() int { + return 404 +} + +func (o *ConversationDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotFound", 404) +} + +func (o *ConversationDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotFound", 404) +} + +func (o *ConversationDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteNotAcceptable creates a ConversationDeleteNotAcceptable with default headers values +func NewConversationDeleteNotAcceptable() *ConversationDeleteNotAcceptable { + return &ConversationDeleteNotAcceptable{} +} + +/* +ConversationDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ConversationDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this conversation delete not acceptable response has a 2xx status code +func (o *ConversationDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete not acceptable response has a 3xx status code +func (o *ConversationDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete not acceptable response has a 4xx status code +func (o *ConversationDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation delete not acceptable response has a 5xx status code +func (o *ConversationDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation delete not acceptable response a status code equal to that given +func (o *ConversationDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the conversation delete not acceptable response +func (o *ConversationDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *ConversationDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotAcceptable", 406) +} + +func (o *ConversationDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteNotAcceptable", 406) +} + +func (o *ConversationDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationDeleteInternalServerError creates a ConversationDeleteInternalServerError with default headers values +func NewConversationDeleteInternalServerError() *ConversationDeleteInternalServerError { + return &ConversationDeleteInternalServerError{} +} + +/* +ConversationDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ConversationDeleteInternalServerError struct { +} + +// IsSuccess returns true when this conversation delete internal server error response has a 2xx status code +func (o *ConversationDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation delete internal server error response has a 3xx status code +func (o *ConversationDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation delete internal server error response has a 4xx status code +func (o *ConversationDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation delete internal server error response has a 5xx status code +func (o *ConversationDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this conversation delete internal server error response a status code equal to that given +func (o *ConversationDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the conversation delete internal server error response +func (o *ConversationDeleteInternalServerError) Code() int { + return 500 +} + +func (o *ConversationDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteInternalServerError", 500) +} + +func (o *ConversationDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/conversations/{id}][%d] conversationDeleteInternalServerError", 500) +} + +func (o *ConversationDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/conversations/conversation_read_parameters.go b/client/conversations/conversation_read_parameters.go new file mode 100644 index 0000000..15611a5 --- /dev/null +++ b/client/conversations/conversation_read_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" +) + +// NewConversationReadParams creates a new ConversationReadParams 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 NewConversationReadParams() *ConversationReadParams { + return &ConversationReadParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewConversationReadParamsWithTimeout creates a new ConversationReadParams object +// with the ability to set a timeout on a request. +func NewConversationReadParamsWithTimeout(timeout time.Duration) *ConversationReadParams { + return &ConversationReadParams{ + timeout: timeout, + } +} + +// NewConversationReadParamsWithContext creates a new ConversationReadParams object +// with the ability to set a context for a request. +func NewConversationReadParamsWithContext(ctx context.Context) *ConversationReadParams { + return &ConversationReadParams{ + Context: ctx, + } +} + +// NewConversationReadParamsWithHTTPClient creates a new ConversationReadParams object +// with the ability to set a custom HTTPClient for a request. +func NewConversationReadParamsWithHTTPClient(client *http.Client) *ConversationReadParams { + return &ConversationReadParams{ + HTTPClient: client, + } +} + +/* +ConversationReadParams contains all the parameters to send to the API endpoint + + for the conversation read operation. + + Typically these are written to a http.Request. +*/ +type ConversationReadParams struct { + + /* ID. + + ID of the conversation. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the conversation read params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationReadParams) WithDefaults() *ConversationReadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the conversation read params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationReadParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the conversation read params +func (o *ConversationReadParams) WithTimeout(timeout time.Duration) *ConversationReadParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the conversation read params +func (o *ConversationReadParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the conversation read params +func (o *ConversationReadParams) WithContext(ctx context.Context) *ConversationReadParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the conversation read params +func (o *ConversationReadParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the conversation read params +func (o *ConversationReadParams) WithHTTPClient(client *http.Client) *ConversationReadParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the conversation read params +func (o *ConversationReadParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the conversation read params +func (o *ConversationReadParams) WithID(id string) *ConversationReadParams { + o.SetID(id) + return o +} + +// SetID adds the id to the conversation read params +func (o *ConversationReadParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ConversationReadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/conversations/conversation_read_responses.go b/client/conversations/conversation_read_responses.go new file mode 100644 index 0000000..b6a7607 --- /dev/null +++ b/client/conversations/conversation_read_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ConversationReadReader is a Reader for the ConversationRead structure. +type ConversationReadReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConversationReadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConversationReadOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewConversationReadBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewConversationReadUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewConversationReadNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewConversationReadNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewConversationReadUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewConversationReadInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/conversation/{id}/read] conversationRead", response, response.Code()) + } +} + +// NewConversationReadOK creates a ConversationReadOK with default headers values +func NewConversationReadOK() *ConversationReadOK { + return &ConversationReadOK{} +} + +/* +ConversationReadOK describes a response with status code 200, with default header values. + +Updated conversation. +*/ +type ConversationReadOK struct { + Payload *models.Conversation +} + +// IsSuccess returns true when this conversation read o k response has a 2xx status code +func (o *ConversationReadOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this conversation read o k response has a 3xx status code +func (o *ConversationReadOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read o k response has a 4xx status code +func (o *ConversationReadOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation read o k response has a 5xx status code +func (o *ConversationReadOK) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read o k response a status code equal to that given +func (o *ConversationReadOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the conversation read o k response +func (o *ConversationReadOK) Code() int { + return 200 +} + +func (o *ConversationReadOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadOK %s", 200, payload) +} + +func (o *ConversationReadOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadOK %s", 200, payload) +} + +func (o *ConversationReadOK) GetPayload() *models.Conversation { + return o.Payload +} + +func (o *ConversationReadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Conversation) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConversationReadBadRequest creates a ConversationReadBadRequest with default headers values +func NewConversationReadBadRequest() *ConversationReadBadRequest { + return &ConversationReadBadRequest{} +} + +/* +ConversationReadBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ConversationReadBadRequest struct { +} + +// IsSuccess returns true when this conversation read bad request response has a 2xx status code +func (o *ConversationReadBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read bad request response has a 3xx status code +func (o *ConversationReadBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read bad request response has a 4xx status code +func (o *ConversationReadBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read bad request response has a 5xx status code +func (o *ConversationReadBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read bad request response a status code equal to that given +func (o *ConversationReadBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the conversation read bad request response +func (o *ConversationReadBadRequest) Code() int { + return 400 +} + +func (o *ConversationReadBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadBadRequest", 400) +} + +func (o *ConversationReadBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadBadRequest", 400) +} + +func (o *ConversationReadBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadUnauthorized creates a ConversationReadUnauthorized with default headers values +func NewConversationReadUnauthorized() *ConversationReadUnauthorized { + return &ConversationReadUnauthorized{} +} + +/* +ConversationReadUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ConversationReadUnauthorized struct { +} + +// IsSuccess returns true when this conversation read unauthorized response has a 2xx status code +func (o *ConversationReadUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read unauthorized response has a 3xx status code +func (o *ConversationReadUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read unauthorized response has a 4xx status code +func (o *ConversationReadUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read unauthorized response has a 5xx status code +func (o *ConversationReadUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read unauthorized response a status code equal to that given +func (o *ConversationReadUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the conversation read unauthorized response +func (o *ConversationReadUnauthorized) Code() int { + return 401 +} + +func (o *ConversationReadUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnauthorized", 401) +} + +func (o *ConversationReadUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnauthorized", 401) +} + +func (o *ConversationReadUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadNotFound creates a ConversationReadNotFound with default headers values +func NewConversationReadNotFound() *ConversationReadNotFound { + return &ConversationReadNotFound{} +} + +/* +ConversationReadNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ConversationReadNotFound struct { +} + +// IsSuccess returns true when this conversation read not found response has a 2xx status code +func (o *ConversationReadNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read not found response has a 3xx status code +func (o *ConversationReadNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read not found response has a 4xx status code +func (o *ConversationReadNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read not found response has a 5xx status code +func (o *ConversationReadNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read not found response a status code equal to that given +func (o *ConversationReadNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the conversation read not found response +func (o *ConversationReadNotFound) Code() int { + return 404 +} + +func (o *ConversationReadNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotFound", 404) +} + +func (o *ConversationReadNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotFound", 404) +} + +func (o *ConversationReadNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadNotAcceptable creates a ConversationReadNotAcceptable with default headers values +func NewConversationReadNotAcceptable() *ConversationReadNotAcceptable { + return &ConversationReadNotAcceptable{} +} + +/* +ConversationReadNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ConversationReadNotAcceptable struct { +} + +// IsSuccess returns true when this conversation read not acceptable response has a 2xx status code +func (o *ConversationReadNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read not acceptable response has a 3xx status code +func (o *ConversationReadNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read not acceptable response has a 4xx status code +func (o *ConversationReadNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read not acceptable response has a 5xx status code +func (o *ConversationReadNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read not acceptable response a status code equal to that given +func (o *ConversationReadNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the conversation read not acceptable response +func (o *ConversationReadNotAcceptable) Code() int { + return 406 +} + +func (o *ConversationReadNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotAcceptable", 406) +} + +func (o *ConversationReadNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadNotAcceptable", 406) +} + +func (o *ConversationReadNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadUnprocessableEntity creates a ConversationReadUnprocessableEntity with default headers values +func NewConversationReadUnprocessableEntity() *ConversationReadUnprocessableEntity { + return &ConversationReadUnprocessableEntity{} +} + +/* +ConversationReadUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type ConversationReadUnprocessableEntity struct { +} + +// IsSuccess returns true when this conversation read unprocessable entity response has a 2xx status code +func (o *ConversationReadUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read unprocessable entity response has a 3xx status code +func (o *ConversationReadUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read unprocessable entity response has a 4xx status code +func (o *ConversationReadUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversation read unprocessable entity response has a 5xx status code +func (o *ConversationReadUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this conversation read unprocessable entity response a status code equal to that given +func (o *ConversationReadUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the conversation read unprocessable entity response +func (o *ConversationReadUnprocessableEntity) Code() int { + return 422 +} + +func (o *ConversationReadUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnprocessableEntity", 422) +} + +func (o *ConversationReadUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadUnprocessableEntity", 422) +} + +func (o *ConversationReadUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationReadInternalServerError creates a ConversationReadInternalServerError with default headers values +func NewConversationReadInternalServerError() *ConversationReadInternalServerError { + return &ConversationReadInternalServerError{} +} + +/* +ConversationReadInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ConversationReadInternalServerError struct { +} + +// IsSuccess returns true when this conversation read internal server error response has a 2xx status code +func (o *ConversationReadInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversation read internal server error response has a 3xx status code +func (o *ConversationReadInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversation read internal server error response has a 4xx status code +func (o *ConversationReadInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversation read internal server error response has a 5xx status code +func (o *ConversationReadInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this conversation read internal server error response a status code equal to that given +func (o *ConversationReadInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the conversation read internal server error response +func (o *ConversationReadInternalServerError) Code() int { + return 500 +} + +func (o *ConversationReadInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadInternalServerError", 500) +} + +func (o *ConversationReadInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/conversation/{id}/read][%d] conversationReadInternalServerError", 500) +} + +func (o *ConversationReadInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/conversations/conversations_client.go b/client/conversations/conversations_client.go new file mode 100644 index 0000000..03b2945 --- /dev/null +++ b/client/conversations/conversations_client.go @@ -0,0 +1,200 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new conversations API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new conversations API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new conversations API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for conversations API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ConversationDelete(params *ConversationDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationDeleteOK, error) + + ConversationRead(params *ConversationReadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationReadOK, error) + + ConversationsGet(params *ConversationsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationsGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + ConversationDelete deletes a single conversation with the given ID + + This doesn't delete the actual statuses in the conversation, + +nor does it prevent a new conversation from being created later from the same thread and participants. +*/ +func (a *Client) ConversationDelete(params *ConversationDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewConversationDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "conversationDelete", + Method: "DELETE", + PathPattern: "/api/v1/conversations/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ConversationDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ConversationDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for conversationDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ConversationRead marks a conversation with the given ID as read +*/ +func (a *Client) ConversationRead(params *ConversationReadParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationReadOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewConversationReadParams() + } + op := &runtime.ClientOperation{ + ID: "conversationRead", + Method: "POST", + PathPattern: "/api/v1/conversation/{id}/read", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ConversationReadReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ConversationReadOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for conversationRead: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ConversationsGet gets an array of direct message conversations that requesting account is involved in + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) ConversationsGet(params *ConversationsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ConversationsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewConversationsGetParams() + } + op := &runtime.ClientOperation{ + ID: "conversationsGet", + Method: "GET", + PathPattern: "/api/v1/conversations", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ConversationsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ConversationsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for conversationsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/conversations/conversations_get_parameters.go b/client/conversations/conversations_get_parameters.go new file mode 100644 index 0000000..06ad6a2 --- /dev/null +++ b/client/conversations/conversations_get_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// 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" +) + +// NewConversationsGetParams creates a new ConversationsGetParams 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 NewConversationsGetParams() *ConversationsGetParams { + return &ConversationsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewConversationsGetParamsWithTimeout creates a new ConversationsGetParams object +// with the ability to set a timeout on a request. +func NewConversationsGetParamsWithTimeout(timeout time.Duration) *ConversationsGetParams { + return &ConversationsGetParams{ + timeout: timeout, + } +} + +// NewConversationsGetParamsWithContext creates a new ConversationsGetParams object +// with the ability to set a context for a request. +func NewConversationsGetParamsWithContext(ctx context.Context) *ConversationsGetParams { + return &ConversationsGetParams{ + Context: ctx, + } +} + +// NewConversationsGetParamsWithHTTPClient creates a new ConversationsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewConversationsGetParamsWithHTTPClient(client *http.Client) *ConversationsGetParams { + return &ConversationsGetParams{ + HTTPClient: client, + } +} + +/* +ConversationsGetParams contains all the parameters to send to the API endpoint + + for the conversations get operation. + + Typically these are written to a http.Request. +*/ +type ConversationsGetParams struct { + + /* Limit. + + Number of conversations to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only conversations with last statuses *OLDER* than the given max ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination. + */ + MaxID *string + + /* MinID. + + Return only conversations with last statuses *IMMEDIATELY NEWER* than the given min ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination. + */ + MinID *string + + /* SinceID. + + Return only conversations with last statuses *NEWER* than the given since ID. The conversation with the specified ID will not be included in the response. NOTE: The ID is a status ID. Use the Link header for pagination. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the conversations get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationsGetParams) WithDefaults() *ConversationsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the conversations get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ConversationsGetParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := ConversationsGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the conversations get params +func (o *ConversationsGetParams) WithTimeout(timeout time.Duration) *ConversationsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the conversations get params +func (o *ConversationsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the conversations get params +func (o *ConversationsGetParams) WithContext(ctx context.Context) *ConversationsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the conversations get params +func (o *ConversationsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the conversations get params +func (o *ConversationsGetParams) WithHTTPClient(client *http.Client) *ConversationsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the conversations get params +func (o *ConversationsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the conversations get params +func (o *ConversationsGetParams) WithLimit(limit *int64) *ConversationsGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the conversations get params +func (o *ConversationsGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the conversations get params +func (o *ConversationsGetParams) WithMaxID(maxID *string) *ConversationsGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the conversations get params +func (o *ConversationsGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the conversations get params +func (o *ConversationsGetParams) WithMinID(minID *string) *ConversationsGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the conversations get params +func (o *ConversationsGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the conversations get params +func (o *ConversationsGetParams) WithSinceID(sinceID *string) *ConversationsGetParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the conversations get params +func (o *ConversationsGetParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ConversationsGetParams) 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.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 +} diff --git a/client/conversations/conversations_get_responses.go b/client/conversations/conversations_get_responses.go new file mode 100644 index 0000000..cfbb1fe --- /dev/null +++ b/client/conversations/conversations_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package conversations + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ConversationsGetReader is a Reader for the ConversationsGet structure. +type ConversationsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ConversationsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewConversationsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewConversationsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewConversationsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewConversationsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewConversationsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewConversationsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/conversations] conversationsGet", response, response.Code()) + } +} + +// NewConversationsGetOK creates a ConversationsGetOK with default headers values +func NewConversationsGetOK() *ConversationsGetOK { + return &ConversationsGetOK{} +} + +/* +ConversationsGetOK describes a response with status code 200, with default header values. + +ConversationsGetOK conversations get o k +*/ +type ConversationsGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Conversation +} + +// IsSuccess returns true when this conversations get o k response has a 2xx status code +func (o *ConversationsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this conversations get o k response has a 3xx status code +func (o *ConversationsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get o k response has a 4xx status code +func (o *ConversationsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversations get o k response has a 5xx status code +func (o *ConversationsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get o k response a status code equal to that given +func (o *ConversationsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the conversations get o k response +func (o *ConversationsGetOK) Code() int { + return 200 +} + +func (o *ConversationsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetOK %s", 200, payload) +} + +func (o *ConversationsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetOK %s", 200, payload) +} + +func (o *ConversationsGetOK) GetPayload() []*models.Conversation { + return o.Payload +} + +func (o *ConversationsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewConversationsGetBadRequest creates a ConversationsGetBadRequest with default headers values +func NewConversationsGetBadRequest() *ConversationsGetBadRequest { + return &ConversationsGetBadRequest{} +} + +/* +ConversationsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ConversationsGetBadRequest struct { +} + +// IsSuccess returns true when this conversations get bad request response has a 2xx status code +func (o *ConversationsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get bad request response has a 3xx status code +func (o *ConversationsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get bad request response has a 4xx status code +func (o *ConversationsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get bad request response has a 5xx status code +func (o *ConversationsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get bad request response a status code equal to that given +func (o *ConversationsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the conversations get bad request response +func (o *ConversationsGetBadRequest) Code() int { + return 400 +} + +func (o *ConversationsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetBadRequest", 400) +} + +func (o *ConversationsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetBadRequest", 400) +} + +func (o *ConversationsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetUnauthorized creates a ConversationsGetUnauthorized with default headers values +func NewConversationsGetUnauthorized() *ConversationsGetUnauthorized { + return &ConversationsGetUnauthorized{} +} + +/* +ConversationsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ConversationsGetUnauthorized struct { +} + +// IsSuccess returns true when this conversations get unauthorized response has a 2xx status code +func (o *ConversationsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get unauthorized response has a 3xx status code +func (o *ConversationsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get unauthorized response has a 4xx status code +func (o *ConversationsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get unauthorized response has a 5xx status code +func (o *ConversationsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get unauthorized response a status code equal to that given +func (o *ConversationsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the conversations get unauthorized response +func (o *ConversationsGetUnauthorized) Code() int { + return 401 +} + +func (o *ConversationsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetUnauthorized", 401) +} + +func (o *ConversationsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetUnauthorized", 401) +} + +func (o *ConversationsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetNotFound creates a ConversationsGetNotFound with default headers values +func NewConversationsGetNotFound() *ConversationsGetNotFound { + return &ConversationsGetNotFound{} +} + +/* +ConversationsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ConversationsGetNotFound struct { +} + +// IsSuccess returns true when this conversations get not found response has a 2xx status code +func (o *ConversationsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get not found response has a 3xx status code +func (o *ConversationsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get not found response has a 4xx status code +func (o *ConversationsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get not found response has a 5xx status code +func (o *ConversationsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get not found response a status code equal to that given +func (o *ConversationsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the conversations get not found response +func (o *ConversationsGetNotFound) Code() int { + return 404 +} + +func (o *ConversationsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotFound", 404) +} + +func (o *ConversationsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotFound", 404) +} + +func (o *ConversationsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetNotAcceptable creates a ConversationsGetNotAcceptable with default headers values +func NewConversationsGetNotAcceptable() *ConversationsGetNotAcceptable { + return &ConversationsGetNotAcceptable{} +} + +/* +ConversationsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ConversationsGetNotAcceptable struct { +} + +// IsSuccess returns true when this conversations get not acceptable response has a 2xx status code +func (o *ConversationsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get not acceptable response has a 3xx status code +func (o *ConversationsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get not acceptable response has a 4xx status code +func (o *ConversationsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this conversations get not acceptable response has a 5xx status code +func (o *ConversationsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this conversations get not acceptable response a status code equal to that given +func (o *ConversationsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the conversations get not acceptable response +func (o *ConversationsGetNotAcceptable) Code() int { + return 406 +} + +func (o *ConversationsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotAcceptable", 406) +} + +func (o *ConversationsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetNotAcceptable", 406) +} + +func (o *ConversationsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewConversationsGetInternalServerError creates a ConversationsGetInternalServerError with default headers values +func NewConversationsGetInternalServerError() *ConversationsGetInternalServerError { + return &ConversationsGetInternalServerError{} +} + +/* +ConversationsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ConversationsGetInternalServerError struct { +} + +// IsSuccess returns true when this conversations get internal server error response has a 2xx status code +func (o *ConversationsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this conversations get internal server error response has a 3xx status code +func (o *ConversationsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this conversations get internal server error response has a 4xx status code +func (o *ConversationsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this conversations get internal server error response has a 5xx status code +func (o *ConversationsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this conversations get internal server error response a status code equal to that given +func (o *ConversationsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the conversations get internal server error response +func (o *ConversationsGetInternalServerError) Code() int { + return 500 +} + +func (o *ConversationsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetInternalServerError", 500) +} + +func (o *ConversationsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/conversations][%d] conversationsGetInternalServerError", 500) +} + +func (o *ConversationsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/custom_emojis/custom_emojis_client.go b/client/custom_emojis/custom_emojis_client.go new file mode 100644 index 0000000..a9a8ce7 --- /dev/null +++ b/client/custom_emojis/custom_emojis_client.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package custom_emojis + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new custom emojis API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new custom emojis API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new custom emojis API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for custom emojis API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + CustomEmojisGet(params *CustomEmojisGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CustomEmojisGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +CustomEmojisGet gets an array of custom emojis available on the instance +*/ +func (a *Client) CustomEmojisGet(params *CustomEmojisGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*CustomEmojisGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewCustomEmojisGetParams() + } + op := &runtime.ClientOperation{ + ID: "customEmojisGet", + Method: "GET", + PathPattern: "/api/v1/custom_emojis", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &CustomEmojisGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*CustomEmojisGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for customEmojisGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/custom_emojis/custom_emojis_get_parameters.go b/client/custom_emojis/custom_emojis_get_parameters.go new file mode 100644 index 0000000..105025f --- /dev/null +++ b/client/custom_emojis/custom_emojis_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package custom_emojis + +// 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" +) + +// NewCustomEmojisGetParams creates a new CustomEmojisGetParams 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 NewCustomEmojisGetParams() *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewCustomEmojisGetParamsWithTimeout creates a new CustomEmojisGetParams object +// with the ability to set a timeout on a request. +func NewCustomEmojisGetParamsWithTimeout(timeout time.Duration) *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + timeout: timeout, + } +} + +// NewCustomEmojisGetParamsWithContext creates a new CustomEmojisGetParams object +// with the ability to set a context for a request. +func NewCustomEmojisGetParamsWithContext(ctx context.Context) *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + Context: ctx, + } +} + +// NewCustomEmojisGetParamsWithHTTPClient creates a new CustomEmojisGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewCustomEmojisGetParamsWithHTTPClient(client *http.Client) *CustomEmojisGetParams { + return &CustomEmojisGetParams{ + HTTPClient: client, + } +} + +/* +CustomEmojisGetParams contains all the parameters to send to the API endpoint + + for the custom emojis get operation. + + Typically these are written to a http.Request. +*/ +type CustomEmojisGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the custom emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CustomEmojisGetParams) WithDefaults() *CustomEmojisGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the custom emojis get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *CustomEmojisGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the custom emojis get params +func (o *CustomEmojisGetParams) WithTimeout(timeout time.Duration) *CustomEmojisGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the custom emojis get params +func (o *CustomEmojisGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the custom emojis get params +func (o *CustomEmojisGetParams) WithContext(ctx context.Context) *CustomEmojisGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the custom emojis get params +func (o *CustomEmojisGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the custom emojis get params +func (o *CustomEmojisGetParams) WithHTTPClient(client *http.Client) *CustomEmojisGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the custom emojis get params +func (o *CustomEmojisGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *CustomEmojisGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/custom_emojis/custom_emojis_get_responses.go b/client/custom_emojis/custom_emojis_get_responses.go new file mode 100644 index 0000000..6ec6e81 --- /dev/null +++ b/client/custom_emojis/custom_emojis_get_responses.go @@ -0,0 +1,290 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package custom_emojis + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// CustomEmojisGetReader is a Reader for the CustomEmojisGet structure. +type CustomEmojisGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *CustomEmojisGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewCustomEmojisGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewCustomEmojisGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewCustomEmojisGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewCustomEmojisGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/custom_emojis] customEmojisGet", response, response.Code()) + } +} + +// NewCustomEmojisGetOK creates a CustomEmojisGetOK with default headers values +func NewCustomEmojisGetOK() *CustomEmojisGetOK { + return &CustomEmojisGetOK{} +} + +/* +CustomEmojisGetOK describes a response with status code 200, with default header values. + +Array of custom emojis. +*/ +type CustomEmojisGetOK struct { + Payload []*models.Emoji +} + +// IsSuccess returns true when this custom emojis get o k response has a 2xx status code +func (o *CustomEmojisGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this custom emojis get o k response has a 3xx status code +func (o *CustomEmojisGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get o k response has a 4xx status code +func (o *CustomEmojisGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this custom emojis get o k response has a 5xx status code +func (o *CustomEmojisGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this custom emojis get o k response a status code equal to that given +func (o *CustomEmojisGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the custom emojis get o k response +func (o *CustomEmojisGetOK) Code() int { + return 200 +} + +func (o *CustomEmojisGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetOK %s", 200, payload) +} + +func (o *CustomEmojisGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetOK %s", 200, payload) +} + +func (o *CustomEmojisGetOK) GetPayload() []*models.Emoji { + return o.Payload +} + +func (o *CustomEmojisGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewCustomEmojisGetUnauthorized creates a CustomEmojisGetUnauthorized with default headers values +func NewCustomEmojisGetUnauthorized() *CustomEmojisGetUnauthorized { + return &CustomEmojisGetUnauthorized{} +} + +/* +CustomEmojisGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type CustomEmojisGetUnauthorized struct { +} + +// IsSuccess returns true when this custom emojis get unauthorized response has a 2xx status code +func (o *CustomEmojisGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this custom emojis get unauthorized response has a 3xx status code +func (o *CustomEmojisGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get unauthorized response has a 4xx status code +func (o *CustomEmojisGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this custom emojis get unauthorized response has a 5xx status code +func (o *CustomEmojisGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this custom emojis get unauthorized response a status code equal to that given +func (o *CustomEmojisGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the custom emojis get unauthorized response +func (o *CustomEmojisGetUnauthorized) Code() int { + return 401 +} + +func (o *CustomEmojisGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetUnauthorized", 401) +} + +func (o *CustomEmojisGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetUnauthorized", 401) +} + +func (o *CustomEmojisGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewCustomEmojisGetNotAcceptable creates a CustomEmojisGetNotAcceptable with default headers values +func NewCustomEmojisGetNotAcceptable() *CustomEmojisGetNotAcceptable { + return &CustomEmojisGetNotAcceptable{} +} + +/* +CustomEmojisGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type CustomEmojisGetNotAcceptable struct { +} + +// IsSuccess returns true when this custom emojis get not acceptable response has a 2xx status code +func (o *CustomEmojisGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this custom emojis get not acceptable response has a 3xx status code +func (o *CustomEmojisGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get not acceptable response has a 4xx status code +func (o *CustomEmojisGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this custom emojis get not acceptable response has a 5xx status code +func (o *CustomEmojisGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this custom emojis get not acceptable response a status code equal to that given +func (o *CustomEmojisGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the custom emojis get not acceptable response +func (o *CustomEmojisGetNotAcceptable) Code() int { + return 406 +} + +func (o *CustomEmojisGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetNotAcceptable", 406) +} + +func (o *CustomEmojisGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetNotAcceptable", 406) +} + +func (o *CustomEmojisGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewCustomEmojisGetInternalServerError creates a CustomEmojisGetInternalServerError with default headers values +func NewCustomEmojisGetInternalServerError() *CustomEmojisGetInternalServerError { + return &CustomEmojisGetInternalServerError{} +} + +/* +CustomEmojisGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type CustomEmojisGetInternalServerError struct { +} + +// IsSuccess returns true when this custom emojis get internal server error response has a 2xx status code +func (o *CustomEmojisGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this custom emojis get internal server error response has a 3xx status code +func (o *CustomEmojisGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this custom emojis get internal server error response has a 4xx status code +func (o *CustomEmojisGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this custom emojis get internal server error response has a 5xx status code +func (o *CustomEmojisGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this custom emojis get internal server error response a status code equal to that given +func (o *CustomEmojisGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the custom emojis get internal server error response +func (o *CustomEmojisGetInternalServerError) Code() int { + return 500 +} + +func (o *CustomEmojisGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetInternalServerError", 500) +} + +func (o *CustomEmojisGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/custom_emojis][%d] customEmojisGetInternalServerError", 500) +} + +func (o *CustomEmojisGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/debug/debug_a_p_url_parameters.go b/client/debug/debug_a_p_url_parameters.go new file mode 100644 index 0000000..d381a8e --- /dev/null +++ b/client/debug/debug_a_p_url_parameters.go @@ -0,0 +1,156 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// 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" +) + +// NewDebugAPURLParams creates a new DebugAPURLParams 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 NewDebugAPURLParams() *DebugAPURLParams { + return &DebugAPURLParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDebugAPURLParamsWithTimeout creates a new DebugAPURLParams object +// with the ability to set a timeout on a request. +func NewDebugAPURLParamsWithTimeout(timeout time.Duration) *DebugAPURLParams { + return &DebugAPURLParams{ + timeout: timeout, + } +} + +// NewDebugAPURLParamsWithContext creates a new DebugAPURLParams object +// with the ability to set a context for a request. +func NewDebugAPURLParamsWithContext(ctx context.Context) *DebugAPURLParams { + return &DebugAPURLParams{ + Context: ctx, + } +} + +// NewDebugAPURLParamsWithHTTPClient creates a new DebugAPURLParams object +// with the ability to set a custom HTTPClient for a request. +func NewDebugAPURLParamsWithHTTPClient(client *http.Client) *DebugAPURLParams { + return &DebugAPURLParams{ + HTTPClient: client, + } +} + +/* +DebugAPURLParams contains all the parameters to send to the API endpoint + + for the debug a p Url operation. + + Typically these are written to a http.Request. +*/ +type DebugAPURLParams struct { + + /* URL. + + The URL / ActivityPub ID to dereference. This should be a full URL, including protocol. Eg., `https://example.org/users/someone` + */ + URL string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the debug a p Url params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugAPURLParams) WithDefaults() *DebugAPURLParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the debug a p Url params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugAPURLParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the debug a p Url params +func (o *DebugAPURLParams) WithTimeout(timeout time.Duration) *DebugAPURLParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the debug a p Url params +func (o *DebugAPURLParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the debug a p Url params +func (o *DebugAPURLParams) WithContext(ctx context.Context) *DebugAPURLParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the debug a p Url params +func (o *DebugAPURLParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the debug a p Url params +func (o *DebugAPURLParams) WithHTTPClient(client *http.Client) *DebugAPURLParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the debug a p Url params +func (o *DebugAPURLParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithURL adds the url to the debug a p Url params +func (o *DebugAPURLParams) WithURL(url string) *DebugAPURLParams { + o.SetURL(url) + return o +} + +// SetURL adds the url to the debug a p Url params +func (o *DebugAPURLParams) SetURL(url string) { + o.URL = url +} + +// WriteToRequest writes these params to a swagger request +func (o *DebugAPURLParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param url + qrURL := o.URL + qURL := qrURL + if qURL != "" { + + if err := r.SetQueryParam("url", qURL); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/debug/debug_a_p_url_responses.go b/client/debug/debug_a_p_url_responses.go new file mode 100644 index 0000000..a7b8dea --- /dev/null +++ b/client/debug/debug_a_p_url_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// DebugAPURLReader is a Reader for the DebugAPURL structure. +type DebugAPURLReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DebugAPURLReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDebugAPURLOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDebugAPURLBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDebugAPURLUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDebugAPURLNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDebugAPURLNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDebugAPURLInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/admin/debug/apurl] debugAPUrl", response, response.Code()) + } +} + +// NewDebugAPURLOK creates a DebugAPURLOK with default headers values +func NewDebugAPURLOK() *DebugAPURLOK { + return &DebugAPURLOK{} +} + +/* +DebugAPURLOK describes a response with status code 200, with default header values. + +DebugAPURLOK debug a p Url o k +*/ +type DebugAPURLOK struct { + Payload *models.DebugAPURLResponse +} + +// IsSuccess returns true when this debug a p Url o k response has a 2xx status code +func (o *DebugAPURLOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this debug a p Url o k response has a 3xx status code +func (o *DebugAPURLOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url o k response has a 4xx status code +func (o *DebugAPURLOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug a p Url o k response has a 5xx status code +func (o *DebugAPURLOK) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url o k response a status code equal to that given +func (o *DebugAPURLOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the debug a p Url o k response +func (o *DebugAPURLOK) Code() int { + return 200 +} + +func (o *DebugAPURLOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlOK %s", 200, payload) +} + +func (o *DebugAPURLOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlOK %s", 200, payload) +} + +func (o *DebugAPURLOK) GetPayload() *models.DebugAPURLResponse { + return o.Payload +} + +func (o *DebugAPURLOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DebugAPURLResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewDebugAPURLBadRequest creates a DebugAPURLBadRequest with default headers values +func NewDebugAPURLBadRequest() *DebugAPURLBadRequest { + return &DebugAPURLBadRequest{} +} + +/* +DebugAPURLBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DebugAPURLBadRequest struct { +} + +// IsSuccess returns true when this debug a p Url bad request response has a 2xx status code +func (o *DebugAPURLBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url bad request response has a 3xx status code +func (o *DebugAPURLBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url bad request response has a 4xx status code +func (o *DebugAPURLBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url bad request response has a 5xx status code +func (o *DebugAPURLBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url bad request response a status code equal to that given +func (o *DebugAPURLBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the debug a p Url bad request response +func (o *DebugAPURLBadRequest) Code() int { + return 400 +} + +func (o *DebugAPURLBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlBadRequest", 400) +} + +func (o *DebugAPURLBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlBadRequest", 400) +} + +func (o *DebugAPURLBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLUnauthorized creates a DebugAPURLUnauthorized with default headers values +func NewDebugAPURLUnauthorized() *DebugAPURLUnauthorized { + return &DebugAPURLUnauthorized{} +} + +/* +DebugAPURLUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DebugAPURLUnauthorized struct { +} + +// IsSuccess returns true when this debug a p Url unauthorized response has a 2xx status code +func (o *DebugAPURLUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url unauthorized response has a 3xx status code +func (o *DebugAPURLUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url unauthorized response has a 4xx status code +func (o *DebugAPURLUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url unauthorized response has a 5xx status code +func (o *DebugAPURLUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url unauthorized response a status code equal to that given +func (o *DebugAPURLUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the debug a p Url unauthorized response +func (o *DebugAPURLUnauthorized) Code() int { + return 401 +} + +func (o *DebugAPURLUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlUnauthorized", 401) +} + +func (o *DebugAPURLUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlUnauthorized", 401) +} + +func (o *DebugAPURLUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLNotFound creates a DebugAPURLNotFound with default headers values +func NewDebugAPURLNotFound() *DebugAPURLNotFound { + return &DebugAPURLNotFound{} +} + +/* +DebugAPURLNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DebugAPURLNotFound struct { +} + +// IsSuccess returns true when this debug a p Url not found response has a 2xx status code +func (o *DebugAPURLNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url not found response has a 3xx status code +func (o *DebugAPURLNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url not found response has a 4xx status code +func (o *DebugAPURLNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url not found response has a 5xx status code +func (o *DebugAPURLNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url not found response a status code equal to that given +func (o *DebugAPURLNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the debug a p Url not found response +func (o *DebugAPURLNotFound) Code() int { + return 404 +} + +func (o *DebugAPURLNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotFound", 404) +} + +func (o *DebugAPURLNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotFound", 404) +} + +func (o *DebugAPURLNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLNotAcceptable creates a DebugAPURLNotAcceptable with default headers values +func NewDebugAPURLNotAcceptable() *DebugAPURLNotAcceptable { + return &DebugAPURLNotAcceptable{} +} + +/* +DebugAPURLNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DebugAPURLNotAcceptable struct { +} + +// IsSuccess returns true when this debug a p Url not acceptable response has a 2xx status code +func (o *DebugAPURLNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url not acceptable response has a 3xx status code +func (o *DebugAPURLNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url not acceptable response has a 4xx status code +func (o *DebugAPURLNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug a p Url not acceptable response has a 5xx status code +func (o *DebugAPURLNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this debug a p Url not acceptable response a status code equal to that given +func (o *DebugAPURLNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the debug a p Url not acceptable response +func (o *DebugAPURLNotAcceptable) Code() int { + return 406 +} + +func (o *DebugAPURLNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotAcceptable", 406) +} + +func (o *DebugAPURLNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlNotAcceptable", 406) +} + +func (o *DebugAPURLNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugAPURLInternalServerError creates a DebugAPURLInternalServerError with default headers values +func NewDebugAPURLInternalServerError() *DebugAPURLInternalServerError { + return &DebugAPURLInternalServerError{} +} + +/* +DebugAPURLInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DebugAPURLInternalServerError struct { +} + +// IsSuccess returns true when this debug a p Url internal server error response has a 2xx status code +func (o *DebugAPURLInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug a p Url internal server error response has a 3xx status code +func (o *DebugAPURLInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug a p Url internal server error response has a 4xx status code +func (o *DebugAPURLInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug a p Url internal server error response has a 5xx status code +func (o *DebugAPURLInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this debug a p Url internal server error response a status code equal to that given +func (o *DebugAPURLInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the debug a p Url internal server error response +func (o *DebugAPURLInternalServerError) Code() int { + return 500 +} + +func (o *DebugAPURLInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlInternalServerError", 500) +} + +func (o *DebugAPURLInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/admin/debug/apurl][%d] debugAPUrlInternalServerError", 500) +} + +func (o *DebugAPURLInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/debug/debug_clear_caches_parameters.go b/client/debug/debug_clear_caches_parameters.go new file mode 100644 index 0000000..a8a717e --- /dev/null +++ b/client/debug/debug_clear_caches_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// 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" +) + +// NewDebugClearCachesParams creates a new DebugClearCachesParams 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 NewDebugClearCachesParams() *DebugClearCachesParams { + return &DebugClearCachesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewDebugClearCachesParamsWithTimeout creates a new DebugClearCachesParams object +// with the ability to set a timeout on a request. +func NewDebugClearCachesParamsWithTimeout(timeout time.Duration) *DebugClearCachesParams { + return &DebugClearCachesParams{ + timeout: timeout, + } +} + +// NewDebugClearCachesParamsWithContext creates a new DebugClearCachesParams object +// with the ability to set a context for a request. +func NewDebugClearCachesParamsWithContext(ctx context.Context) *DebugClearCachesParams { + return &DebugClearCachesParams{ + Context: ctx, + } +} + +// NewDebugClearCachesParamsWithHTTPClient creates a new DebugClearCachesParams object +// with the ability to set a custom HTTPClient for a request. +func NewDebugClearCachesParamsWithHTTPClient(client *http.Client) *DebugClearCachesParams { + return &DebugClearCachesParams{ + HTTPClient: client, + } +} + +/* +DebugClearCachesParams contains all the parameters to send to the API endpoint + + for the debug clear caches operation. + + Typically these are written to a http.Request. +*/ +type DebugClearCachesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the debug clear caches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugClearCachesParams) WithDefaults() *DebugClearCachesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the debug clear caches params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *DebugClearCachesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the debug clear caches params +func (o *DebugClearCachesParams) WithTimeout(timeout time.Duration) *DebugClearCachesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the debug clear caches params +func (o *DebugClearCachesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the debug clear caches params +func (o *DebugClearCachesParams) WithContext(ctx context.Context) *DebugClearCachesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the debug clear caches params +func (o *DebugClearCachesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the debug clear caches params +func (o *DebugClearCachesParams) WithHTTPClient(client *http.Client) *DebugClearCachesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the debug clear caches params +func (o *DebugClearCachesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *DebugClearCachesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/debug/debug_clear_caches_responses.go b/client/debug/debug_clear_caches_responses.go new file mode 100644 index 0000000..344c966 --- /dev/null +++ b/client/debug/debug_clear_caches_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// DebugClearCachesReader is a Reader for the DebugClearCaches structure. +type DebugClearCachesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *DebugClearCachesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewDebugClearCachesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewDebugClearCachesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewDebugClearCachesUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewDebugClearCachesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewDebugClearCachesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewDebugClearCachesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/admin/debug/caches/clear] debugClearCaches", response, response.Code()) + } +} + +// NewDebugClearCachesOK creates a DebugClearCachesOK with default headers values +func NewDebugClearCachesOK() *DebugClearCachesOK { + return &DebugClearCachesOK{} +} + +/* +DebugClearCachesOK describes a response with status code 200, with default header values. + +All good baby! +*/ +type DebugClearCachesOK struct { +} + +// IsSuccess returns true when this debug clear caches o k response has a 2xx status code +func (o *DebugClearCachesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this debug clear caches o k response has a 3xx status code +func (o *DebugClearCachesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches o k response has a 4xx status code +func (o *DebugClearCachesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug clear caches o k response has a 5xx status code +func (o *DebugClearCachesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches o k response a status code equal to that given +func (o *DebugClearCachesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the debug clear caches o k response +func (o *DebugClearCachesOK) Code() int { + return 200 +} + +func (o *DebugClearCachesOK) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesOK", 200) +} + +func (o *DebugClearCachesOK) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesOK", 200) +} + +func (o *DebugClearCachesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesBadRequest creates a DebugClearCachesBadRequest with default headers values +func NewDebugClearCachesBadRequest() *DebugClearCachesBadRequest { + return &DebugClearCachesBadRequest{} +} + +/* +DebugClearCachesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type DebugClearCachesBadRequest struct { +} + +// IsSuccess returns true when this debug clear caches bad request response has a 2xx status code +func (o *DebugClearCachesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches bad request response has a 3xx status code +func (o *DebugClearCachesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches bad request response has a 4xx status code +func (o *DebugClearCachesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches bad request response has a 5xx status code +func (o *DebugClearCachesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches bad request response a status code equal to that given +func (o *DebugClearCachesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the debug clear caches bad request response +func (o *DebugClearCachesBadRequest) Code() int { + return 400 +} + +func (o *DebugClearCachesBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesBadRequest", 400) +} + +func (o *DebugClearCachesBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesBadRequest", 400) +} + +func (o *DebugClearCachesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesUnauthorized creates a DebugClearCachesUnauthorized with default headers values +func NewDebugClearCachesUnauthorized() *DebugClearCachesUnauthorized { + return &DebugClearCachesUnauthorized{} +} + +/* +DebugClearCachesUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type DebugClearCachesUnauthorized struct { +} + +// IsSuccess returns true when this debug clear caches unauthorized response has a 2xx status code +func (o *DebugClearCachesUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches unauthorized response has a 3xx status code +func (o *DebugClearCachesUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches unauthorized response has a 4xx status code +func (o *DebugClearCachesUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches unauthorized response has a 5xx status code +func (o *DebugClearCachesUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches unauthorized response a status code equal to that given +func (o *DebugClearCachesUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the debug clear caches unauthorized response +func (o *DebugClearCachesUnauthorized) Code() int { + return 401 +} + +func (o *DebugClearCachesUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesUnauthorized", 401) +} + +func (o *DebugClearCachesUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesUnauthorized", 401) +} + +func (o *DebugClearCachesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesNotFound creates a DebugClearCachesNotFound with default headers values +func NewDebugClearCachesNotFound() *DebugClearCachesNotFound { + return &DebugClearCachesNotFound{} +} + +/* +DebugClearCachesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type DebugClearCachesNotFound struct { +} + +// IsSuccess returns true when this debug clear caches not found response has a 2xx status code +func (o *DebugClearCachesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches not found response has a 3xx status code +func (o *DebugClearCachesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches not found response has a 4xx status code +func (o *DebugClearCachesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches not found response has a 5xx status code +func (o *DebugClearCachesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches not found response a status code equal to that given +func (o *DebugClearCachesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the debug clear caches not found response +func (o *DebugClearCachesNotFound) Code() int { + return 404 +} + +func (o *DebugClearCachesNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotFound", 404) +} + +func (o *DebugClearCachesNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotFound", 404) +} + +func (o *DebugClearCachesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesNotAcceptable creates a DebugClearCachesNotAcceptable with default headers values +func NewDebugClearCachesNotAcceptable() *DebugClearCachesNotAcceptable { + return &DebugClearCachesNotAcceptable{} +} + +/* +DebugClearCachesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type DebugClearCachesNotAcceptable struct { +} + +// IsSuccess returns true when this debug clear caches not acceptable response has a 2xx status code +func (o *DebugClearCachesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches not acceptable response has a 3xx status code +func (o *DebugClearCachesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches not acceptable response has a 4xx status code +func (o *DebugClearCachesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this debug clear caches not acceptable response has a 5xx status code +func (o *DebugClearCachesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this debug clear caches not acceptable response a status code equal to that given +func (o *DebugClearCachesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the debug clear caches not acceptable response +func (o *DebugClearCachesNotAcceptable) Code() int { + return 406 +} + +func (o *DebugClearCachesNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotAcceptable", 406) +} + +func (o *DebugClearCachesNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesNotAcceptable", 406) +} + +func (o *DebugClearCachesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewDebugClearCachesInternalServerError creates a DebugClearCachesInternalServerError with default headers values +func NewDebugClearCachesInternalServerError() *DebugClearCachesInternalServerError { + return &DebugClearCachesInternalServerError{} +} + +/* +DebugClearCachesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type DebugClearCachesInternalServerError struct { +} + +// IsSuccess returns true when this debug clear caches internal server error response has a 2xx status code +func (o *DebugClearCachesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this debug clear caches internal server error response has a 3xx status code +func (o *DebugClearCachesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this debug clear caches internal server error response has a 4xx status code +func (o *DebugClearCachesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this debug clear caches internal server error response has a 5xx status code +func (o *DebugClearCachesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this debug clear caches internal server error response a status code equal to that given +func (o *DebugClearCachesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the debug clear caches internal server error response +func (o *DebugClearCachesInternalServerError) Code() int { + return 500 +} + +func (o *DebugClearCachesInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesInternalServerError", 500) +} + +func (o *DebugClearCachesInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/admin/debug/caches/clear][%d] debugClearCachesInternalServerError", 500) +} + +func (o *DebugClearCachesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/debug/debug_client.go b/client/debug/debug_client.go new file mode 100644 index 0000000..2ce78f0 --- /dev/null +++ b/client/debug/debug_client.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package debug + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new debug API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new debug API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new debug API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for debug API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + DebugAPURL(params *DebugAPURLParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugAPURLOK, error) + + DebugClearCaches(params *DebugClearCachesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugClearCachesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +DebugAPURL performs a g e t to the specified activity pub URL and return detailed debugging information + +Only enabled / exposed if GoToSocial was built and is running with flag DEBUG=1. +*/ +func (a *Client) DebugAPURL(params *DebugAPURLParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugAPURLOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDebugAPURLParams() + } + op := &runtime.ClientOperation{ + ID: "debugAPUrl", + Method: "GET", + PathPattern: "/api/v1/admin/debug/apurl", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DebugAPURLReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DebugAPURLOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for debugAPUrl: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +DebugClearCaches sweeps clear all in memory caches + +Only enabled / exposed if GoToSocial was built and is running with flag DEBUG=1. +*/ +func (a *Client) DebugClearCaches(params *DebugClearCachesParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*DebugClearCachesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewDebugClearCachesParams() + } + op := &runtime.ClientOperation{ + ID: "debugClearCaches", + Method: "POST", + PathPattern: "/api/v1/admin/debug/caches/clear", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &DebugClearCachesReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*DebugClearCachesOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for debugClearCaches: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/favourites/favourites_client.go b/client/favourites/favourites_client.go new file mode 100644 index 0000000..e72599b --- /dev/null +++ b/client/favourites/favourites_client.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package favourites + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new favourites API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new favourites API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new favourites API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for favourites API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + FavouritesGet(params *FavouritesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FavouritesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + FavouritesGet gets an array of statuses that the requesting account has favourited + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) FavouritesGet(params *FavouritesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FavouritesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFavouritesGetParams() + } + op := &runtime.ClientOperation{ + ID: "favouritesGet", + Method: "GET", + PathPattern: "/api/v1/favourites", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FavouritesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FavouritesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for favouritesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/favourites/favourites_get_parameters.go b/client/favourites/favourites_get_parameters.go new file mode 100644 index 0000000..a00545e --- /dev/null +++ b/client/favourites/favourites_get_parameters.go @@ -0,0 +1,245 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package favourites + +// 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" +) + +// NewFavouritesGetParams creates a new FavouritesGetParams 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 NewFavouritesGetParams() *FavouritesGetParams { + return &FavouritesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFavouritesGetParamsWithTimeout creates a new FavouritesGetParams object +// with the ability to set a timeout on a request. +func NewFavouritesGetParamsWithTimeout(timeout time.Duration) *FavouritesGetParams { + return &FavouritesGetParams{ + timeout: timeout, + } +} + +// NewFavouritesGetParamsWithContext creates a new FavouritesGetParams object +// with the ability to set a context for a request. +func NewFavouritesGetParamsWithContext(ctx context.Context) *FavouritesGetParams { + return &FavouritesGetParams{ + Context: ctx, + } +} + +// NewFavouritesGetParamsWithHTTPClient creates a new FavouritesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFavouritesGetParamsWithHTTPClient(client *http.Client) *FavouritesGetParams { + return &FavouritesGetParams{ + HTTPClient: client, + } +} + +/* +FavouritesGetParams contains all the parameters to send to the API endpoint + + for the favourites get operation. + + Typically these are written to a http.Request. +*/ +type FavouritesGetParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only favourited statuses *OLDER* than the given favourite ID. The status with the corresponding fave ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only favourited statuses *NEWER* than the given favourite ID. The status with the corresponding fave ID will not be included in the response. + */ + MinID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the favourites get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FavouritesGetParams) WithDefaults() *FavouritesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the favourites get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FavouritesGetParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := FavouritesGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the favourites get params +func (o *FavouritesGetParams) WithTimeout(timeout time.Duration) *FavouritesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the favourites get params +func (o *FavouritesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the favourites get params +func (o *FavouritesGetParams) WithContext(ctx context.Context) *FavouritesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the favourites get params +func (o *FavouritesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the favourites get params +func (o *FavouritesGetParams) WithHTTPClient(client *http.Client) *FavouritesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the favourites get params +func (o *FavouritesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the favourites get params +func (o *FavouritesGetParams) WithLimit(limit *int64) *FavouritesGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the favourites get params +func (o *FavouritesGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the favourites get params +func (o *FavouritesGetParams) WithMaxID(maxID *string) *FavouritesGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the favourites get params +func (o *FavouritesGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the favourites get params +func (o *FavouritesGetParams) WithMinID(minID *string) *FavouritesGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the favourites get params +func (o *FavouritesGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WriteToRequest writes these params to a swagger request +func (o *FavouritesGetParams) 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.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 len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/favourites/favourites_get_responses.go b/client/favourites/favourites_get_responses.go new file mode 100644 index 0000000..239333d --- /dev/null +++ b/client/favourites/favourites_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package favourites + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FavouritesGetReader is a Reader for the FavouritesGet structure. +type FavouritesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FavouritesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFavouritesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFavouritesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFavouritesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFavouritesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFavouritesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFavouritesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/favourites] favouritesGet", response, response.Code()) + } +} + +// NewFavouritesGetOK creates a FavouritesGetOK with default headers values +func NewFavouritesGetOK() *FavouritesGetOK { + return &FavouritesGetOK{} +} + +/* +FavouritesGetOK describes a response with status code 200, with default header values. + +FavouritesGetOK favourites get o k +*/ +type FavouritesGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this favourites get o k response has a 2xx status code +func (o *FavouritesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this favourites get o k response has a 3xx status code +func (o *FavouritesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get o k response has a 4xx status code +func (o *FavouritesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this favourites get o k response has a 5xx status code +func (o *FavouritesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get o k response a status code equal to that given +func (o *FavouritesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the favourites get o k response +func (o *FavouritesGetOK) Code() int { + return 200 +} + +func (o *FavouritesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetOK %s", 200, payload) +} + +func (o *FavouritesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetOK %s", 200, payload) +} + +func (o *FavouritesGetOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *FavouritesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFavouritesGetBadRequest creates a FavouritesGetBadRequest with default headers values +func NewFavouritesGetBadRequest() *FavouritesGetBadRequest { + return &FavouritesGetBadRequest{} +} + +/* +FavouritesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FavouritesGetBadRequest struct { +} + +// IsSuccess returns true when this favourites get bad request response has a 2xx status code +func (o *FavouritesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get bad request response has a 3xx status code +func (o *FavouritesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get bad request response has a 4xx status code +func (o *FavouritesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get bad request response has a 5xx status code +func (o *FavouritesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get bad request response a status code equal to that given +func (o *FavouritesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the favourites get bad request response +func (o *FavouritesGetBadRequest) Code() int { + return 400 +} + +func (o *FavouritesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetBadRequest", 400) +} + +func (o *FavouritesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetBadRequest", 400) +} + +func (o *FavouritesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetUnauthorized creates a FavouritesGetUnauthorized with default headers values +func NewFavouritesGetUnauthorized() *FavouritesGetUnauthorized { + return &FavouritesGetUnauthorized{} +} + +/* +FavouritesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FavouritesGetUnauthorized struct { +} + +// IsSuccess returns true when this favourites get unauthorized response has a 2xx status code +func (o *FavouritesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get unauthorized response has a 3xx status code +func (o *FavouritesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get unauthorized response has a 4xx status code +func (o *FavouritesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get unauthorized response has a 5xx status code +func (o *FavouritesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get unauthorized response a status code equal to that given +func (o *FavouritesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the favourites get unauthorized response +func (o *FavouritesGetUnauthorized) Code() int { + return 401 +} + +func (o *FavouritesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetUnauthorized", 401) +} + +func (o *FavouritesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetUnauthorized", 401) +} + +func (o *FavouritesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetNotFound creates a FavouritesGetNotFound with default headers values +func NewFavouritesGetNotFound() *FavouritesGetNotFound { + return &FavouritesGetNotFound{} +} + +/* +FavouritesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FavouritesGetNotFound struct { +} + +// IsSuccess returns true when this favourites get not found response has a 2xx status code +func (o *FavouritesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get not found response has a 3xx status code +func (o *FavouritesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get not found response has a 4xx status code +func (o *FavouritesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get not found response has a 5xx status code +func (o *FavouritesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get not found response a status code equal to that given +func (o *FavouritesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the favourites get not found response +func (o *FavouritesGetNotFound) Code() int { + return 404 +} + +func (o *FavouritesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotFound", 404) +} + +func (o *FavouritesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotFound", 404) +} + +func (o *FavouritesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetNotAcceptable creates a FavouritesGetNotAcceptable with default headers values +func NewFavouritesGetNotAcceptable() *FavouritesGetNotAcceptable { + return &FavouritesGetNotAcceptable{} +} + +/* +FavouritesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FavouritesGetNotAcceptable struct { +} + +// IsSuccess returns true when this favourites get not acceptable response has a 2xx status code +func (o *FavouritesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get not acceptable response has a 3xx status code +func (o *FavouritesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get not acceptable response has a 4xx status code +func (o *FavouritesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this favourites get not acceptable response has a 5xx status code +func (o *FavouritesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this favourites get not acceptable response a status code equal to that given +func (o *FavouritesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the favourites get not acceptable response +func (o *FavouritesGetNotAcceptable) Code() int { + return 406 +} + +func (o *FavouritesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotAcceptable", 406) +} + +func (o *FavouritesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetNotAcceptable", 406) +} + +func (o *FavouritesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFavouritesGetInternalServerError creates a FavouritesGetInternalServerError with default headers values +func NewFavouritesGetInternalServerError() *FavouritesGetInternalServerError { + return &FavouritesGetInternalServerError{} +} + +/* +FavouritesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FavouritesGetInternalServerError struct { +} + +// IsSuccess returns true when this favourites get internal server error response has a 2xx status code +func (o *FavouritesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this favourites get internal server error response has a 3xx status code +func (o *FavouritesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this favourites get internal server error response has a 4xx status code +func (o *FavouritesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this favourites get internal server error response has a 5xx status code +func (o *FavouritesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this favourites get internal server error response a status code equal to that given +func (o *FavouritesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the favourites get internal server error response +func (o *FavouritesGetInternalServerError) Code() int { + return 500 +} + +func (o *FavouritesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetInternalServerError", 500) +} + +func (o *FavouritesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/favourites][%d] favouritesGetInternalServerError", 500) +} + +func (o *FavouritesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/featured_tags/featured_tags_client.go b/client/featured_tags/featured_tags_client.go new file mode 100644 index 0000000..b198d59 --- /dev/null +++ b/client/featured_tags/featured_tags_client.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package featured_tags + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new featured tags API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new featured tags API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new featured tags API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for featured tags API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + GetFeaturedTags(params *GetFeaturedTagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFeaturedTagsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetFeaturedTags gets an array of all hashtags that you currently have featured on your profile + +THIS ENDPOINT IS CURRENTLY NOT FULLY IMPLEMENTED: it will always return an empty array. +*/ +func (a *Client) GetFeaturedTags(params *GetFeaturedTagsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFeaturedTagsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetFeaturedTagsParams() + } + op := &runtime.ClientOperation{ + ID: "getFeaturedTags", + Method: "GET", + PathPattern: "/api/v1/featured_tags", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetFeaturedTagsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetFeaturedTagsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for getFeaturedTags: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/featured_tags/get_featured_tags_parameters.go b/client/featured_tags/get_featured_tags_parameters.go new file mode 100644 index 0000000..4a59710 --- /dev/null +++ b/client/featured_tags/get_featured_tags_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package featured_tags + +// 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" +) + +// NewGetFeaturedTagsParams creates a new GetFeaturedTagsParams 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 NewGetFeaturedTagsParams() *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetFeaturedTagsParamsWithTimeout creates a new GetFeaturedTagsParams object +// with the ability to set a timeout on a request. +func NewGetFeaturedTagsParamsWithTimeout(timeout time.Duration) *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + timeout: timeout, + } +} + +// NewGetFeaturedTagsParamsWithContext creates a new GetFeaturedTagsParams object +// with the ability to set a context for a request. +func NewGetFeaturedTagsParamsWithContext(ctx context.Context) *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + Context: ctx, + } +} + +// NewGetFeaturedTagsParamsWithHTTPClient creates a new GetFeaturedTagsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetFeaturedTagsParamsWithHTTPClient(client *http.Client) *GetFeaturedTagsParams { + return &GetFeaturedTagsParams{ + HTTPClient: client, + } +} + +/* +GetFeaturedTagsParams contains all the parameters to send to the API endpoint + + for the get featured tags operation. + + Typically these are written to a http.Request. +*/ +type GetFeaturedTagsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get featured tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFeaturedTagsParams) WithDefaults() *GetFeaturedTagsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get featured tags params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFeaturedTagsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get featured tags params +func (o *GetFeaturedTagsParams) WithTimeout(timeout time.Duration) *GetFeaturedTagsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get featured tags params +func (o *GetFeaturedTagsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get featured tags params +func (o *GetFeaturedTagsParams) WithContext(ctx context.Context) *GetFeaturedTagsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get featured tags params +func (o *GetFeaturedTagsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get featured tags params +func (o *GetFeaturedTagsParams) WithHTTPClient(client *http.Client) *GetFeaturedTagsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get featured tags params +func (o *GetFeaturedTagsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetFeaturedTagsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/featured_tags/get_featured_tags_responses.go b/client/featured_tags/get_featured_tags_responses.go new file mode 100644 index 0000000..e95efdb --- /dev/null +++ b/client/featured_tags/get_featured_tags_responses.go @@ -0,0 +1,412 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package featured_tags + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// GetFeaturedTagsReader is a Reader for the GetFeaturedTags structure. +type GetFeaturedTagsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetFeaturedTagsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetFeaturedTagsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetFeaturedTagsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetFeaturedTagsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewGetFeaturedTagsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewGetFeaturedTagsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewGetFeaturedTagsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/featured_tags] getFeaturedTags", response, response.Code()) + } +} + +// NewGetFeaturedTagsOK creates a GetFeaturedTagsOK with default headers values +func NewGetFeaturedTagsOK() *GetFeaturedTagsOK { + return &GetFeaturedTagsOK{} +} + +/* +GetFeaturedTagsOK describes a response with status code 200, with default header values. + +GetFeaturedTagsOK get featured tags o k +*/ +type GetFeaturedTagsOK struct { + Payload []interface{} +} + +// IsSuccess returns true when this get featured tags o k response has a 2xx status code +func (o *GetFeaturedTagsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get featured tags o k response has a 3xx status code +func (o *GetFeaturedTagsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags o k response has a 4xx status code +func (o *GetFeaturedTagsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get featured tags o k response has a 5xx status code +func (o *GetFeaturedTagsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags o k response a status code equal to that given +func (o *GetFeaturedTagsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get featured tags o k response +func (o *GetFeaturedTagsOK) Code() int { + return 200 +} + +func (o *GetFeaturedTagsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsOK %s", 200, payload) +} + +func (o *GetFeaturedTagsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsOK %s", 200, payload) +} + +func (o *GetFeaturedTagsOK) GetPayload() []interface{} { + return o.Payload +} + +func (o *GetFeaturedTagsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetFeaturedTagsBadRequest creates a GetFeaturedTagsBadRequest with default headers values +func NewGetFeaturedTagsBadRequest() *GetFeaturedTagsBadRequest { + return &GetFeaturedTagsBadRequest{} +} + +/* +GetFeaturedTagsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type GetFeaturedTagsBadRequest struct { +} + +// IsSuccess returns true when this get featured tags bad request response has a 2xx status code +func (o *GetFeaturedTagsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags bad request response has a 3xx status code +func (o *GetFeaturedTagsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags bad request response has a 4xx status code +func (o *GetFeaturedTagsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags bad request response has a 5xx status code +func (o *GetFeaturedTagsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags bad request response a status code equal to that given +func (o *GetFeaturedTagsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get featured tags bad request response +func (o *GetFeaturedTagsBadRequest) Code() int { + return 400 +} + +func (o *GetFeaturedTagsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsBadRequest", 400) +} + +func (o *GetFeaturedTagsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsBadRequest", 400) +} + +func (o *GetFeaturedTagsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsUnauthorized creates a GetFeaturedTagsUnauthorized with default headers values +func NewGetFeaturedTagsUnauthorized() *GetFeaturedTagsUnauthorized { + return &GetFeaturedTagsUnauthorized{} +} + +/* +GetFeaturedTagsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type GetFeaturedTagsUnauthorized struct { +} + +// IsSuccess returns true when this get featured tags unauthorized response has a 2xx status code +func (o *GetFeaturedTagsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags unauthorized response has a 3xx status code +func (o *GetFeaturedTagsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags unauthorized response has a 4xx status code +func (o *GetFeaturedTagsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags unauthorized response has a 5xx status code +func (o *GetFeaturedTagsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags unauthorized response a status code equal to that given +func (o *GetFeaturedTagsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get featured tags unauthorized response +func (o *GetFeaturedTagsUnauthorized) Code() int { + return 401 +} + +func (o *GetFeaturedTagsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsUnauthorized", 401) +} + +func (o *GetFeaturedTagsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsUnauthorized", 401) +} + +func (o *GetFeaturedTagsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsNotFound creates a GetFeaturedTagsNotFound with default headers values +func NewGetFeaturedTagsNotFound() *GetFeaturedTagsNotFound { + return &GetFeaturedTagsNotFound{} +} + +/* +GetFeaturedTagsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type GetFeaturedTagsNotFound struct { +} + +// IsSuccess returns true when this get featured tags not found response has a 2xx status code +func (o *GetFeaturedTagsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags not found response has a 3xx status code +func (o *GetFeaturedTagsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags not found response has a 4xx status code +func (o *GetFeaturedTagsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags not found response has a 5xx status code +func (o *GetFeaturedTagsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags not found response a status code equal to that given +func (o *GetFeaturedTagsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the get featured tags not found response +func (o *GetFeaturedTagsNotFound) Code() int { + return 404 +} + +func (o *GetFeaturedTagsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotFound", 404) +} + +func (o *GetFeaturedTagsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotFound", 404) +} + +func (o *GetFeaturedTagsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsNotAcceptable creates a GetFeaturedTagsNotAcceptable with default headers values +func NewGetFeaturedTagsNotAcceptable() *GetFeaturedTagsNotAcceptable { + return &GetFeaturedTagsNotAcceptable{} +} + +/* +GetFeaturedTagsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type GetFeaturedTagsNotAcceptable struct { +} + +// IsSuccess returns true when this get featured tags not acceptable response has a 2xx status code +func (o *GetFeaturedTagsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags not acceptable response has a 3xx status code +func (o *GetFeaturedTagsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags not acceptable response has a 4xx status code +func (o *GetFeaturedTagsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this get featured tags not acceptable response has a 5xx status code +func (o *GetFeaturedTagsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this get featured tags not acceptable response a status code equal to that given +func (o *GetFeaturedTagsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the get featured tags not acceptable response +func (o *GetFeaturedTagsNotAcceptable) Code() int { + return 406 +} + +func (o *GetFeaturedTagsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotAcceptable", 406) +} + +func (o *GetFeaturedTagsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsNotAcceptable", 406) +} + +func (o *GetFeaturedTagsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFeaturedTagsInternalServerError creates a GetFeaturedTagsInternalServerError with default headers values +func NewGetFeaturedTagsInternalServerError() *GetFeaturedTagsInternalServerError { + return &GetFeaturedTagsInternalServerError{} +} + +/* +GetFeaturedTagsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type GetFeaturedTagsInternalServerError struct { +} + +// IsSuccess returns true when this get featured tags internal server error response has a 2xx status code +func (o *GetFeaturedTagsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get featured tags internal server error response has a 3xx status code +func (o *GetFeaturedTagsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get featured tags internal server error response has a 4xx status code +func (o *GetFeaturedTagsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this get featured tags internal server error response has a 5xx status code +func (o *GetFeaturedTagsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this get featured tags internal server error response a status code equal to that given +func (o *GetFeaturedTagsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the get featured tags internal server error response +func (o *GetFeaturedTagsInternalServerError) Code() int { + return 500 +} + +func (o *GetFeaturedTagsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsInternalServerError", 500) +} + +func (o *GetFeaturedTagsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/featured_tags][%d] getFeaturedTagsInternalServerError", 500) +} + +func (o *GetFeaturedTagsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/federation/federation_client.go b/client/federation/federation_client.go new file mode 100644 index 0000000..676204b --- /dev/null +++ b/client/federation/federation_client.go @@ -0,0 +1,227 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new federation API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new federation API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new federation API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for federation API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationActivityJSON sets the Accept header to "application/activity+json". +func WithAcceptApplicationActivityJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/activity+json"} +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + S2sFeaturedCollectionGet(params *S2sFeaturedCollectionGetParams, opts ...ClientOption) (*S2sFeaturedCollectionGetOK, error) + + S2sOutboxGet(params *S2sOutboxGetParams, opts ...ClientOption) (*S2sOutboxGetOK, error) + + S2sRepliesGet(params *S2sRepliesGetParams, opts ...ClientOption) (*S2sRepliesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + S2sFeaturedCollectionGet gets the featured collection pinned posts for a user + + The response will contain an ordered collection of Note URIs in the `items` property. + +It is up to the caller to dereference the provided Note URIs (or not, if they already have them cached). + +HTTP signature is required on the request. +*/ +func (a *Client) S2sFeaturedCollectionGet(params *S2sFeaturedCollectionGetParams, opts ...ClientOption) (*S2sFeaturedCollectionGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewS2sFeaturedCollectionGetParams() + } + op := &runtime.ClientOperation{ + ID: "s2sFeaturedCollectionGet", + Method: "GET", + PathPattern: "/users/{username}/collections/featured", + ProducesMediaTypes: []string{"application/activity+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &S2sFeaturedCollectionGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*S2sFeaturedCollectionGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for s2sFeaturedCollectionGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + S2sOutboxGet gets the public outbox collection for an actor + + Note that the response will be a Collection with a page as `first`, as shown below, if `page` is `false`. + +If `page` is `true`, then the response will be a single `CollectionPage` without the wrapping `Collection`. + +HTTP signature is required on the request. +*/ +func (a *Client) S2sOutboxGet(params *S2sOutboxGetParams, opts ...ClientOption) (*S2sOutboxGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewS2sOutboxGetParams() + } + op := &runtime.ClientOperation{ + ID: "s2sOutboxGet", + Method: "GET", + PathPattern: "/users/{username}/outbox", + ProducesMediaTypes: []string{"application/activity+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &S2sOutboxGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*S2sOutboxGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for s2sOutboxGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + S2sRepliesGet gets the replies collection for a status + + Note that the response will be a Collection with a page as `first`, as shown below, if `page` is `false`. + +If `page` is `true`, then the response will be a single `CollectionPage` without the wrapping `Collection`. + +HTTP signature is required on the request. +*/ +func (a *Client) S2sRepliesGet(params *S2sRepliesGetParams, opts ...ClientOption) (*S2sRepliesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewS2sRepliesGetParams() + } + op := &runtime.ClientOperation{ + ID: "s2sRepliesGet", + Method: "GET", + PathPattern: "/users/{username}/statuses/{status}/replies", + ProducesMediaTypes: []string{"application/activity+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &S2sRepliesGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*S2sRepliesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for s2sRepliesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/federation/s2s_featured_collection_get_parameters.go b/client/federation/s2s_featured_collection_get_parameters.go new file mode 100644 index 0000000..2e8b939 --- /dev/null +++ b/client/federation/s2s_featured_collection_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" +) + +// NewS2sFeaturedCollectionGetParams creates a new S2sFeaturedCollectionGetParams 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 NewS2sFeaturedCollectionGetParams() *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewS2sFeaturedCollectionGetParamsWithTimeout creates a new S2sFeaturedCollectionGetParams object +// with the ability to set a timeout on a request. +func NewS2sFeaturedCollectionGetParamsWithTimeout(timeout time.Duration) *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + timeout: timeout, + } +} + +// NewS2sFeaturedCollectionGetParamsWithContext creates a new S2sFeaturedCollectionGetParams object +// with the ability to set a context for a request. +func NewS2sFeaturedCollectionGetParamsWithContext(ctx context.Context) *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + Context: ctx, + } +} + +// NewS2sFeaturedCollectionGetParamsWithHTTPClient creates a new S2sFeaturedCollectionGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewS2sFeaturedCollectionGetParamsWithHTTPClient(client *http.Client) *S2sFeaturedCollectionGetParams { + return &S2sFeaturedCollectionGetParams{ + HTTPClient: client, + } +} + +/* +S2sFeaturedCollectionGetParams contains all the parameters to send to the API endpoint + + for the s2s featured collection get operation. + + Typically these are written to a http.Request. +*/ +type S2sFeaturedCollectionGetParams struct { + + /* Username. + + Account name of the user + */ + Username string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the s2s featured collection get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sFeaturedCollectionGetParams) WithDefaults() *S2sFeaturedCollectionGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the s2s featured collection get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sFeaturedCollectionGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithTimeout(timeout time.Duration) *S2sFeaturedCollectionGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithContext(ctx context.Context) *S2sFeaturedCollectionGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithHTTPClient(client *http.Client) *S2sFeaturedCollectionGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithUsername adds the username to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) WithUsername(username string) *S2sFeaturedCollectionGetParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the s2s featured collection get params +func (o *S2sFeaturedCollectionGetParams) SetUsername(username string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *S2sFeaturedCollectionGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param username + if err := r.SetPathParam("username", o.Username); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/federation/s2s_featured_collection_get_responses.go b/client/federation/s2s_featured_collection_get_responses.go new file mode 100644 index 0000000..a8f0eba --- /dev/null +++ b/client/federation/s2s_featured_collection_get_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// S2sFeaturedCollectionGetReader is a Reader for the S2sFeaturedCollectionGet structure. +type S2sFeaturedCollectionGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *S2sFeaturedCollectionGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewS2sFeaturedCollectionGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewS2sFeaturedCollectionGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewS2sFeaturedCollectionGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewS2sFeaturedCollectionGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewS2sFeaturedCollectionGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /users/{username}/collections/featured] s2sFeaturedCollectionGet", response, response.Code()) + } +} + +// NewS2sFeaturedCollectionGetOK creates a S2sFeaturedCollectionGetOK with default headers values +func NewS2sFeaturedCollectionGetOK() *S2sFeaturedCollectionGetOK { + return &S2sFeaturedCollectionGetOK{} +} + +/* +S2sFeaturedCollectionGetOK describes a response with status code 200, with default header values. + +S2sFeaturedCollectionGetOK s2s featured collection get o k +*/ +type S2sFeaturedCollectionGetOK struct { + Payload *models.SwaggerFeaturedCollection +} + +// IsSuccess returns true when this s2s featured collection get o k response has a 2xx status code +func (o *S2sFeaturedCollectionGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this s2s featured collection get o k response has a 3xx status code +func (o *S2sFeaturedCollectionGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get o k response has a 4xx status code +func (o *S2sFeaturedCollectionGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this s2s featured collection get o k response has a 5xx status code +func (o *S2sFeaturedCollectionGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get o k response a status code equal to that given +func (o *S2sFeaturedCollectionGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the s2s featured collection get o k response +func (o *S2sFeaturedCollectionGetOK) Code() int { + return 200 +} + +func (o *S2sFeaturedCollectionGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetOK %s", 200, payload) +} + +func (o *S2sFeaturedCollectionGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetOK %s", 200, payload) +} + +func (o *S2sFeaturedCollectionGetOK) GetPayload() *models.SwaggerFeaturedCollection { + return o.Payload +} + +func (o *S2sFeaturedCollectionGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SwaggerFeaturedCollection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewS2sFeaturedCollectionGetBadRequest creates a S2sFeaturedCollectionGetBadRequest with default headers values +func NewS2sFeaturedCollectionGetBadRequest() *S2sFeaturedCollectionGetBadRequest { + return &S2sFeaturedCollectionGetBadRequest{} +} + +/* +S2sFeaturedCollectionGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type S2sFeaturedCollectionGetBadRequest struct { +} + +// IsSuccess returns true when this s2s featured collection get bad request response has a 2xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get bad request response has a 3xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get bad request response has a 4xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get bad request response has a 5xx status code +func (o *S2sFeaturedCollectionGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get bad request response a status code equal to that given +func (o *S2sFeaturedCollectionGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the s2s featured collection get bad request response +func (o *S2sFeaturedCollectionGetBadRequest) Code() int { + return 400 +} + +func (o *S2sFeaturedCollectionGetBadRequest) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetBadRequest", 400) +} + +func (o *S2sFeaturedCollectionGetBadRequest) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetBadRequest", 400) +} + +func (o *S2sFeaturedCollectionGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sFeaturedCollectionGetUnauthorized creates a S2sFeaturedCollectionGetUnauthorized with default headers values +func NewS2sFeaturedCollectionGetUnauthorized() *S2sFeaturedCollectionGetUnauthorized { + return &S2sFeaturedCollectionGetUnauthorized{} +} + +/* +S2sFeaturedCollectionGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type S2sFeaturedCollectionGetUnauthorized struct { +} + +// IsSuccess returns true when this s2s featured collection get unauthorized response has a 2xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get unauthorized response has a 3xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get unauthorized response has a 4xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get unauthorized response has a 5xx status code +func (o *S2sFeaturedCollectionGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get unauthorized response a status code equal to that given +func (o *S2sFeaturedCollectionGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the s2s featured collection get unauthorized response +func (o *S2sFeaturedCollectionGetUnauthorized) Code() int { + return 401 +} + +func (o *S2sFeaturedCollectionGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetUnauthorized", 401) +} + +func (o *S2sFeaturedCollectionGetUnauthorized) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetUnauthorized", 401) +} + +func (o *S2sFeaturedCollectionGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sFeaturedCollectionGetForbidden creates a S2sFeaturedCollectionGetForbidden with default headers values +func NewS2sFeaturedCollectionGetForbidden() *S2sFeaturedCollectionGetForbidden { + return &S2sFeaturedCollectionGetForbidden{} +} + +/* +S2sFeaturedCollectionGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type S2sFeaturedCollectionGetForbidden struct { +} + +// IsSuccess returns true when this s2s featured collection get forbidden response has a 2xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get forbidden response has a 3xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get forbidden response has a 4xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get forbidden response has a 5xx status code +func (o *S2sFeaturedCollectionGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get forbidden response a status code equal to that given +func (o *S2sFeaturedCollectionGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the s2s featured collection get forbidden response +func (o *S2sFeaturedCollectionGetForbidden) Code() int { + return 403 +} + +func (o *S2sFeaturedCollectionGetForbidden) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetForbidden", 403) +} + +func (o *S2sFeaturedCollectionGetForbidden) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetForbidden", 403) +} + +func (o *S2sFeaturedCollectionGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sFeaturedCollectionGetNotFound creates a S2sFeaturedCollectionGetNotFound with default headers values +func NewS2sFeaturedCollectionGetNotFound() *S2sFeaturedCollectionGetNotFound { + return &S2sFeaturedCollectionGetNotFound{} +} + +/* +S2sFeaturedCollectionGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type S2sFeaturedCollectionGetNotFound struct { +} + +// IsSuccess returns true when this s2s featured collection get not found response has a 2xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s featured collection get not found response has a 3xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s featured collection get not found response has a 4xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s featured collection get not found response has a 5xx status code +func (o *S2sFeaturedCollectionGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s featured collection get not found response a status code equal to that given +func (o *S2sFeaturedCollectionGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the s2s featured collection get not found response +func (o *S2sFeaturedCollectionGetNotFound) Code() int { + return 404 +} + +func (o *S2sFeaturedCollectionGetNotFound) Error() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetNotFound", 404) +} + +func (o *S2sFeaturedCollectionGetNotFound) String() string { + return fmt.Sprintf("[GET /users/{username}/collections/featured][%d] s2sFeaturedCollectionGetNotFound", 404) +} + +func (o *S2sFeaturedCollectionGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/federation/s2s_outbox_get_parameters.go b/client/federation/s2s_outbox_get_parameters.go new file mode 100644 index 0000000..ae4262e --- /dev/null +++ b/client/federation/s2s_outbox_get_parameters.go @@ -0,0 +1,265 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" +) + +// NewS2sOutboxGetParams creates a new S2sOutboxGetParams 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 NewS2sOutboxGetParams() *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewS2sOutboxGetParamsWithTimeout creates a new S2sOutboxGetParams object +// with the ability to set a timeout on a request. +func NewS2sOutboxGetParamsWithTimeout(timeout time.Duration) *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + timeout: timeout, + } +} + +// NewS2sOutboxGetParamsWithContext creates a new S2sOutboxGetParams object +// with the ability to set a context for a request. +func NewS2sOutboxGetParamsWithContext(ctx context.Context) *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + Context: ctx, + } +} + +// NewS2sOutboxGetParamsWithHTTPClient creates a new S2sOutboxGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewS2sOutboxGetParamsWithHTTPClient(client *http.Client) *S2sOutboxGetParams { + return &S2sOutboxGetParams{ + HTTPClient: client, + } +} + +/* +S2sOutboxGetParams contains all the parameters to send to the API endpoint + + for the s2s outbox get operation. + + Typically these are written to a http.Request. +*/ +type S2sOutboxGetParams struct { + + /* MaxID. + + Maximum ID of the next status, used for paging. + */ + MaxID *string + + /* MinID. + + Minimum ID of the next status, used for paging. + */ + MinID *string + + /* Page. + + Return response as a CollectionPage. + */ + Page *bool + + /* Username. + + Username of the account. + */ + Username string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the s2s outbox get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sOutboxGetParams) WithDefaults() *S2sOutboxGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the s2s outbox get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sOutboxGetParams) SetDefaults() { + var ( + pageDefault = bool(false) + ) + + val := S2sOutboxGetParams{ + Page: &pageDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the s2s outbox get params +func (o *S2sOutboxGetParams) WithTimeout(timeout time.Duration) *S2sOutboxGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the s2s outbox get params +func (o *S2sOutboxGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the s2s outbox get params +func (o *S2sOutboxGetParams) WithContext(ctx context.Context) *S2sOutboxGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the s2s outbox get params +func (o *S2sOutboxGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the s2s outbox get params +func (o *S2sOutboxGetParams) WithHTTPClient(client *http.Client) *S2sOutboxGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the s2s outbox get params +func (o *S2sOutboxGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMaxID adds the maxID to the s2s outbox get params +func (o *S2sOutboxGetParams) WithMaxID(maxID *string) *S2sOutboxGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the s2s outbox get params +func (o *S2sOutboxGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the s2s outbox get params +func (o *S2sOutboxGetParams) WithMinID(minID *string) *S2sOutboxGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the s2s outbox get params +func (o *S2sOutboxGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithPage adds the page to the s2s outbox get params +func (o *S2sOutboxGetParams) WithPage(page *bool) *S2sOutboxGetParams { + o.SetPage(page) + return o +} + +// SetPage adds the page to the s2s outbox get params +func (o *S2sOutboxGetParams) SetPage(page *bool) { + o.Page = page +} + +// WithUsername adds the username to the s2s outbox get params +func (o *S2sOutboxGetParams) WithUsername(username string) *S2sOutboxGetParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the s2s outbox get params +func (o *S2sOutboxGetParams) SetUsername(username string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *S2sOutboxGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + 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.Page != nil { + + // query param page + var qrPage bool + + if o.Page != nil { + qrPage = *o.Page + } + qPage := swag.FormatBool(qrPage) + if qPage != "" { + + if err := r.SetQueryParam("page", qPage); err != nil { + return err + } + } + } + + // path param username + if err := r.SetPathParam("username", o.Username); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/federation/s2s_outbox_get_responses.go b/client/federation/s2s_outbox_get_responses.go new file mode 100644 index 0000000..b100a79 --- /dev/null +++ b/client/federation/s2s_outbox_get_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// S2sOutboxGetReader is a Reader for the S2sOutboxGet structure. +type S2sOutboxGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *S2sOutboxGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewS2sOutboxGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewS2sOutboxGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewS2sOutboxGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewS2sOutboxGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewS2sOutboxGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /users/{username}/outbox] s2sOutboxGet", response, response.Code()) + } +} + +// NewS2sOutboxGetOK creates a S2sOutboxGetOK with default headers values +func NewS2sOutboxGetOK() *S2sOutboxGetOK { + return &S2sOutboxGetOK{} +} + +/* +S2sOutboxGetOK describes a response with status code 200, with default header values. + +S2sOutboxGetOK s2s outbox get o k +*/ +type S2sOutboxGetOK struct { + Payload *models.SwaggerCollection +} + +// IsSuccess returns true when this s2s outbox get o k response has a 2xx status code +func (o *S2sOutboxGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this s2s outbox get o k response has a 3xx status code +func (o *S2sOutboxGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get o k response has a 4xx status code +func (o *S2sOutboxGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this s2s outbox get o k response has a 5xx status code +func (o *S2sOutboxGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get o k response a status code equal to that given +func (o *S2sOutboxGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the s2s outbox get o k response +func (o *S2sOutboxGetOK) Code() int { + return 200 +} + +func (o *S2sOutboxGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetOK %s", 200, payload) +} + +func (o *S2sOutboxGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetOK %s", 200, payload) +} + +func (o *S2sOutboxGetOK) GetPayload() *models.SwaggerCollection { + return o.Payload +} + +func (o *S2sOutboxGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SwaggerCollection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewS2sOutboxGetBadRequest creates a S2sOutboxGetBadRequest with default headers values +func NewS2sOutboxGetBadRequest() *S2sOutboxGetBadRequest { + return &S2sOutboxGetBadRequest{} +} + +/* +S2sOutboxGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type S2sOutboxGetBadRequest struct { +} + +// IsSuccess returns true when this s2s outbox get bad request response has a 2xx status code +func (o *S2sOutboxGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get bad request response has a 3xx status code +func (o *S2sOutboxGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get bad request response has a 4xx status code +func (o *S2sOutboxGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get bad request response has a 5xx status code +func (o *S2sOutboxGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get bad request response a status code equal to that given +func (o *S2sOutboxGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the s2s outbox get bad request response +func (o *S2sOutboxGetBadRequest) Code() int { + return 400 +} + +func (o *S2sOutboxGetBadRequest) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetBadRequest", 400) +} + +func (o *S2sOutboxGetBadRequest) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetBadRequest", 400) +} + +func (o *S2sOutboxGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sOutboxGetUnauthorized creates a S2sOutboxGetUnauthorized with default headers values +func NewS2sOutboxGetUnauthorized() *S2sOutboxGetUnauthorized { + return &S2sOutboxGetUnauthorized{} +} + +/* +S2sOutboxGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type S2sOutboxGetUnauthorized struct { +} + +// IsSuccess returns true when this s2s outbox get unauthorized response has a 2xx status code +func (o *S2sOutboxGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get unauthorized response has a 3xx status code +func (o *S2sOutboxGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get unauthorized response has a 4xx status code +func (o *S2sOutboxGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get unauthorized response has a 5xx status code +func (o *S2sOutboxGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get unauthorized response a status code equal to that given +func (o *S2sOutboxGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the s2s outbox get unauthorized response +func (o *S2sOutboxGetUnauthorized) Code() int { + return 401 +} + +func (o *S2sOutboxGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetUnauthorized", 401) +} + +func (o *S2sOutboxGetUnauthorized) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetUnauthorized", 401) +} + +func (o *S2sOutboxGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sOutboxGetForbidden creates a S2sOutboxGetForbidden with default headers values +func NewS2sOutboxGetForbidden() *S2sOutboxGetForbidden { + return &S2sOutboxGetForbidden{} +} + +/* +S2sOutboxGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type S2sOutboxGetForbidden struct { +} + +// IsSuccess returns true when this s2s outbox get forbidden response has a 2xx status code +func (o *S2sOutboxGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get forbidden response has a 3xx status code +func (o *S2sOutboxGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get forbidden response has a 4xx status code +func (o *S2sOutboxGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get forbidden response has a 5xx status code +func (o *S2sOutboxGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get forbidden response a status code equal to that given +func (o *S2sOutboxGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the s2s outbox get forbidden response +func (o *S2sOutboxGetForbidden) Code() int { + return 403 +} + +func (o *S2sOutboxGetForbidden) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetForbidden", 403) +} + +func (o *S2sOutboxGetForbidden) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetForbidden", 403) +} + +func (o *S2sOutboxGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sOutboxGetNotFound creates a S2sOutboxGetNotFound with default headers values +func NewS2sOutboxGetNotFound() *S2sOutboxGetNotFound { + return &S2sOutboxGetNotFound{} +} + +/* +S2sOutboxGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type S2sOutboxGetNotFound struct { +} + +// IsSuccess returns true when this s2s outbox get not found response has a 2xx status code +func (o *S2sOutboxGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s outbox get not found response has a 3xx status code +func (o *S2sOutboxGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s outbox get not found response has a 4xx status code +func (o *S2sOutboxGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s outbox get not found response has a 5xx status code +func (o *S2sOutboxGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s outbox get not found response a status code equal to that given +func (o *S2sOutboxGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the s2s outbox get not found response +func (o *S2sOutboxGetNotFound) Code() int { + return 404 +} + +func (o *S2sOutboxGetNotFound) Error() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetNotFound", 404) +} + +func (o *S2sOutboxGetNotFound) String() string { + return fmt.Sprintf("[GET /users/{username}/outbox][%d] s2sOutboxGetNotFound", 404) +} + +func (o *S2sOutboxGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/federation/s2s_replies_get_parameters.go b/client/federation/s2s_replies_get_parameters.go new file mode 100644 index 0000000..ab9f52f --- /dev/null +++ b/client/federation/s2s_replies_get_parameters.go @@ -0,0 +1,290 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// 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" +) + +// NewS2sRepliesGetParams creates a new S2sRepliesGetParams 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 NewS2sRepliesGetParams() *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewS2sRepliesGetParamsWithTimeout creates a new S2sRepliesGetParams object +// with the ability to set a timeout on a request. +func NewS2sRepliesGetParamsWithTimeout(timeout time.Duration) *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + timeout: timeout, + } +} + +// NewS2sRepliesGetParamsWithContext creates a new S2sRepliesGetParams object +// with the ability to set a context for a request. +func NewS2sRepliesGetParamsWithContext(ctx context.Context) *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + Context: ctx, + } +} + +// NewS2sRepliesGetParamsWithHTTPClient creates a new S2sRepliesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewS2sRepliesGetParamsWithHTTPClient(client *http.Client) *S2sRepliesGetParams { + return &S2sRepliesGetParams{ + HTTPClient: client, + } +} + +/* +S2sRepliesGetParams contains all the parameters to send to the API endpoint + + for the s2s replies get operation. + + Typically these are written to a http.Request. +*/ +type S2sRepliesGetParams struct { + + /* MinID. + + Minimum ID of the next status, used for paging. + */ + MinID *string + + /* OnlyOtherAccounts. + + Return replies only from accounts other than the status owner. + */ + OnlyOtherAccounts *bool + + /* Page. + + Return response as a CollectionPage. + */ + Page *bool + + /* Status. + + ID of the status. + */ + Status string + + /* Username. + + Username of the account. + */ + Username string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the s2s replies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sRepliesGetParams) WithDefaults() *S2sRepliesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the s2s replies get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *S2sRepliesGetParams) SetDefaults() { + var ( + onlyOtherAccountsDefault = bool(false) + + pageDefault = bool(false) + ) + + val := S2sRepliesGetParams{ + OnlyOtherAccounts: &onlyOtherAccountsDefault, + Page: &pageDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the s2s replies get params +func (o *S2sRepliesGetParams) WithTimeout(timeout time.Duration) *S2sRepliesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the s2s replies get params +func (o *S2sRepliesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the s2s replies get params +func (o *S2sRepliesGetParams) WithContext(ctx context.Context) *S2sRepliesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the s2s replies get params +func (o *S2sRepliesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the s2s replies get params +func (o *S2sRepliesGetParams) WithHTTPClient(client *http.Client) *S2sRepliesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the s2s replies get params +func (o *S2sRepliesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithMinID adds the minID to the s2s replies get params +func (o *S2sRepliesGetParams) WithMinID(minID *string) *S2sRepliesGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the s2s replies get params +func (o *S2sRepliesGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOnlyOtherAccounts adds the onlyOtherAccounts to the s2s replies get params +func (o *S2sRepliesGetParams) WithOnlyOtherAccounts(onlyOtherAccounts *bool) *S2sRepliesGetParams { + o.SetOnlyOtherAccounts(onlyOtherAccounts) + return o +} + +// SetOnlyOtherAccounts adds the onlyOtherAccounts to the s2s replies get params +func (o *S2sRepliesGetParams) SetOnlyOtherAccounts(onlyOtherAccounts *bool) { + o.OnlyOtherAccounts = onlyOtherAccounts +} + +// WithPage adds the page to the s2s replies get params +func (o *S2sRepliesGetParams) WithPage(page *bool) *S2sRepliesGetParams { + o.SetPage(page) + return o +} + +// SetPage adds the page to the s2s replies get params +func (o *S2sRepliesGetParams) SetPage(page *bool) { + o.Page = page +} + +// WithStatus adds the status to the s2s replies get params +func (o *S2sRepliesGetParams) WithStatus(status string) *S2sRepliesGetParams { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the s2s replies get params +func (o *S2sRepliesGetParams) SetStatus(status string) { + o.Status = status +} + +// WithUsername adds the username to the s2s replies get params +func (o *S2sRepliesGetParams) WithUsername(username string) *S2sRepliesGetParams { + o.SetUsername(username) + return o +} + +// SetUsername adds the username to the s2s replies get params +func (o *S2sRepliesGetParams) SetUsername(username string) { + o.Username = username +} + +// WriteToRequest writes these params to a swagger request +func (o *S2sRepliesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + 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.OnlyOtherAccounts != nil { + + // query param only_other_accounts + var qrOnlyOtherAccounts bool + + if o.OnlyOtherAccounts != nil { + qrOnlyOtherAccounts = *o.OnlyOtherAccounts + } + qOnlyOtherAccounts := swag.FormatBool(qrOnlyOtherAccounts) + if qOnlyOtherAccounts != "" { + + if err := r.SetQueryParam("only_other_accounts", qOnlyOtherAccounts); err != nil { + return err + } + } + } + + if o.Page != nil { + + // query param page + var qrPage bool + + if o.Page != nil { + qrPage = *o.Page + } + qPage := swag.FormatBool(qrPage) + if qPage != "" { + + if err := r.SetQueryParam("page", qPage); err != nil { + return err + } + } + } + + // path param status + if err := r.SetPathParam("status", o.Status); err != nil { + return err + } + + // path param username + if err := r.SetPathParam("username", o.Username); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/federation/s2s_replies_get_responses.go b/client/federation/s2s_replies_get_responses.go new file mode 100644 index 0000000..7b6ac36 --- /dev/null +++ b/client/federation/s2s_replies_get_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package federation + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// S2sRepliesGetReader is a Reader for the S2sRepliesGet structure. +type S2sRepliesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *S2sRepliesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewS2sRepliesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewS2sRepliesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewS2sRepliesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewS2sRepliesGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewS2sRepliesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /users/{username}/statuses/{status}/replies] s2sRepliesGet", response, response.Code()) + } +} + +// NewS2sRepliesGetOK creates a S2sRepliesGetOK with default headers values +func NewS2sRepliesGetOK() *S2sRepliesGetOK { + return &S2sRepliesGetOK{} +} + +/* +S2sRepliesGetOK describes a response with status code 200, with default header values. + +S2sRepliesGetOK s2s replies get o k +*/ +type S2sRepliesGetOK struct { + Payload *models.SwaggerCollection +} + +// IsSuccess returns true when this s2s replies get o k response has a 2xx status code +func (o *S2sRepliesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this s2s replies get o k response has a 3xx status code +func (o *S2sRepliesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get o k response has a 4xx status code +func (o *S2sRepliesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this s2s replies get o k response has a 5xx status code +func (o *S2sRepliesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get o k response a status code equal to that given +func (o *S2sRepliesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the s2s replies get o k response +func (o *S2sRepliesGetOK) Code() int { + return 200 +} + +func (o *S2sRepliesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetOK %s", 200, payload) +} + +func (o *S2sRepliesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetOK %s", 200, payload) +} + +func (o *S2sRepliesGetOK) GetPayload() *models.SwaggerCollection { + return o.Payload +} + +func (o *S2sRepliesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SwaggerCollection) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewS2sRepliesGetBadRequest creates a S2sRepliesGetBadRequest with default headers values +func NewS2sRepliesGetBadRequest() *S2sRepliesGetBadRequest { + return &S2sRepliesGetBadRequest{} +} + +/* +S2sRepliesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type S2sRepliesGetBadRequest struct { +} + +// IsSuccess returns true when this s2s replies get bad request response has a 2xx status code +func (o *S2sRepliesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get bad request response has a 3xx status code +func (o *S2sRepliesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get bad request response has a 4xx status code +func (o *S2sRepliesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get bad request response has a 5xx status code +func (o *S2sRepliesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get bad request response a status code equal to that given +func (o *S2sRepliesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the s2s replies get bad request response +func (o *S2sRepliesGetBadRequest) Code() int { + return 400 +} + +func (o *S2sRepliesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetBadRequest", 400) +} + +func (o *S2sRepliesGetBadRequest) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetBadRequest", 400) +} + +func (o *S2sRepliesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sRepliesGetUnauthorized creates a S2sRepliesGetUnauthorized with default headers values +func NewS2sRepliesGetUnauthorized() *S2sRepliesGetUnauthorized { + return &S2sRepliesGetUnauthorized{} +} + +/* +S2sRepliesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type S2sRepliesGetUnauthorized struct { +} + +// IsSuccess returns true when this s2s replies get unauthorized response has a 2xx status code +func (o *S2sRepliesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get unauthorized response has a 3xx status code +func (o *S2sRepliesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get unauthorized response has a 4xx status code +func (o *S2sRepliesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get unauthorized response has a 5xx status code +func (o *S2sRepliesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get unauthorized response a status code equal to that given +func (o *S2sRepliesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the s2s replies get unauthorized response +func (o *S2sRepliesGetUnauthorized) Code() int { + return 401 +} + +func (o *S2sRepliesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetUnauthorized", 401) +} + +func (o *S2sRepliesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetUnauthorized", 401) +} + +func (o *S2sRepliesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sRepliesGetForbidden creates a S2sRepliesGetForbidden with default headers values +func NewS2sRepliesGetForbidden() *S2sRepliesGetForbidden { + return &S2sRepliesGetForbidden{} +} + +/* +S2sRepliesGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type S2sRepliesGetForbidden struct { +} + +// IsSuccess returns true when this s2s replies get forbidden response has a 2xx status code +func (o *S2sRepliesGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get forbidden response has a 3xx status code +func (o *S2sRepliesGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get forbidden response has a 4xx status code +func (o *S2sRepliesGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get forbidden response has a 5xx status code +func (o *S2sRepliesGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get forbidden response a status code equal to that given +func (o *S2sRepliesGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the s2s replies get forbidden response +func (o *S2sRepliesGetForbidden) Code() int { + return 403 +} + +func (o *S2sRepliesGetForbidden) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetForbidden", 403) +} + +func (o *S2sRepliesGetForbidden) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetForbidden", 403) +} + +func (o *S2sRepliesGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewS2sRepliesGetNotFound creates a S2sRepliesGetNotFound with default headers values +func NewS2sRepliesGetNotFound() *S2sRepliesGetNotFound { + return &S2sRepliesGetNotFound{} +} + +/* +S2sRepliesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type S2sRepliesGetNotFound struct { +} + +// IsSuccess returns true when this s2s replies get not found response has a 2xx status code +func (o *S2sRepliesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this s2s replies get not found response has a 3xx status code +func (o *S2sRepliesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this s2s replies get not found response has a 4xx status code +func (o *S2sRepliesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this s2s replies get not found response has a 5xx status code +func (o *S2sRepliesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this s2s replies get not found response a status code equal to that given +func (o *S2sRepliesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the s2s replies get not found response +func (o *S2sRepliesGetNotFound) Code() int { + return 404 +} + +func (o *S2sRepliesGetNotFound) Error() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetNotFound", 404) +} + +func (o *S2sRepliesGetNotFound) String() string { + return fmt.Sprintf("[GET /users/{username}/statuses/{status}/replies][%d] s2sRepliesGetNotFound", 404) +} + +func (o *S2sRepliesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_keyword_delete_parameters.go b/client/filters/filter_keyword_delete_parameters.go new file mode 100644 index 0000000..e4e93f6 --- /dev/null +++ b/client/filters/filter_keyword_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordDeleteParams creates a new FilterKeywordDeleteParams 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 NewFilterKeywordDeleteParams() *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordDeleteParamsWithTimeout creates a new FilterKeywordDeleteParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordDeleteParamsWithTimeout(timeout time.Duration) *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + timeout: timeout, + } +} + +// NewFilterKeywordDeleteParamsWithContext creates a new FilterKeywordDeleteParams object +// with the ability to set a context for a request. +func NewFilterKeywordDeleteParamsWithContext(ctx context.Context) *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + Context: ctx, + } +} + +// NewFilterKeywordDeleteParamsWithHTTPClient creates a new FilterKeywordDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordDeleteParamsWithHTTPClient(client *http.Client) *FilterKeywordDeleteParams { + return &FilterKeywordDeleteParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordDeleteParams contains all the parameters to send to the API endpoint + + for the filter keyword delete operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordDeleteParams struct { + + /* ID. + + ID of the filter keyword + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordDeleteParams) WithDefaults() *FilterKeywordDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithTimeout(timeout time.Duration) *FilterKeywordDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithContext(ctx context.Context) *FilterKeywordDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithHTTPClient(client *http.Client) *FilterKeywordDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword delete params +func (o *FilterKeywordDeleteParams) WithID(id string) *FilterKeywordDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword delete params +func (o *FilterKeywordDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_keyword_delete_responses.go b/client/filters/filter_keyword_delete_responses.go new file mode 100644 index 0000000..963d7e0 --- /dev/null +++ b/client/filters/filter_keyword_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// FilterKeywordDeleteReader is a Reader for the FilterKeywordDelete structure. +type FilterKeywordDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/filters/keywords/{id}] filterKeywordDelete", response, response.Code()) + } +} + +// NewFilterKeywordDeleteOK creates a FilterKeywordDeleteOK with default headers values +func NewFilterKeywordDeleteOK() *FilterKeywordDeleteOK { + return &FilterKeywordDeleteOK{} +} + +/* +FilterKeywordDeleteOK describes a response with status code 200, with default header values. + +filter keyword deleted +*/ +type FilterKeywordDeleteOK struct { +} + +// IsSuccess returns true when this filter keyword delete o k response has a 2xx status code +func (o *FilterKeywordDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword delete o k response has a 3xx status code +func (o *FilterKeywordDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete o k response has a 4xx status code +func (o *FilterKeywordDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword delete o k response has a 5xx status code +func (o *FilterKeywordDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete o k response a status code equal to that given +func (o *FilterKeywordDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword delete o k response +func (o *FilterKeywordDeleteOK) Code() int { + return 200 +} + +func (o *FilterKeywordDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteOK", 200) +} + +func (o *FilterKeywordDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteOK", 200) +} + +func (o *FilterKeywordDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteBadRequest creates a FilterKeywordDeleteBadRequest with default headers values +func NewFilterKeywordDeleteBadRequest() *FilterKeywordDeleteBadRequest { + return &FilterKeywordDeleteBadRequest{} +} + +/* +FilterKeywordDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordDeleteBadRequest struct { +} + +// IsSuccess returns true when this filter keyword delete bad request response has a 2xx status code +func (o *FilterKeywordDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete bad request response has a 3xx status code +func (o *FilterKeywordDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete bad request response has a 4xx status code +func (o *FilterKeywordDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete bad request response has a 5xx status code +func (o *FilterKeywordDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete bad request response a status code equal to that given +func (o *FilterKeywordDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword delete bad request response +func (o *FilterKeywordDeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteBadRequest", 400) +} + +func (o *FilterKeywordDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteBadRequest", 400) +} + +func (o *FilterKeywordDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteUnauthorized creates a FilterKeywordDeleteUnauthorized with default headers values +func NewFilterKeywordDeleteUnauthorized() *FilterKeywordDeleteUnauthorized { + return &FilterKeywordDeleteUnauthorized{} +} + +/* +FilterKeywordDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordDeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword delete unauthorized response has a 2xx status code +func (o *FilterKeywordDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete unauthorized response has a 3xx status code +func (o *FilterKeywordDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete unauthorized response has a 4xx status code +func (o *FilterKeywordDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete unauthorized response has a 5xx status code +func (o *FilterKeywordDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete unauthorized response a status code equal to that given +func (o *FilterKeywordDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword delete unauthorized response +func (o *FilterKeywordDeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteUnauthorized", 401) +} + +func (o *FilterKeywordDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteUnauthorized", 401) +} + +func (o *FilterKeywordDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteNotFound creates a FilterKeywordDeleteNotFound with default headers values +func NewFilterKeywordDeleteNotFound() *FilterKeywordDeleteNotFound { + return &FilterKeywordDeleteNotFound{} +} + +/* +FilterKeywordDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordDeleteNotFound struct { +} + +// IsSuccess returns true when this filter keyword delete not found response has a 2xx status code +func (o *FilterKeywordDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete not found response has a 3xx status code +func (o *FilterKeywordDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete not found response has a 4xx status code +func (o *FilterKeywordDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete not found response has a 5xx status code +func (o *FilterKeywordDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete not found response a status code equal to that given +func (o *FilterKeywordDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword delete not found response +func (o *FilterKeywordDeleteNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotFound", 404) +} + +func (o *FilterKeywordDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotFound", 404) +} + +func (o *FilterKeywordDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteNotAcceptable creates a FilterKeywordDeleteNotAcceptable with default headers values +func NewFilterKeywordDeleteNotAcceptable() *FilterKeywordDeleteNotAcceptable { + return &FilterKeywordDeleteNotAcceptable{} +} + +/* +FilterKeywordDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword delete not acceptable response has a 2xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete not acceptable response has a 3xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete not acceptable response has a 4xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword delete not acceptable response has a 5xx status code +func (o *FilterKeywordDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword delete not acceptable response a status code equal to that given +func (o *FilterKeywordDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword delete not acceptable response +func (o *FilterKeywordDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotAcceptable", 406) +} + +func (o *FilterKeywordDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteNotAcceptable", 406) +} + +func (o *FilterKeywordDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordDeleteInternalServerError creates a FilterKeywordDeleteInternalServerError with default headers values +func NewFilterKeywordDeleteInternalServerError() *FilterKeywordDeleteInternalServerError { + return &FilterKeywordDeleteInternalServerError{} +} + +/* +FilterKeywordDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordDeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword delete internal server error response has a 2xx status code +func (o *FilterKeywordDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword delete internal server error response has a 3xx status code +func (o *FilterKeywordDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword delete internal server error response has a 4xx status code +func (o *FilterKeywordDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword delete internal server error response has a 5xx status code +func (o *FilterKeywordDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword delete internal server error response a status code equal to that given +func (o *FilterKeywordDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword delete internal server error response +func (o *FilterKeywordDeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteInternalServerError", 500) +} + +func (o *FilterKeywordDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/keywords/{id}][%d] filterKeywordDeleteInternalServerError", 500) +} + +func (o *FilterKeywordDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_keyword_get_parameters.go b/client/filters/filter_keyword_get_parameters.go new file mode 100644 index 0000000..acaeefc --- /dev/null +++ b/client/filters/filter_keyword_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordGetParams creates a new FilterKeywordGetParams 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 NewFilterKeywordGetParams() *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordGetParamsWithTimeout creates a new FilterKeywordGetParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordGetParamsWithTimeout(timeout time.Duration) *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + timeout: timeout, + } +} + +// NewFilterKeywordGetParamsWithContext creates a new FilterKeywordGetParams object +// with the ability to set a context for a request. +func NewFilterKeywordGetParamsWithContext(ctx context.Context) *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + Context: ctx, + } +} + +// NewFilterKeywordGetParamsWithHTTPClient creates a new FilterKeywordGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordGetParamsWithHTTPClient(client *http.Client) *FilterKeywordGetParams { + return &FilterKeywordGetParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordGetParams contains all the parameters to send to the API endpoint + + for the filter keyword get operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordGetParams struct { + + /* ID. + + ID of the filter keyword + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordGetParams) WithDefaults() *FilterKeywordGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keyword get params +func (o *FilterKeywordGetParams) WithTimeout(timeout time.Duration) *FilterKeywordGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword get params +func (o *FilterKeywordGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword get params +func (o *FilterKeywordGetParams) WithContext(ctx context.Context) *FilterKeywordGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword get params +func (o *FilterKeywordGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword get params +func (o *FilterKeywordGetParams) WithHTTPClient(client *http.Client) *FilterKeywordGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword get params +func (o *FilterKeywordGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword get params +func (o *FilterKeywordGetParams) WithID(id string) *FilterKeywordGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword get params +func (o *FilterKeywordGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_keyword_get_responses.go b/client/filters/filter_keyword_get_responses.go new file mode 100644 index 0000000..e9c91b3 --- /dev/null +++ b/client/filters/filter_keyword_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordGetReader is a Reader for the FilterKeywordGet structure. +type FilterKeywordGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/keywords/{id}] filterKeywordGet", response, response.Code()) + } +} + +// NewFilterKeywordGetOK creates a FilterKeywordGetOK with default headers values +func NewFilterKeywordGetOK() *FilterKeywordGetOK { + return &FilterKeywordGetOK{} +} + +/* +FilterKeywordGetOK describes a response with status code 200, with default header values. + +Requested filter keyword. +*/ +type FilterKeywordGetOK struct { + Payload *models.FilterKeyword +} + +// IsSuccess returns true when this filter keyword get o k response has a 2xx status code +func (o *FilterKeywordGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword get o k response has a 3xx status code +func (o *FilterKeywordGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get o k response has a 4xx status code +func (o *FilterKeywordGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword get o k response has a 5xx status code +func (o *FilterKeywordGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get o k response a status code equal to that given +func (o *FilterKeywordGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword get o k response +func (o *FilterKeywordGetOK) Code() int { + return 200 +} + +func (o *FilterKeywordGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetOK %s", 200, payload) +} + +func (o *FilterKeywordGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetOK %s", 200, payload) +} + +func (o *FilterKeywordGetOK) GetPayload() *models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterKeyword) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterKeywordGetBadRequest creates a FilterKeywordGetBadRequest with default headers values +func NewFilterKeywordGetBadRequest() *FilterKeywordGetBadRequest { + return &FilterKeywordGetBadRequest{} +} + +/* +FilterKeywordGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordGetBadRequest struct { +} + +// IsSuccess returns true when this filter keyword get bad request response has a 2xx status code +func (o *FilterKeywordGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get bad request response has a 3xx status code +func (o *FilterKeywordGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get bad request response has a 4xx status code +func (o *FilterKeywordGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get bad request response has a 5xx status code +func (o *FilterKeywordGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get bad request response a status code equal to that given +func (o *FilterKeywordGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword get bad request response +func (o *FilterKeywordGetBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetBadRequest", 400) +} + +func (o *FilterKeywordGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetBadRequest", 400) +} + +func (o *FilterKeywordGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetUnauthorized creates a FilterKeywordGetUnauthorized with default headers values +func NewFilterKeywordGetUnauthorized() *FilterKeywordGetUnauthorized { + return &FilterKeywordGetUnauthorized{} +} + +/* +FilterKeywordGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordGetUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword get unauthorized response has a 2xx status code +func (o *FilterKeywordGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get unauthorized response has a 3xx status code +func (o *FilterKeywordGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get unauthorized response has a 4xx status code +func (o *FilterKeywordGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get unauthorized response has a 5xx status code +func (o *FilterKeywordGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get unauthorized response a status code equal to that given +func (o *FilterKeywordGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword get unauthorized response +func (o *FilterKeywordGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetUnauthorized", 401) +} + +func (o *FilterKeywordGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetUnauthorized", 401) +} + +func (o *FilterKeywordGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetNotFound creates a FilterKeywordGetNotFound with default headers values +func NewFilterKeywordGetNotFound() *FilterKeywordGetNotFound { + return &FilterKeywordGetNotFound{} +} + +/* +FilterKeywordGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordGetNotFound struct { +} + +// IsSuccess returns true when this filter keyword get not found response has a 2xx status code +func (o *FilterKeywordGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get not found response has a 3xx status code +func (o *FilterKeywordGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get not found response has a 4xx status code +func (o *FilterKeywordGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get not found response has a 5xx status code +func (o *FilterKeywordGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get not found response a status code equal to that given +func (o *FilterKeywordGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword get not found response +func (o *FilterKeywordGetNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotFound", 404) +} + +func (o *FilterKeywordGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotFound", 404) +} + +func (o *FilterKeywordGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetNotAcceptable creates a FilterKeywordGetNotAcceptable with default headers values +func NewFilterKeywordGetNotAcceptable() *FilterKeywordGetNotAcceptable { + return &FilterKeywordGetNotAcceptable{} +} + +/* +FilterKeywordGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword get not acceptable response has a 2xx status code +func (o *FilterKeywordGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get not acceptable response has a 3xx status code +func (o *FilterKeywordGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get not acceptable response has a 4xx status code +func (o *FilterKeywordGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword get not acceptable response has a 5xx status code +func (o *FilterKeywordGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword get not acceptable response a status code equal to that given +func (o *FilterKeywordGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword get not acceptable response +func (o *FilterKeywordGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotAcceptable", 406) +} + +func (o *FilterKeywordGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetNotAcceptable", 406) +} + +func (o *FilterKeywordGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordGetInternalServerError creates a FilterKeywordGetInternalServerError with default headers values +func NewFilterKeywordGetInternalServerError() *FilterKeywordGetInternalServerError { + return &FilterKeywordGetInternalServerError{} +} + +/* +FilterKeywordGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordGetInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword get internal server error response has a 2xx status code +func (o *FilterKeywordGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword get internal server error response has a 3xx status code +func (o *FilterKeywordGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword get internal server error response has a 4xx status code +func (o *FilterKeywordGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword get internal server error response has a 5xx status code +func (o *FilterKeywordGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword get internal server error response a status code equal to that given +func (o *FilterKeywordGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword get internal server error response +func (o *FilterKeywordGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetInternalServerError", 500) +} + +func (o *FilterKeywordGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/keywords/{id}][%d] filterKeywordGetInternalServerError", 500) +} + +func (o *FilterKeywordGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_keyword_post_parameters.go b/client/filters/filter_keyword_post_parameters.go new file mode 100644 index 0000000..3f30666 --- /dev/null +++ b/client/filters/filter_keyword_post_parameters.go @@ -0,0 +1,225 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordPostParams creates a new FilterKeywordPostParams 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 NewFilterKeywordPostParams() *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordPostParamsWithTimeout creates a new FilterKeywordPostParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordPostParamsWithTimeout(timeout time.Duration) *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + timeout: timeout, + } +} + +// NewFilterKeywordPostParamsWithContext creates a new FilterKeywordPostParams object +// with the ability to set a context for a request. +func NewFilterKeywordPostParamsWithContext(ctx context.Context) *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + Context: ctx, + } +} + +// NewFilterKeywordPostParamsWithHTTPClient creates a new FilterKeywordPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordPostParamsWithHTTPClient(client *http.Client) *FilterKeywordPostParams { + return &FilterKeywordPostParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordPostParams contains all the parameters to send to the API endpoint + + for the filter keyword post operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordPostParams struct { + + /* ID. + + ID of the filter to add the filtered status to. + */ + ID string + + /* Keyword. + + The text to be filtered + + Sample: fnord + */ + Keyword string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPostParams) WithDefaults() *FilterKeywordPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPostParams) SetDefaults() { + var ( + wholeWordDefault = bool(false) + ) + + val := FilterKeywordPostParams{ + WholeWord: &wholeWordDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter keyword post params +func (o *FilterKeywordPostParams) WithTimeout(timeout time.Duration) *FilterKeywordPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword post params +func (o *FilterKeywordPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword post params +func (o *FilterKeywordPostParams) WithContext(ctx context.Context) *FilterKeywordPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword post params +func (o *FilterKeywordPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword post params +func (o *FilterKeywordPostParams) WithHTTPClient(client *http.Client) *FilterKeywordPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword post params +func (o *FilterKeywordPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword post params +func (o *FilterKeywordPostParams) WithID(id string) *FilterKeywordPostParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword post params +func (o *FilterKeywordPostParams) SetID(id string) { + o.ID = id +} + +// WithKeyword adds the keyword to the filter keyword post params +func (o *FilterKeywordPostParams) WithKeyword(keyword string) *FilterKeywordPostParams { + o.SetKeyword(keyword) + return o +} + +// SetKeyword adds the keyword to the filter keyword post params +func (o *FilterKeywordPostParams) SetKeyword(keyword string) { + o.Keyword = keyword +} + +// WithWholeWord adds the wholeWord to the filter keyword post params +func (o *FilterKeywordPostParams) WithWholeWord(wholeWord *bool) *FilterKeywordPostParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter keyword post params +func (o *FilterKeywordPostParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param keyword + frKeyword := o.Keyword + fKeyword := frKeyword + if fKeyword != "" { + if err := r.SetFormParam("keyword", fKeyword); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_keyword_post_responses.go b/client/filters/filter_keyword_post_responses.go new file mode 100644 index 0000000..7218efd --- /dev/null +++ b/client/filters/filter_keyword_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordPostReader is a Reader for the FilterKeywordPost structure. +type FilterKeywordPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterKeywordPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordPostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterKeywordPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterKeywordPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v2/filters/{id}/keywords] filterKeywordPost", response, response.Code()) + } +} + +// NewFilterKeywordPostOK creates a FilterKeywordPostOK with default headers values +func NewFilterKeywordPostOK() *FilterKeywordPostOK { + return &FilterKeywordPostOK{} +} + +/* +FilterKeywordPostOK describes a response with status code 200, with default header values. + +New filter keyword. +*/ +type FilterKeywordPostOK struct { + Payload *models.FilterKeyword +} + +// IsSuccess returns true when this filter keyword post o k response has a 2xx status code +func (o *FilterKeywordPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword post o k response has a 3xx status code +func (o *FilterKeywordPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post o k response has a 4xx status code +func (o *FilterKeywordPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword post o k response has a 5xx status code +func (o *FilterKeywordPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post o k response a status code equal to that given +func (o *FilterKeywordPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword post o k response +func (o *FilterKeywordPostOK) Code() int { + return 200 +} + +func (o *FilterKeywordPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostOK %s", 200, payload) +} + +func (o *FilterKeywordPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostOK %s", 200, payload) +} + +func (o *FilterKeywordPostOK) GetPayload() *models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterKeyword) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterKeywordPostBadRequest creates a FilterKeywordPostBadRequest with default headers values +func NewFilterKeywordPostBadRequest() *FilterKeywordPostBadRequest { + return &FilterKeywordPostBadRequest{} +} + +/* +FilterKeywordPostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordPostBadRequest struct { +} + +// IsSuccess returns true when this filter keyword post bad request response has a 2xx status code +func (o *FilterKeywordPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post bad request response has a 3xx status code +func (o *FilterKeywordPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post bad request response has a 4xx status code +func (o *FilterKeywordPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post bad request response has a 5xx status code +func (o *FilterKeywordPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post bad request response a status code equal to that given +func (o *FilterKeywordPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword post bad request response +func (o *FilterKeywordPostBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordPostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostBadRequest", 400) +} + +func (o *FilterKeywordPostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostBadRequest", 400) +} + +func (o *FilterKeywordPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostUnauthorized creates a FilterKeywordPostUnauthorized with default headers values +func NewFilterKeywordPostUnauthorized() *FilterKeywordPostUnauthorized { + return &FilterKeywordPostUnauthorized{} +} + +/* +FilterKeywordPostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordPostUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword post unauthorized response has a 2xx status code +func (o *FilterKeywordPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post unauthorized response has a 3xx status code +func (o *FilterKeywordPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post unauthorized response has a 4xx status code +func (o *FilterKeywordPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post unauthorized response has a 5xx status code +func (o *FilterKeywordPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post unauthorized response a status code equal to that given +func (o *FilterKeywordPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword post unauthorized response +func (o *FilterKeywordPostUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnauthorized", 401) +} + +func (o *FilterKeywordPostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnauthorized", 401) +} + +func (o *FilterKeywordPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostForbidden creates a FilterKeywordPostForbidden with default headers values +func NewFilterKeywordPostForbidden() *FilterKeywordPostForbidden { + return &FilterKeywordPostForbidden{} +} + +/* +FilterKeywordPostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterKeywordPostForbidden struct { +} + +// IsSuccess returns true when this filter keyword post forbidden response has a 2xx status code +func (o *FilterKeywordPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post forbidden response has a 3xx status code +func (o *FilterKeywordPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post forbidden response has a 4xx status code +func (o *FilterKeywordPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post forbidden response has a 5xx status code +func (o *FilterKeywordPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post forbidden response a status code equal to that given +func (o *FilterKeywordPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter keyword post forbidden response +func (o *FilterKeywordPostForbidden) Code() int { + return 403 +} + +func (o *FilterKeywordPostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostForbidden", 403) +} + +func (o *FilterKeywordPostForbidden) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostForbidden", 403) +} + +func (o *FilterKeywordPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostNotFound creates a FilterKeywordPostNotFound with default headers values +func NewFilterKeywordPostNotFound() *FilterKeywordPostNotFound { + return &FilterKeywordPostNotFound{} +} + +/* +FilterKeywordPostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordPostNotFound struct { +} + +// IsSuccess returns true when this filter keyword post not found response has a 2xx status code +func (o *FilterKeywordPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post not found response has a 3xx status code +func (o *FilterKeywordPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post not found response has a 4xx status code +func (o *FilterKeywordPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post not found response has a 5xx status code +func (o *FilterKeywordPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post not found response a status code equal to that given +func (o *FilterKeywordPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword post not found response +func (o *FilterKeywordPostNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordPostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotFound", 404) +} + +func (o *FilterKeywordPostNotFound) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotFound", 404) +} + +func (o *FilterKeywordPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostNotAcceptable creates a FilterKeywordPostNotAcceptable with default headers values +func NewFilterKeywordPostNotAcceptable() *FilterKeywordPostNotAcceptable { + return &FilterKeywordPostNotAcceptable{} +} + +/* +FilterKeywordPostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordPostNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword post not acceptable response has a 2xx status code +func (o *FilterKeywordPostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post not acceptable response has a 3xx status code +func (o *FilterKeywordPostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post not acceptable response has a 4xx status code +func (o *FilterKeywordPostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post not acceptable response has a 5xx status code +func (o *FilterKeywordPostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post not acceptable response a status code equal to that given +func (o *FilterKeywordPostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword post not acceptable response +func (o *FilterKeywordPostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordPostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotAcceptable", 406) +} + +func (o *FilterKeywordPostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostNotAcceptable", 406) +} + +func (o *FilterKeywordPostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostConflict creates a FilterKeywordPostConflict with default headers values +func NewFilterKeywordPostConflict() *FilterKeywordPostConflict { + return &FilterKeywordPostConflict{} +} + +/* +FilterKeywordPostConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterKeywordPostConflict struct { +} + +// IsSuccess returns true when this filter keyword post conflict response has a 2xx status code +func (o *FilterKeywordPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post conflict response has a 3xx status code +func (o *FilterKeywordPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post conflict response has a 4xx status code +func (o *FilterKeywordPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post conflict response has a 5xx status code +func (o *FilterKeywordPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post conflict response a status code equal to that given +func (o *FilterKeywordPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter keyword post conflict response +func (o *FilterKeywordPostConflict) Code() int { + return 409 +} + +func (o *FilterKeywordPostConflict) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostConflict", 409) +} + +func (o *FilterKeywordPostConflict) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostConflict", 409) +} + +func (o *FilterKeywordPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostUnprocessableEntity creates a FilterKeywordPostUnprocessableEntity with default headers values +func NewFilterKeywordPostUnprocessableEntity() *FilterKeywordPostUnprocessableEntity { + return &FilterKeywordPostUnprocessableEntity{} +} + +/* +FilterKeywordPostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterKeywordPostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter keyword post unprocessable entity response has a 2xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post unprocessable entity response has a 3xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post unprocessable entity response has a 4xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword post unprocessable entity response has a 5xx status code +func (o *FilterKeywordPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword post unprocessable entity response a status code equal to that given +func (o *FilterKeywordPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter keyword post unprocessable entity response +func (o *FilterKeywordPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterKeywordPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnprocessableEntity", 422) +} + +func (o *FilterKeywordPostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostUnprocessableEntity", 422) +} + +func (o *FilterKeywordPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPostInternalServerError creates a FilterKeywordPostInternalServerError with default headers values +func NewFilterKeywordPostInternalServerError() *FilterKeywordPostInternalServerError { + return &FilterKeywordPostInternalServerError{} +} + +/* +FilterKeywordPostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordPostInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword post internal server error response has a 2xx status code +func (o *FilterKeywordPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword post internal server error response has a 3xx status code +func (o *FilterKeywordPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword post internal server error response has a 4xx status code +func (o *FilterKeywordPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword post internal server error response has a 5xx status code +func (o *FilterKeywordPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword post internal server error response a status code equal to that given +func (o *FilterKeywordPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword post internal server error response +func (o *FilterKeywordPostInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostInternalServerError", 500) +} + +func (o *FilterKeywordPostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/keywords][%d] filterKeywordPostInternalServerError", 500) +} + +func (o *FilterKeywordPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_keyword_put_parameters.go b/client/filters/filter_keyword_put_parameters.go new file mode 100644 index 0000000..a3fddbf --- /dev/null +++ b/client/filters/filter_keyword_put_parameters.go @@ -0,0 +1,214 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordPutParams creates a new FilterKeywordPutParams 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 NewFilterKeywordPutParams() *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordPutParamsWithTimeout creates a new FilterKeywordPutParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordPutParamsWithTimeout(timeout time.Duration) *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + timeout: timeout, + } +} + +// NewFilterKeywordPutParamsWithContext creates a new FilterKeywordPutParams object +// with the ability to set a context for a request. +func NewFilterKeywordPutParamsWithContext(ctx context.Context) *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + Context: ctx, + } +} + +// NewFilterKeywordPutParamsWithHTTPClient creates a new FilterKeywordPutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordPutParamsWithHTTPClient(client *http.Client) *FilterKeywordPutParams { + return &FilterKeywordPutParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordPutParams contains all the parameters to send to the API endpoint + + for the filter keyword put operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordPutParams struct { + + /* ID. + + ID of the filter keyword to update. + */ + ID string + + /* Keyword. + + The text to be filtered + + Sample: fnord + */ + Keyword string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keyword put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPutParams) WithDefaults() *FilterKeywordPutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keyword put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordPutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keyword put params +func (o *FilterKeywordPutParams) WithTimeout(timeout time.Duration) *FilterKeywordPutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keyword put params +func (o *FilterKeywordPutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keyword put params +func (o *FilterKeywordPutParams) WithContext(ctx context.Context) *FilterKeywordPutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keyword put params +func (o *FilterKeywordPutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keyword put params +func (o *FilterKeywordPutParams) WithHTTPClient(client *http.Client) *FilterKeywordPutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keyword put params +func (o *FilterKeywordPutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keyword put params +func (o *FilterKeywordPutParams) WithID(id string) *FilterKeywordPutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keyword put params +func (o *FilterKeywordPutParams) SetID(id string) { + o.ID = id +} + +// WithKeyword adds the keyword to the filter keyword put params +func (o *FilterKeywordPutParams) WithKeyword(keyword string) *FilterKeywordPutParams { + o.SetKeyword(keyword) + return o +} + +// SetKeyword adds the keyword to the filter keyword put params +func (o *FilterKeywordPutParams) SetKeyword(keyword string) { + o.Keyword = keyword +} + +// WithWholeWord adds the wholeWord to the filter keyword put params +func (o *FilterKeywordPutParams) WithWholeWord(wholeWord *bool) *FilterKeywordPutParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter keyword put params +func (o *FilterKeywordPutParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordPutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param keyword + frKeyword := o.Keyword + fKeyword := frKeyword + if fKeyword != "" { + if err := r.SetFormParam("keyword", fKeyword); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_keyword_put_responses.go b/client/filters/filter_keyword_put_responses.go new file mode 100644 index 0000000..3d843c7 --- /dev/null +++ b/client/filters/filter_keyword_put_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordPutReader is a Reader for the FilterKeywordPut structure. +type FilterKeywordPutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordPutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordPutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordPutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordPutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterKeywordPutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordPutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordPutNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterKeywordPutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterKeywordPutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordPutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v2/filters/keywords{id}] filterKeywordPut", response, response.Code()) + } +} + +// NewFilterKeywordPutOK creates a FilterKeywordPutOK with default headers values +func NewFilterKeywordPutOK() *FilterKeywordPutOK { + return &FilterKeywordPutOK{} +} + +/* +FilterKeywordPutOK describes a response with status code 200, with default header values. + +Updated filter keyword. +*/ +type FilterKeywordPutOK struct { + Payload *models.FilterKeyword +} + +// IsSuccess returns true when this filter keyword put o k response has a 2xx status code +func (o *FilterKeywordPutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keyword put o k response has a 3xx status code +func (o *FilterKeywordPutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put o k response has a 4xx status code +func (o *FilterKeywordPutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword put o k response has a 5xx status code +func (o *FilterKeywordPutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put o k response a status code equal to that given +func (o *FilterKeywordPutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keyword put o k response +func (o *FilterKeywordPutOK) Code() int { + return 200 +} + +func (o *FilterKeywordPutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutOK %s", 200, payload) +} + +func (o *FilterKeywordPutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutOK %s", 200, payload) +} + +func (o *FilterKeywordPutOK) GetPayload() *models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordPutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterKeyword) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterKeywordPutBadRequest creates a FilterKeywordPutBadRequest with default headers values +func NewFilterKeywordPutBadRequest() *FilterKeywordPutBadRequest { + return &FilterKeywordPutBadRequest{} +} + +/* +FilterKeywordPutBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordPutBadRequest struct { +} + +// IsSuccess returns true when this filter keyword put bad request response has a 2xx status code +func (o *FilterKeywordPutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put bad request response has a 3xx status code +func (o *FilterKeywordPutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put bad request response has a 4xx status code +func (o *FilterKeywordPutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put bad request response has a 5xx status code +func (o *FilterKeywordPutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put bad request response a status code equal to that given +func (o *FilterKeywordPutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keyword put bad request response +func (o *FilterKeywordPutBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordPutBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutBadRequest", 400) +} + +func (o *FilterKeywordPutBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutBadRequest", 400) +} + +func (o *FilterKeywordPutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutUnauthorized creates a FilterKeywordPutUnauthorized with default headers values +func NewFilterKeywordPutUnauthorized() *FilterKeywordPutUnauthorized { + return &FilterKeywordPutUnauthorized{} +} + +/* +FilterKeywordPutUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordPutUnauthorized struct { +} + +// IsSuccess returns true when this filter keyword put unauthorized response has a 2xx status code +func (o *FilterKeywordPutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put unauthorized response has a 3xx status code +func (o *FilterKeywordPutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put unauthorized response has a 4xx status code +func (o *FilterKeywordPutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put unauthorized response has a 5xx status code +func (o *FilterKeywordPutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put unauthorized response a status code equal to that given +func (o *FilterKeywordPutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keyword put unauthorized response +func (o *FilterKeywordPutUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordPutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnauthorized", 401) +} + +func (o *FilterKeywordPutUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnauthorized", 401) +} + +func (o *FilterKeywordPutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutForbidden creates a FilterKeywordPutForbidden with default headers values +func NewFilterKeywordPutForbidden() *FilterKeywordPutForbidden { + return &FilterKeywordPutForbidden{} +} + +/* +FilterKeywordPutForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterKeywordPutForbidden struct { +} + +// IsSuccess returns true when this filter keyword put forbidden response has a 2xx status code +func (o *FilterKeywordPutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put forbidden response has a 3xx status code +func (o *FilterKeywordPutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put forbidden response has a 4xx status code +func (o *FilterKeywordPutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put forbidden response has a 5xx status code +func (o *FilterKeywordPutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put forbidden response a status code equal to that given +func (o *FilterKeywordPutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter keyword put forbidden response +func (o *FilterKeywordPutForbidden) Code() int { + return 403 +} + +func (o *FilterKeywordPutForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutForbidden", 403) +} + +func (o *FilterKeywordPutForbidden) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutForbidden", 403) +} + +func (o *FilterKeywordPutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutNotFound creates a FilterKeywordPutNotFound with default headers values +func NewFilterKeywordPutNotFound() *FilterKeywordPutNotFound { + return &FilterKeywordPutNotFound{} +} + +/* +FilterKeywordPutNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordPutNotFound struct { +} + +// IsSuccess returns true when this filter keyword put not found response has a 2xx status code +func (o *FilterKeywordPutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put not found response has a 3xx status code +func (o *FilterKeywordPutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put not found response has a 4xx status code +func (o *FilterKeywordPutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put not found response has a 5xx status code +func (o *FilterKeywordPutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put not found response a status code equal to that given +func (o *FilterKeywordPutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keyword put not found response +func (o *FilterKeywordPutNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordPutNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotFound", 404) +} + +func (o *FilterKeywordPutNotFound) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotFound", 404) +} + +func (o *FilterKeywordPutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutNotAcceptable creates a FilterKeywordPutNotAcceptable with default headers values +func NewFilterKeywordPutNotAcceptable() *FilterKeywordPutNotAcceptable { + return &FilterKeywordPutNotAcceptable{} +} + +/* +FilterKeywordPutNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordPutNotAcceptable struct { +} + +// IsSuccess returns true when this filter keyword put not acceptable response has a 2xx status code +func (o *FilterKeywordPutNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put not acceptable response has a 3xx status code +func (o *FilterKeywordPutNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put not acceptable response has a 4xx status code +func (o *FilterKeywordPutNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put not acceptable response has a 5xx status code +func (o *FilterKeywordPutNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put not acceptable response a status code equal to that given +func (o *FilterKeywordPutNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keyword put not acceptable response +func (o *FilterKeywordPutNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordPutNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotAcceptable", 406) +} + +func (o *FilterKeywordPutNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutNotAcceptable", 406) +} + +func (o *FilterKeywordPutNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutConflict creates a FilterKeywordPutConflict with default headers values +func NewFilterKeywordPutConflict() *FilterKeywordPutConflict { + return &FilterKeywordPutConflict{} +} + +/* +FilterKeywordPutConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterKeywordPutConflict struct { +} + +// IsSuccess returns true when this filter keyword put conflict response has a 2xx status code +func (o *FilterKeywordPutConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put conflict response has a 3xx status code +func (o *FilterKeywordPutConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put conflict response has a 4xx status code +func (o *FilterKeywordPutConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put conflict response has a 5xx status code +func (o *FilterKeywordPutConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put conflict response a status code equal to that given +func (o *FilterKeywordPutConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter keyword put conflict response +func (o *FilterKeywordPutConflict) Code() int { + return 409 +} + +func (o *FilterKeywordPutConflict) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutConflict", 409) +} + +func (o *FilterKeywordPutConflict) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutConflict", 409) +} + +func (o *FilterKeywordPutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutUnprocessableEntity creates a FilterKeywordPutUnprocessableEntity with default headers values +func NewFilterKeywordPutUnprocessableEntity() *FilterKeywordPutUnprocessableEntity { + return &FilterKeywordPutUnprocessableEntity{} +} + +/* +FilterKeywordPutUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterKeywordPutUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter keyword put unprocessable entity response has a 2xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put unprocessable entity response has a 3xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put unprocessable entity response has a 4xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keyword put unprocessable entity response has a 5xx status code +func (o *FilterKeywordPutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keyword put unprocessable entity response a status code equal to that given +func (o *FilterKeywordPutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter keyword put unprocessable entity response +func (o *FilterKeywordPutUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterKeywordPutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnprocessableEntity", 422) +} + +func (o *FilterKeywordPutUnprocessableEntity) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutUnprocessableEntity", 422) +} + +func (o *FilterKeywordPutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordPutInternalServerError creates a FilterKeywordPutInternalServerError with default headers values +func NewFilterKeywordPutInternalServerError() *FilterKeywordPutInternalServerError { + return &FilterKeywordPutInternalServerError{} +} + +/* +FilterKeywordPutInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordPutInternalServerError struct { +} + +// IsSuccess returns true when this filter keyword put internal server error response has a 2xx status code +func (o *FilterKeywordPutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keyword put internal server error response has a 3xx status code +func (o *FilterKeywordPutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keyword put internal server error response has a 4xx status code +func (o *FilterKeywordPutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keyword put internal server error response has a 5xx status code +func (o *FilterKeywordPutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keyword put internal server error response a status code equal to that given +func (o *FilterKeywordPutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keyword put internal server error response +func (o *FilterKeywordPutInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordPutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutInternalServerError", 500) +} + +func (o *FilterKeywordPutInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/keywords{id}][%d] filterKeywordPutInternalServerError", 500) +} + +func (o *FilterKeywordPutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_keywords_get_parameters.go b/client/filters/filter_keywords_get_parameters.go new file mode 100644 index 0000000..3f65331 --- /dev/null +++ b/client/filters/filter_keywords_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterKeywordsGetParams creates a new FilterKeywordsGetParams 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 NewFilterKeywordsGetParams() *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterKeywordsGetParamsWithTimeout creates a new FilterKeywordsGetParams object +// with the ability to set a timeout on a request. +func NewFilterKeywordsGetParamsWithTimeout(timeout time.Duration) *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + timeout: timeout, + } +} + +// NewFilterKeywordsGetParamsWithContext creates a new FilterKeywordsGetParams object +// with the ability to set a context for a request. +func NewFilterKeywordsGetParamsWithContext(ctx context.Context) *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + Context: ctx, + } +} + +// NewFilterKeywordsGetParamsWithHTTPClient creates a new FilterKeywordsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterKeywordsGetParamsWithHTTPClient(client *http.Client) *FilterKeywordsGetParams { + return &FilterKeywordsGetParams{ + HTTPClient: client, + } +} + +/* +FilterKeywordsGetParams contains all the parameters to send to the API endpoint + + for the filter keywords get operation. + + Typically these are written to a http.Request. +*/ +type FilterKeywordsGetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter keywords get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordsGetParams) WithDefaults() *FilterKeywordsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter keywords get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterKeywordsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter keywords get params +func (o *FilterKeywordsGetParams) WithTimeout(timeout time.Duration) *FilterKeywordsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter keywords get params +func (o *FilterKeywordsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter keywords get params +func (o *FilterKeywordsGetParams) WithContext(ctx context.Context) *FilterKeywordsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter keywords get params +func (o *FilterKeywordsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter keywords get params +func (o *FilterKeywordsGetParams) WithHTTPClient(client *http.Client) *FilterKeywordsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter keywords get params +func (o *FilterKeywordsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter keywords get params +func (o *FilterKeywordsGetParams) WithID(id string) *FilterKeywordsGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter keywords get params +func (o *FilterKeywordsGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterKeywordsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_keywords_get_responses.go b/client/filters/filter_keywords_get_responses.go new file mode 100644 index 0000000..db47d4c --- /dev/null +++ b/client/filters/filter_keywords_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterKeywordsGetReader is a Reader for the FilterKeywordsGet structure. +type FilterKeywordsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterKeywordsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterKeywordsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterKeywordsGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterKeywordsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterKeywordsGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterKeywordsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterKeywordsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/{id}/keywords] filterKeywordsGet", response, response.Code()) + } +} + +// NewFilterKeywordsGetOK creates a FilterKeywordsGetOK with default headers values +func NewFilterKeywordsGetOK() *FilterKeywordsGetOK { + return &FilterKeywordsGetOK{} +} + +/* +FilterKeywordsGetOK describes a response with status code 200, with default header values. + +Requested filter keywords. +*/ +type FilterKeywordsGetOK struct { + Payload []*models.FilterKeyword +} + +// IsSuccess returns true when this filter keywords get o k response has a 2xx status code +func (o *FilterKeywordsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter keywords get o k response has a 3xx status code +func (o *FilterKeywordsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get o k response has a 4xx status code +func (o *FilterKeywordsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keywords get o k response has a 5xx status code +func (o *FilterKeywordsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get o k response a status code equal to that given +func (o *FilterKeywordsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter keywords get o k response +func (o *FilterKeywordsGetOK) Code() int { + return 200 +} + +func (o *FilterKeywordsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetOK %s", 200, payload) +} + +func (o *FilterKeywordsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetOK %s", 200, payload) +} + +func (o *FilterKeywordsGetOK) GetPayload() []*models.FilterKeyword { + return o.Payload +} + +func (o *FilterKeywordsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterKeywordsGetBadRequest creates a FilterKeywordsGetBadRequest with default headers values +func NewFilterKeywordsGetBadRequest() *FilterKeywordsGetBadRequest { + return &FilterKeywordsGetBadRequest{} +} + +/* +FilterKeywordsGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterKeywordsGetBadRequest struct { +} + +// IsSuccess returns true when this filter keywords get bad request response has a 2xx status code +func (o *FilterKeywordsGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get bad request response has a 3xx status code +func (o *FilterKeywordsGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get bad request response has a 4xx status code +func (o *FilterKeywordsGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get bad request response has a 5xx status code +func (o *FilterKeywordsGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get bad request response a status code equal to that given +func (o *FilterKeywordsGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter keywords get bad request response +func (o *FilterKeywordsGetBadRequest) Code() int { + return 400 +} + +func (o *FilterKeywordsGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetBadRequest", 400) +} + +func (o *FilterKeywordsGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetBadRequest", 400) +} + +func (o *FilterKeywordsGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetUnauthorized creates a FilterKeywordsGetUnauthorized with default headers values +func NewFilterKeywordsGetUnauthorized() *FilterKeywordsGetUnauthorized { + return &FilterKeywordsGetUnauthorized{} +} + +/* +FilterKeywordsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterKeywordsGetUnauthorized struct { +} + +// IsSuccess returns true when this filter keywords get unauthorized response has a 2xx status code +func (o *FilterKeywordsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get unauthorized response has a 3xx status code +func (o *FilterKeywordsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get unauthorized response has a 4xx status code +func (o *FilterKeywordsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get unauthorized response has a 5xx status code +func (o *FilterKeywordsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get unauthorized response a status code equal to that given +func (o *FilterKeywordsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter keywords get unauthorized response +func (o *FilterKeywordsGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterKeywordsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetUnauthorized", 401) +} + +func (o *FilterKeywordsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetUnauthorized", 401) +} + +func (o *FilterKeywordsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetNotFound creates a FilterKeywordsGetNotFound with default headers values +func NewFilterKeywordsGetNotFound() *FilterKeywordsGetNotFound { + return &FilterKeywordsGetNotFound{} +} + +/* +FilterKeywordsGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterKeywordsGetNotFound struct { +} + +// IsSuccess returns true when this filter keywords get not found response has a 2xx status code +func (o *FilterKeywordsGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get not found response has a 3xx status code +func (o *FilterKeywordsGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get not found response has a 4xx status code +func (o *FilterKeywordsGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get not found response has a 5xx status code +func (o *FilterKeywordsGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get not found response a status code equal to that given +func (o *FilterKeywordsGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter keywords get not found response +func (o *FilterKeywordsGetNotFound) Code() int { + return 404 +} + +func (o *FilterKeywordsGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotFound", 404) +} + +func (o *FilterKeywordsGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotFound", 404) +} + +func (o *FilterKeywordsGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetNotAcceptable creates a FilterKeywordsGetNotAcceptable with default headers values +func NewFilterKeywordsGetNotAcceptable() *FilterKeywordsGetNotAcceptable { + return &FilterKeywordsGetNotAcceptable{} +} + +/* +FilterKeywordsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterKeywordsGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter keywords get not acceptable response has a 2xx status code +func (o *FilterKeywordsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get not acceptable response has a 3xx status code +func (o *FilterKeywordsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get not acceptable response has a 4xx status code +func (o *FilterKeywordsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter keywords get not acceptable response has a 5xx status code +func (o *FilterKeywordsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter keywords get not acceptable response a status code equal to that given +func (o *FilterKeywordsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter keywords get not acceptable response +func (o *FilterKeywordsGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterKeywordsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotAcceptable", 406) +} + +func (o *FilterKeywordsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetNotAcceptable", 406) +} + +func (o *FilterKeywordsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterKeywordsGetInternalServerError creates a FilterKeywordsGetInternalServerError with default headers values +func NewFilterKeywordsGetInternalServerError() *FilterKeywordsGetInternalServerError { + return &FilterKeywordsGetInternalServerError{} +} + +/* +FilterKeywordsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterKeywordsGetInternalServerError struct { +} + +// IsSuccess returns true when this filter keywords get internal server error response has a 2xx status code +func (o *FilterKeywordsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter keywords get internal server error response has a 3xx status code +func (o *FilterKeywordsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter keywords get internal server error response has a 4xx status code +func (o *FilterKeywordsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter keywords get internal server error response has a 5xx status code +func (o *FilterKeywordsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter keywords get internal server error response a status code equal to that given +func (o *FilterKeywordsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter keywords get internal server error response +func (o *FilterKeywordsGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterKeywordsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetInternalServerError", 500) +} + +func (o *FilterKeywordsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/keywords][%d] filterKeywordsGetInternalServerError", 500) +} + +func (o *FilterKeywordsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_status_delete_parameters.go b/client/filters/filter_status_delete_parameters.go new file mode 100644 index 0000000..713b7ea --- /dev/null +++ b/client/filters/filter_status_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusDeleteParams creates a new FilterStatusDeleteParams 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 NewFilterStatusDeleteParams() *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusDeleteParamsWithTimeout creates a new FilterStatusDeleteParams object +// with the ability to set a timeout on a request. +func NewFilterStatusDeleteParamsWithTimeout(timeout time.Duration) *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + timeout: timeout, + } +} + +// NewFilterStatusDeleteParamsWithContext creates a new FilterStatusDeleteParams object +// with the ability to set a context for a request. +func NewFilterStatusDeleteParamsWithContext(ctx context.Context) *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + Context: ctx, + } +} + +// NewFilterStatusDeleteParamsWithHTTPClient creates a new FilterStatusDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusDeleteParamsWithHTTPClient(client *http.Client) *FilterStatusDeleteParams { + return &FilterStatusDeleteParams{ + HTTPClient: client, + } +} + +/* +FilterStatusDeleteParams contains all the parameters to send to the API endpoint + + for the filter status delete operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusDeleteParams struct { + + /* ID. + + ID of the filter status + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusDeleteParams) WithDefaults() *FilterStatusDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter status delete params +func (o *FilterStatusDeleteParams) WithTimeout(timeout time.Duration) *FilterStatusDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter status delete params +func (o *FilterStatusDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter status delete params +func (o *FilterStatusDeleteParams) WithContext(ctx context.Context) *FilterStatusDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter status delete params +func (o *FilterStatusDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter status delete params +func (o *FilterStatusDeleteParams) WithHTTPClient(client *http.Client) *FilterStatusDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter status delete params +func (o *FilterStatusDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter status delete params +func (o *FilterStatusDeleteParams) WithID(id string) *FilterStatusDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter status delete params +func (o *FilterStatusDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_status_delete_responses.go b/client/filters/filter_status_delete_responses.go new file mode 100644 index 0000000..d3cd40a --- /dev/null +++ b/client/filters/filter_status_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// FilterStatusDeleteReader is a Reader for the FilterStatusDelete structure. +type FilterStatusDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/filters/statuses/{id}] filterStatusDelete", response, response.Code()) + } +} + +// NewFilterStatusDeleteOK creates a FilterStatusDeleteOK with default headers values +func NewFilterStatusDeleteOK() *FilterStatusDeleteOK { + return &FilterStatusDeleteOK{} +} + +/* +FilterStatusDeleteOK describes a response with status code 200, with default header values. + +filter status deleted +*/ +type FilterStatusDeleteOK struct { +} + +// IsSuccess returns true when this filter status delete o k response has a 2xx status code +func (o *FilterStatusDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter status delete o k response has a 3xx status code +func (o *FilterStatusDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete o k response has a 4xx status code +func (o *FilterStatusDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status delete o k response has a 5xx status code +func (o *FilterStatusDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete o k response a status code equal to that given +func (o *FilterStatusDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter status delete o k response +func (o *FilterStatusDeleteOK) Code() int { + return 200 +} + +func (o *FilterStatusDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteOK", 200) +} + +func (o *FilterStatusDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteOK", 200) +} + +func (o *FilterStatusDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteBadRequest creates a FilterStatusDeleteBadRequest with default headers values +func NewFilterStatusDeleteBadRequest() *FilterStatusDeleteBadRequest { + return &FilterStatusDeleteBadRequest{} +} + +/* +FilterStatusDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusDeleteBadRequest struct { +} + +// IsSuccess returns true when this filter status delete bad request response has a 2xx status code +func (o *FilterStatusDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete bad request response has a 3xx status code +func (o *FilterStatusDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete bad request response has a 4xx status code +func (o *FilterStatusDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete bad request response has a 5xx status code +func (o *FilterStatusDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete bad request response a status code equal to that given +func (o *FilterStatusDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter status delete bad request response +func (o *FilterStatusDeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteBadRequest", 400) +} + +func (o *FilterStatusDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteBadRequest", 400) +} + +func (o *FilterStatusDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteUnauthorized creates a FilterStatusDeleteUnauthorized with default headers values +func NewFilterStatusDeleteUnauthorized() *FilterStatusDeleteUnauthorized { + return &FilterStatusDeleteUnauthorized{} +} + +/* +FilterStatusDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusDeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter status delete unauthorized response has a 2xx status code +func (o *FilterStatusDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete unauthorized response has a 3xx status code +func (o *FilterStatusDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete unauthorized response has a 4xx status code +func (o *FilterStatusDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete unauthorized response has a 5xx status code +func (o *FilterStatusDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete unauthorized response a status code equal to that given +func (o *FilterStatusDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter status delete unauthorized response +func (o *FilterStatusDeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteUnauthorized", 401) +} + +func (o *FilterStatusDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteUnauthorized", 401) +} + +func (o *FilterStatusDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteNotFound creates a FilterStatusDeleteNotFound with default headers values +func NewFilterStatusDeleteNotFound() *FilterStatusDeleteNotFound { + return &FilterStatusDeleteNotFound{} +} + +/* +FilterStatusDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusDeleteNotFound struct { +} + +// IsSuccess returns true when this filter status delete not found response has a 2xx status code +func (o *FilterStatusDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete not found response has a 3xx status code +func (o *FilterStatusDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete not found response has a 4xx status code +func (o *FilterStatusDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete not found response has a 5xx status code +func (o *FilterStatusDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete not found response a status code equal to that given +func (o *FilterStatusDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter status delete not found response +func (o *FilterStatusDeleteNotFound) Code() int { + return 404 +} + +func (o *FilterStatusDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotFound", 404) +} + +func (o *FilterStatusDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotFound", 404) +} + +func (o *FilterStatusDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteNotAcceptable creates a FilterStatusDeleteNotAcceptable with default headers values +func NewFilterStatusDeleteNotAcceptable() *FilterStatusDeleteNotAcceptable { + return &FilterStatusDeleteNotAcceptable{} +} + +/* +FilterStatusDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter status delete not acceptable response has a 2xx status code +func (o *FilterStatusDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete not acceptable response has a 3xx status code +func (o *FilterStatusDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete not acceptable response has a 4xx status code +func (o *FilterStatusDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status delete not acceptable response has a 5xx status code +func (o *FilterStatusDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status delete not acceptable response a status code equal to that given +func (o *FilterStatusDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter status delete not acceptable response +func (o *FilterStatusDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotAcceptable", 406) +} + +func (o *FilterStatusDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteNotAcceptable", 406) +} + +func (o *FilterStatusDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusDeleteInternalServerError creates a FilterStatusDeleteInternalServerError with default headers values +func NewFilterStatusDeleteInternalServerError() *FilterStatusDeleteInternalServerError { + return &FilterStatusDeleteInternalServerError{} +} + +/* +FilterStatusDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusDeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter status delete internal server error response has a 2xx status code +func (o *FilterStatusDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status delete internal server error response has a 3xx status code +func (o *FilterStatusDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status delete internal server error response has a 4xx status code +func (o *FilterStatusDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status delete internal server error response has a 5xx status code +func (o *FilterStatusDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter status delete internal server error response a status code equal to that given +func (o *FilterStatusDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter status delete internal server error response +func (o *FilterStatusDeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteInternalServerError", 500) +} + +func (o *FilterStatusDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/statuses/{id}][%d] filterStatusDeleteInternalServerError", 500) +} + +func (o *FilterStatusDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_status_get_parameters.go b/client/filters/filter_status_get_parameters.go new file mode 100644 index 0000000..819cc12 --- /dev/null +++ b/client/filters/filter_status_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusGetParams creates a new FilterStatusGetParams 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 NewFilterStatusGetParams() *FilterStatusGetParams { + return &FilterStatusGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusGetParamsWithTimeout creates a new FilterStatusGetParams object +// with the ability to set a timeout on a request. +func NewFilterStatusGetParamsWithTimeout(timeout time.Duration) *FilterStatusGetParams { + return &FilterStatusGetParams{ + timeout: timeout, + } +} + +// NewFilterStatusGetParamsWithContext creates a new FilterStatusGetParams object +// with the ability to set a context for a request. +func NewFilterStatusGetParamsWithContext(ctx context.Context) *FilterStatusGetParams { + return &FilterStatusGetParams{ + Context: ctx, + } +} + +// NewFilterStatusGetParamsWithHTTPClient creates a new FilterStatusGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusGetParamsWithHTTPClient(client *http.Client) *FilterStatusGetParams { + return &FilterStatusGetParams{ + HTTPClient: client, + } +} + +/* +FilterStatusGetParams contains all the parameters to send to the API endpoint + + for the filter status get operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusGetParams struct { + + /* ID. + + ID of the filter status + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusGetParams) WithDefaults() *FilterStatusGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter status get params +func (o *FilterStatusGetParams) WithTimeout(timeout time.Duration) *FilterStatusGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter status get params +func (o *FilterStatusGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter status get params +func (o *FilterStatusGetParams) WithContext(ctx context.Context) *FilterStatusGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter status get params +func (o *FilterStatusGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter status get params +func (o *FilterStatusGetParams) WithHTTPClient(client *http.Client) *FilterStatusGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter status get params +func (o *FilterStatusGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter status get params +func (o *FilterStatusGetParams) WithID(id string) *FilterStatusGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter status get params +func (o *FilterStatusGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_status_get_responses.go b/client/filters/filter_status_get_responses.go new file mode 100644 index 0000000..c8e6b5c --- /dev/null +++ b/client/filters/filter_status_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterStatusGetReader is a Reader for the FilterStatusGet structure. +type FilterStatusGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/statuses/{id}] filterStatusGet", response, response.Code()) + } +} + +// NewFilterStatusGetOK creates a FilterStatusGetOK with default headers values +func NewFilterStatusGetOK() *FilterStatusGetOK { + return &FilterStatusGetOK{} +} + +/* +FilterStatusGetOK describes a response with status code 200, with default header values. + +Requested filter status. +*/ +type FilterStatusGetOK struct { + Payload *models.FilterStatus +} + +// IsSuccess returns true when this filter status get o k response has a 2xx status code +func (o *FilterStatusGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter status get o k response has a 3xx status code +func (o *FilterStatusGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get o k response has a 4xx status code +func (o *FilterStatusGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status get o k response has a 5xx status code +func (o *FilterStatusGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get o k response a status code equal to that given +func (o *FilterStatusGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter status get o k response +func (o *FilterStatusGetOK) Code() int { + return 200 +} + +func (o *FilterStatusGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetOK %s", 200, payload) +} + +func (o *FilterStatusGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetOK %s", 200, payload) +} + +func (o *FilterStatusGetOK) GetPayload() *models.FilterStatus { + return o.Payload +} + +func (o *FilterStatusGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterStatusGetBadRequest creates a FilterStatusGetBadRequest with default headers values +func NewFilterStatusGetBadRequest() *FilterStatusGetBadRequest { + return &FilterStatusGetBadRequest{} +} + +/* +FilterStatusGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusGetBadRequest struct { +} + +// IsSuccess returns true when this filter status get bad request response has a 2xx status code +func (o *FilterStatusGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get bad request response has a 3xx status code +func (o *FilterStatusGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get bad request response has a 4xx status code +func (o *FilterStatusGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get bad request response has a 5xx status code +func (o *FilterStatusGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get bad request response a status code equal to that given +func (o *FilterStatusGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter status get bad request response +func (o *FilterStatusGetBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetBadRequest", 400) +} + +func (o *FilterStatusGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetBadRequest", 400) +} + +func (o *FilterStatusGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetUnauthorized creates a FilterStatusGetUnauthorized with default headers values +func NewFilterStatusGetUnauthorized() *FilterStatusGetUnauthorized { + return &FilterStatusGetUnauthorized{} +} + +/* +FilterStatusGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusGetUnauthorized struct { +} + +// IsSuccess returns true when this filter status get unauthorized response has a 2xx status code +func (o *FilterStatusGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get unauthorized response has a 3xx status code +func (o *FilterStatusGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get unauthorized response has a 4xx status code +func (o *FilterStatusGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get unauthorized response has a 5xx status code +func (o *FilterStatusGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get unauthorized response a status code equal to that given +func (o *FilterStatusGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter status get unauthorized response +func (o *FilterStatusGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetUnauthorized", 401) +} + +func (o *FilterStatusGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetUnauthorized", 401) +} + +func (o *FilterStatusGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetNotFound creates a FilterStatusGetNotFound with default headers values +func NewFilterStatusGetNotFound() *FilterStatusGetNotFound { + return &FilterStatusGetNotFound{} +} + +/* +FilterStatusGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusGetNotFound struct { +} + +// IsSuccess returns true when this filter status get not found response has a 2xx status code +func (o *FilterStatusGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get not found response has a 3xx status code +func (o *FilterStatusGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get not found response has a 4xx status code +func (o *FilterStatusGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get not found response has a 5xx status code +func (o *FilterStatusGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get not found response a status code equal to that given +func (o *FilterStatusGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter status get not found response +func (o *FilterStatusGetNotFound) Code() int { + return 404 +} + +func (o *FilterStatusGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotFound", 404) +} + +func (o *FilterStatusGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotFound", 404) +} + +func (o *FilterStatusGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetNotAcceptable creates a FilterStatusGetNotAcceptable with default headers values +func NewFilterStatusGetNotAcceptable() *FilterStatusGetNotAcceptable { + return &FilterStatusGetNotAcceptable{} +} + +/* +FilterStatusGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter status get not acceptable response has a 2xx status code +func (o *FilterStatusGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get not acceptable response has a 3xx status code +func (o *FilterStatusGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get not acceptable response has a 4xx status code +func (o *FilterStatusGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status get not acceptable response has a 5xx status code +func (o *FilterStatusGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status get not acceptable response a status code equal to that given +func (o *FilterStatusGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter status get not acceptable response +func (o *FilterStatusGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotAcceptable", 406) +} + +func (o *FilterStatusGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetNotAcceptable", 406) +} + +func (o *FilterStatusGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusGetInternalServerError creates a FilterStatusGetInternalServerError with default headers values +func NewFilterStatusGetInternalServerError() *FilterStatusGetInternalServerError { + return &FilterStatusGetInternalServerError{} +} + +/* +FilterStatusGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusGetInternalServerError struct { +} + +// IsSuccess returns true when this filter status get internal server error response has a 2xx status code +func (o *FilterStatusGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status get internal server error response has a 3xx status code +func (o *FilterStatusGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status get internal server error response has a 4xx status code +func (o *FilterStatusGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status get internal server error response has a 5xx status code +func (o *FilterStatusGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter status get internal server error response a status code equal to that given +func (o *FilterStatusGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter status get internal server error response +func (o *FilterStatusGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetInternalServerError", 500) +} + +func (o *FilterStatusGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/statuses/{id}][%d] filterStatusGetInternalServerError", 500) +} + +func (o *FilterStatusGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_status_post_parameters.go b/client/filters/filter_status_post_parameters.go new file mode 100644 index 0000000..3017f07 --- /dev/null +++ b/client/filters/filter_status_post_parameters.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusPostParams creates a new FilterStatusPostParams 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 NewFilterStatusPostParams() *FilterStatusPostParams { + return &FilterStatusPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusPostParamsWithTimeout creates a new FilterStatusPostParams object +// with the ability to set a timeout on a request. +func NewFilterStatusPostParamsWithTimeout(timeout time.Duration) *FilterStatusPostParams { + return &FilterStatusPostParams{ + timeout: timeout, + } +} + +// NewFilterStatusPostParamsWithContext creates a new FilterStatusPostParams object +// with the ability to set a context for a request. +func NewFilterStatusPostParamsWithContext(ctx context.Context) *FilterStatusPostParams { + return &FilterStatusPostParams{ + Context: ctx, + } +} + +// NewFilterStatusPostParamsWithHTTPClient creates a new FilterStatusPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusPostParamsWithHTTPClient(client *http.Client) *FilterStatusPostParams { + return &FilterStatusPostParams{ + HTTPClient: client, + } +} + +/* +FilterStatusPostParams contains all the parameters to send to the API endpoint + + for the filter status post operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusPostParams struct { + + /* ID. + + ID of the filter to add the filtered status to. + */ + ID string + + /* StatusID. + + The ID of the status to filter. + + Sample: 01HXA2NE0K8T1C70K90E74GYD0 + */ + StatusID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter status post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusPostParams) WithDefaults() *FilterStatusPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter status post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter status post params +func (o *FilterStatusPostParams) WithTimeout(timeout time.Duration) *FilterStatusPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter status post params +func (o *FilterStatusPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter status post params +func (o *FilterStatusPostParams) WithContext(ctx context.Context) *FilterStatusPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter status post params +func (o *FilterStatusPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter status post params +func (o *FilterStatusPostParams) WithHTTPClient(client *http.Client) *FilterStatusPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter status post params +func (o *FilterStatusPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter status post params +func (o *FilterStatusPostParams) WithID(id string) *FilterStatusPostParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter status post params +func (o *FilterStatusPostParams) SetID(id string) { + o.ID = id +} + +// WithStatusID adds the statusID to the filter status post params +func (o *FilterStatusPostParams) WithStatusID(statusID string) *FilterStatusPostParams { + o.SetStatusID(statusID) + return o +} + +// SetStatusID adds the statusId to the filter status post params +func (o *FilterStatusPostParams) SetStatusID(statusID string) { + o.StatusID = statusID +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + // form param status_id + frStatusID := o.StatusID + fStatusID := frStatusID + if fStatusID != "" { + if err := r.SetFormParam("status_id", fStatusID); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_status_post_responses.go b/client/filters/filter_status_post_responses.go new file mode 100644 index 0000000..b4b289b --- /dev/null +++ b/client/filters/filter_status_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterStatusPostReader is a Reader for the FilterStatusPost structure. +type FilterStatusPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterStatusPostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusPostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusPostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterStatusPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterStatusPostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v2/filters/{id}/statuses] filterStatusPost", response, response.Code()) + } +} + +// NewFilterStatusPostOK creates a FilterStatusPostOK with default headers values +func NewFilterStatusPostOK() *FilterStatusPostOK { + return &FilterStatusPostOK{} +} + +/* +FilterStatusPostOK describes a response with status code 200, with default header values. + +New filter status. +*/ +type FilterStatusPostOK struct { + Payload *models.FilterStatus +} + +// IsSuccess returns true when this filter status post o k response has a 2xx status code +func (o *FilterStatusPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter status post o k response has a 3xx status code +func (o *FilterStatusPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post o k response has a 4xx status code +func (o *FilterStatusPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status post o k response has a 5xx status code +func (o *FilterStatusPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post o k response a status code equal to that given +func (o *FilterStatusPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter status post o k response +func (o *FilterStatusPostOK) Code() int { + return 200 +} + +func (o *FilterStatusPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostOK %s", 200, payload) +} + +func (o *FilterStatusPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostOK %s", 200, payload) +} + +func (o *FilterStatusPostOK) GetPayload() *models.FilterStatus { + return o.Payload +} + +func (o *FilterStatusPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterStatus) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterStatusPostBadRequest creates a FilterStatusPostBadRequest with default headers values +func NewFilterStatusPostBadRequest() *FilterStatusPostBadRequest { + return &FilterStatusPostBadRequest{} +} + +/* +FilterStatusPostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusPostBadRequest struct { +} + +// IsSuccess returns true when this filter status post bad request response has a 2xx status code +func (o *FilterStatusPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post bad request response has a 3xx status code +func (o *FilterStatusPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post bad request response has a 4xx status code +func (o *FilterStatusPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post bad request response has a 5xx status code +func (o *FilterStatusPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post bad request response a status code equal to that given +func (o *FilterStatusPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter status post bad request response +func (o *FilterStatusPostBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusPostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostBadRequest", 400) +} + +func (o *FilterStatusPostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostBadRequest", 400) +} + +func (o *FilterStatusPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostUnauthorized creates a FilterStatusPostUnauthorized with default headers values +func NewFilterStatusPostUnauthorized() *FilterStatusPostUnauthorized { + return &FilterStatusPostUnauthorized{} +} + +/* +FilterStatusPostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusPostUnauthorized struct { +} + +// IsSuccess returns true when this filter status post unauthorized response has a 2xx status code +func (o *FilterStatusPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post unauthorized response has a 3xx status code +func (o *FilterStatusPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post unauthorized response has a 4xx status code +func (o *FilterStatusPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post unauthorized response has a 5xx status code +func (o *FilterStatusPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post unauthorized response a status code equal to that given +func (o *FilterStatusPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter status post unauthorized response +func (o *FilterStatusPostUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnauthorized", 401) +} + +func (o *FilterStatusPostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnauthorized", 401) +} + +func (o *FilterStatusPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostForbidden creates a FilterStatusPostForbidden with default headers values +func NewFilterStatusPostForbidden() *FilterStatusPostForbidden { + return &FilterStatusPostForbidden{} +} + +/* +FilterStatusPostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterStatusPostForbidden struct { +} + +// IsSuccess returns true when this filter status post forbidden response has a 2xx status code +func (o *FilterStatusPostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post forbidden response has a 3xx status code +func (o *FilterStatusPostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post forbidden response has a 4xx status code +func (o *FilterStatusPostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post forbidden response has a 5xx status code +func (o *FilterStatusPostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post forbidden response a status code equal to that given +func (o *FilterStatusPostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter status post forbidden response +func (o *FilterStatusPostForbidden) Code() int { + return 403 +} + +func (o *FilterStatusPostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostForbidden", 403) +} + +func (o *FilterStatusPostForbidden) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostForbidden", 403) +} + +func (o *FilterStatusPostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostNotFound creates a FilterStatusPostNotFound with default headers values +func NewFilterStatusPostNotFound() *FilterStatusPostNotFound { + return &FilterStatusPostNotFound{} +} + +/* +FilterStatusPostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusPostNotFound struct { +} + +// IsSuccess returns true when this filter status post not found response has a 2xx status code +func (o *FilterStatusPostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post not found response has a 3xx status code +func (o *FilterStatusPostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post not found response has a 4xx status code +func (o *FilterStatusPostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post not found response has a 5xx status code +func (o *FilterStatusPostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post not found response a status code equal to that given +func (o *FilterStatusPostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter status post not found response +func (o *FilterStatusPostNotFound) Code() int { + return 404 +} + +func (o *FilterStatusPostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotFound", 404) +} + +func (o *FilterStatusPostNotFound) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotFound", 404) +} + +func (o *FilterStatusPostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostNotAcceptable creates a FilterStatusPostNotAcceptable with default headers values +func NewFilterStatusPostNotAcceptable() *FilterStatusPostNotAcceptable { + return &FilterStatusPostNotAcceptable{} +} + +/* +FilterStatusPostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusPostNotAcceptable struct { +} + +// IsSuccess returns true when this filter status post not acceptable response has a 2xx status code +func (o *FilterStatusPostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post not acceptable response has a 3xx status code +func (o *FilterStatusPostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post not acceptable response has a 4xx status code +func (o *FilterStatusPostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post not acceptable response has a 5xx status code +func (o *FilterStatusPostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post not acceptable response a status code equal to that given +func (o *FilterStatusPostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter status post not acceptable response +func (o *FilterStatusPostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusPostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotAcceptable", 406) +} + +func (o *FilterStatusPostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostNotAcceptable", 406) +} + +func (o *FilterStatusPostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostConflict creates a FilterStatusPostConflict with default headers values +func NewFilterStatusPostConflict() *FilterStatusPostConflict { + return &FilterStatusPostConflict{} +} + +/* +FilterStatusPostConflict describes a response with status code 409, with default header values. + +conflict (duplicate status) +*/ +type FilterStatusPostConflict struct { +} + +// IsSuccess returns true when this filter status post conflict response has a 2xx status code +func (o *FilterStatusPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post conflict response has a 3xx status code +func (o *FilterStatusPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post conflict response has a 4xx status code +func (o *FilterStatusPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post conflict response has a 5xx status code +func (o *FilterStatusPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post conflict response a status code equal to that given +func (o *FilterStatusPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter status post conflict response +func (o *FilterStatusPostConflict) Code() int { + return 409 +} + +func (o *FilterStatusPostConflict) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostConflict", 409) +} + +func (o *FilterStatusPostConflict) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostConflict", 409) +} + +func (o *FilterStatusPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostUnprocessableEntity creates a FilterStatusPostUnprocessableEntity with default headers values +func NewFilterStatusPostUnprocessableEntity() *FilterStatusPostUnprocessableEntity { + return &FilterStatusPostUnprocessableEntity{} +} + +/* +FilterStatusPostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterStatusPostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter status post unprocessable entity response has a 2xx status code +func (o *FilterStatusPostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post unprocessable entity response has a 3xx status code +func (o *FilterStatusPostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post unprocessable entity response has a 4xx status code +func (o *FilterStatusPostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter status post unprocessable entity response has a 5xx status code +func (o *FilterStatusPostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter status post unprocessable entity response a status code equal to that given +func (o *FilterStatusPostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter status post unprocessable entity response +func (o *FilterStatusPostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterStatusPostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnprocessableEntity", 422) +} + +func (o *FilterStatusPostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostUnprocessableEntity", 422) +} + +func (o *FilterStatusPostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusPostInternalServerError creates a FilterStatusPostInternalServerError with default headers values +func NewFilterStatusPostInternalServerError() *FilterStatusPostInternalServerError { + return &FilterStatusPostInternalServerError{} +} + +/* +FilterStatusPostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusPostInternalServerError struct { +} + +// IsSuccess returns true when this filter status post internal server error response has a 2xx status code +func (o *FilterStatusPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter status post internal server error response has a 3xx status code +func (o *FilterStatusPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter status post internal server error response has a 4xx status code +func (o *FilterStatusPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter status post internal server error response has a 5xx status code +func (o *FilterStatusPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter status post internal server error response a status code equal to that given +func (o *FilterStatusPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter status post internal server error response +func (o *FilterStatusPostInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostInternalServerError", 500) +} + +func (o *FilterStatusPostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v2/filters/{id}/statuses][%d] filterStatusPostInternalServerError", 500) +} + +func (o *FilterStatusPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_statuses_get_parameters.go b/client/filters/filter_statuses_get_parameters.go new file mode 100644 index 0000000..e653304 --- /dev/null +++ b/client/filters/filter_statuses_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterStatusesGetParams creates a new FilterStatusesGetParams 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 NewFilterStatusesGetParams() *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterStatusesGetParamsWithTimeout creates a new FilterStatusesGetParams object +// with the ability to set a timeout on a request. +func NewFilterStatusesGetParamsWithTimeout(timeout time.Duration) *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + timeout: timeout, + } +} + +// NewFilterStatusesGetParamsWithContext creates a new FilterStatusesGetParams object +// with the ability to set a context for a request. +func NewFilterStatusesGetParamsWithContext(ctx context.Context) *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + Context: ctx, + } +} + +// NewFilterStatusesGetParamsWithHTTPClient creates a new FilterStatusesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterStatusesGetParamsWithHTTPClient(client *http.Client) *FilterStatusesGetParams { + return &FilterStatusesGetParams{ + HTTPClient: client, + } +} + +/* +FilterStatusesGetParams contains all the parameters to send to the API endpoint + + for the filter statuses get operation. + + Typically these are written to a http.Request. +*/ +type FilterStatusesGetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter statuses get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusesGetParams) WithDefaults() *FilterStatusesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter statuses get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterStatusesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter statuses get params +func (o *FilterStatusesGetParams) WithTimeout(timeout time.Duration) *FilterStatusesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter statuses get params +func (o *FilterStatusesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter statuses get params +func (o *FilterStatusesGetParams) WithContext(ctx context.Context) *FilterStatusesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter statuses get params +func (o *FilterStatusesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter statuses get params +func (o *FilterStatusesGetParams) WithHTTPClient(client *http.Client) *FilterStatusesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter statuses get params +func (o *FilterStatusesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter statuses get params +func (o *FilterStatusesGetParams) WithID(id string) *FilterStatusesGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter statuses get params +func (o *FilterStatusesGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterStatusesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_statuses_get_responses.go b/client/filters/filter_statuses_get_responses.go new file mode 100644 index 0000000..e21dc97 --- /dev/null +++ b/client/filters/filter_statuses_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterStatusesGetReader is a Reader for the FilterStatusesGet structure. +type FilterStatusesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterStatusesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterStatusesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterStatusesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterStatusesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterStatusesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterStatusesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterStatusesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/{id}/statuses] filterStatusesGet", response, response.Code()) + } +} + +// NewFilterStatusesGetOK creates a FilterStatusesGetOK with default headers values +func NewFilterStatusesGetOK() *FilterStatusesGetOK { + return &FilterStatusesGetOK{} +} + +/* +FilterStatusesGetOK describes a response with status code 200, with default header values. + +Requested filter statuses. +*/ +type FilterStatusesGetOK struct { + Payload []*models.FilterStatus +} + +// IsSuccess returns true when this filter statuses get o k response has a 2xx status code +func (o *FilterStatusesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter statuses get o k response has a 3xx status code +func (o *FilterStatusesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get o k response has a 4xx status code +func (o *FilterStatusesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter statuses get o k response has a 5xx status code +func (o *FilterStatusesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get o k response a status code equal to that given +func (o *FilterStatusesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter statuses get o k response +func (o *FilterStatusesGetOK) Code() int { + return 200 +} + +func (o *FilterStatusesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetOK %s", 200, payload) +} + +func (o *FilterStatusesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetOK %s", 200, payload) +} + +func (o *FilterStatusesGetOK) GetPayload() []*models.FilterStatus { + return o.Payload +} + +func (o *FilterStatusesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterStatusesGetBadRequest creates a FilterStatusesGetBadRequest with default headers values +func NewFilterStatusesGetBadRequest() *FilterStatusesGetBadRequest { + return &FilterStatusesGetBadRequest{} +} + +/* +FilterStatusesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterStatusesGetBadRequest struct { +} + +// IsSuccess returns true when this filter statuses get bad request response has a 2xx status code +func (o *FilterStatusesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get bad request response has a 3xx status code +func (o *FilterStatusesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get bad request response has a 4xx status code +func (o *FilterStatusesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get bad request response has a 5xx status code +func (o *FilterStatusesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get bad request response a status code equal to that given +func (o *FilterStatusesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter statuses get bad request response +func (o *FilterStatusesGetBadRequest) Code() int { + return 400 +} + +func (o *FilterStatusesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetBadRequest", 400) +} + +func (o *FilterStatusesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetBadRequest", 400) +} + +func (o *FilterStatusesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetUnauthorized creates a FilterStatusesGetUnauthorized with default headers values +func NewFilterStatusesGetUnauthorized() *FilterStatusesGetUnauthorized { + return &FilterStatusesGetUnauthorized{} +} + +/* +FilterStatusesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterStatusesGetUnauthorized struct { +} + +// IsSuccess returns true when this filter statuses get unauthorized response has a 2xx status code +func (o *FilterStatusesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get unauthorized response has a 3xx status code +func (o *FilterStatusesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get unauthorized response has a 4xx status code +func (o *FilterStatusesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get unauthorized response has a 5xx status code +func (o *FilterStatusesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get unauthorized response a status code equal to that given +func (o *FilterStatusesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter statuses get unauthorized response +func (o *FilterStatusesGetUnauthorized) Code() int { + return 401 +} + +func (o *FilterStatusesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetUnauthorized", 401) +} + +func (o *FilterStatusesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetUnauthorized", 401) +} + +func (o *FilterStatusesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetNotFound creates a FilterStatusesGetNotFound with default headers values +func NewFilterStatusesGetNotFound() *FilterStatusesGetNotFound { + return &FilterStatusesGetNotFound{} +} + +/* +FilterStatusesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterStatusesGetNotFound struct { +} + +// IsSuccess returns true when this filter statuses get not found response has a 2xx status code +func (o *FilterStatusesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get not found response has a 3xx status code +func (o *FilterStatusesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get not found response has a 4xx status code +func (o *FilterStatusesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get not found response has a 5xx status code +func (o *FilterStatusesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get not found response a status code equal to that given +func (o *FilterStatusesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter statuses get not found response +func (o *FilterStatusesGetNotFound) Code() int { + return 404 +} + +func (o *FilterStatusesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotFound", 404) +} + +func (o *FilterStatusesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotFound", 404) +} + +func (o *FilterStatusesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetNotAcceptable creates a FilterStatusesGetNotAcceptable with default headers values +func NewFilterStatusesGetNotAcceptable() *FilterStatusesGetNotAcceptable { + return &FilterStatusesGetNotAcceptable{} +} + +/* +FilterStatusesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterStatusesGetNotAcceptable struct { +} + +// IsSuccess returns true when this filter statuses get not acceptable response has a 2xx status code +func (o *FilterStatusesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get not acceptable response has a 3xx status code +func (o *FilterStatusesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get not acceptable response has a 4xx status code +func (o *FilterStatusesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter statuses get not acceptable response has a 5xx status code +func (o *FilterStatusesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter statuses get not acceptable response a status code equal to that given +func (o *FilterStatusesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter statuses get not acceptable response +func (o *FilterStatusesGetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterStatusesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotAcceptable", 406) +} + +func (o *FilterStatusesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetNotAcceptable", 406) +} + +func (o *FilterStatusesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterStatusesGetInternalServerError creates a FilterStatusesGetInternalServerError with default headers values +func NewFilterStatusesGetInternalServerError() *FilterStatusesGetInternalServerError { + return &FilterStatusesGetInternalServerError{} +} + +/* +FilterStatusesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterStatusesGetInternalServerError struct { +} + +// IsSuccess returns true when this filter statuses get internal server error response has a 2xx status code +func (o *FilterStatusesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter statuses get internal server error response has a 3xx status code +func (o *FilterStatusesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter statuses get internal server error response has a 4xx status code +func (o *FilterStatusesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter statuses get internal server error response has a 5xx status code +func (o *FilterStatusesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter statuses get internal server error response a status code equal to that given +func (o *FilterStatusesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter statuses get internal server error response +func (o *FilterStatusesGetInternalServerError) Code() int { + return 500 +} + +func (o *FilterStatusesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetInternalServerError", 500) +} + +func (o *FilterStatusesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}/statuses][%d] filterStatusesGetInternalServerError", 500) +} + +func (o *FilterStatusesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v1_delete_parameters.go b/client/filters/filter_v1_delete_parameters.go new file mode 100644 index 0000000..07cb3b0 --- /dev/null +++ b/client/filters/filter_v1_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1DeleteParams creates a new FilterV1DeleteParams 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 NewFilterV1DeleteParams() *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1DeleteParamsWithTimeout creates a new FilterV1DeleteParams object +// with the ability to set a timeout on a request. +func NewFilterV1DeleteParamsWithTimeout(timeout time.Duration) *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + timeout: timeout, + } +} + +// NewFilterV1DeleteParamsWithContext creates a new FilterV1DeleteParams object +// with the ability to set a context for a request. +func NewFilterV1DeleteParamsWithContext(ctx context.Context) *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + Context: ctx, + } +} + +// NewFilterV1DeleteParamsWithHTTPClient creates a new FilterV1DeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1DeleteParamsWithHTTPClient(client *http.Client) *FilterV1DeleteParams { + return &FilterV1DeleteParams{ + HTTPClient: client, + } +} + +/* +FilterV1DeleteParams contains all the parameters to send to the API endpoint + + for the filter v1 delete operation. + + Typically these are written to a http.Request. +*/ +type FilterV1DeleteParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1DeleteParams) WithDefaults() *FilterV1DeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1DeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v1 delete params +func (o *FilterV1DeleteParams) WithTimeout(timeout time.Duration) *FilterV1DeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 delete params +func (o *FilterV1DeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 delete params +func (o *FilterV1DeleteParams) WithContext(ctx context.Context) *FilterV1DeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 delete params +func (o *FilterV1DeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 delete params +func (o *FilterV1DeleteParams) WithHTTPClient(client *http.Client) *FilterV1DeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 delete params +func (o *FilterV1DeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v1 delete params +func (o *FilterV1DeleteParams) WithID(id string) *FilterV1DeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v1 delete params +func (o *FilterV1DeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1DeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_v1_delete_responses.go b/client/filters/filter_v1_delete_responses.go new file mode 100644 index 0000000..5d4cd60 --- /dev/null +++ b/client/filters/filter_v1_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// FilterV1DeleteReader is a Reader for the FilterV1Delete structure. +type FilterV1DeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1DeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1DeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1DeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1DeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1DeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1DeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1DeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/filters/{id}] filterV1Delete", response, response.Code()) + } +} + +// NewFilterV1DeleteOK creates a FilterV1DeleteOK with default headers values +func NewFilterV1DeleteOK() *FilterV1DeleteOK { + return &FilterV1DeleteOK{} +} + +/* +FilterV1DeleteOK describes a response with status code 200, with default header values. + +filter deleted +*/ +type FilterV1DeleteOK struct { +} + +// IsSuccess returns true when this filter v1 delete o k response has a 2xx status code +func (o *FilterV1DeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 delete o k response has a 3xx status code +func (o *FilterV1DeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete o k response has a 4xx status code +func (o *FilterV1DeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 delete o k response has a 5xx status code +func (o *FilterV1DeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete o k response a status code equal to that given +func (o *FilterV1DeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 delete o k response +func (o *FilterV1DeleteOK) Code() int { + return 200 +} + +func (o *FilterV1DeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteOK", 200) +} + +func (o *FilterV1DeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteOK", 200) +} + +func (o *FilterV1DeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteBadRequest creates a FilterV1DeleteBadRequest with default headers values +func NewFilterV1DeleteBadRequest() *FilterV1DeleteBadRequest { + return &FilterV1DeleteBadRequest{} +} + +/* +FilterV1DeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1DeleteBadRequest struct { +} + +// IsSuccess returns true when this filter v1 delete bad request response has a 2xx status code +func (o *FilterV1DeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete bad request response has a 3xx status code +func (o *FilterV1DeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete bad request response has a 4xx status code +func (o *FilterV1DeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete bad request response has a 5xx status code +func (o *FilterV1DeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete bad request response a status code equal to that given +func (o *FilterV1DeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 delete bad request response +func (o *FilterV1DeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterV1DeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteBadRequest", 400) +} + +func (o *FilterV1DeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteBadRequest", 400) +} + +func (o *FilterV1DeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteUnauthorized creates a FilterV1DeleteUnauthorized with default headers values +func NewFilterV1DeleteUnauthorized() *FilterV1DeleteUnauthorized { + return &FilterV1DeleteUnauthorized{} +} + +/* +FilterV1DeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1DeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 delete unauthorized response has a 2xx status code +func (o *FilterV1DeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete unauthorized response has a 3xx status code +func (o *FilterV1DeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete unauthorized response has a 4xx status code +func (o *FilterV1DeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete unauthorized response has a 5xx status code +func (o *FilterV1DeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete unauthorized response a status code equal to that given +func (o *FilterV1DeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 delete unauthorized response +func (o *FilterV1DeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1DeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteUnauthorized", 401) +} + +func (o *FilterV1DeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteUnauthorized", 401) +} + +func (o *FilterV1DeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteNotFound creates a FilterV1DeleteNotFound with default headers values +func NewFilterV1DeleteNotFound() *FilterV1DeleteNotFound { + return &FilterV1DeleteNotFound{} +} + +/* +FilterV1DeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1DeleteNotFound struct { +} + +// IsSuccess returns true when this filter v1 delete not found response has a 2xx status code +func (o *FilterV1DeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete not found response has a 3xx status code +func (o *FilterV1DeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete not found response has a 4xx status code +func (o *FilterV1DeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete not found response has a 5xx status code +func (o *FilterV1DeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete not found response a status code equal to that given +func (o *FilterV1DeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 delete not found response +func (o *FilterV1DeleteNotFound) Code() int { + return 404 +} + +func (o *FilterV1DeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotFound", 404) +} + +func (o *FilterV1DeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotFound", 404) +} + +func (o *FilterV1DeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteNotAcceptable creates a FilterV1DeleteNotAcceptable with default headers values +func NewFilterV1DeleteNotAcceptable() *FilterV1DeleteNotAcceptable { + return &FilterV1DeleteNotAcceptable{} +} + +/* +FilterV1DeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1DeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 delete not acceptable response has a 2xx status code +func (o *FilterV1DeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete not acceptable response has a 3xx status code +func (o *FilterV1DeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete not acceptable response has a 4xx status code +func (o *FilterV1DeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 delete not acceptable response has a 5xx status code +func (o *FilterV1DeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 delete not acceptable response a status code equal to that given +func (o *FilterV1DeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 delete not acceptable response +func (o *FilterV1DeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1DeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotAcceptable", 406) +} + +func (o *FilterV1DeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteNotAcceptable", 406) +} + +func (o *FilterV1DeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1DeleteInternalServerError creates a FilterV1DeleteInternalServerError with default headers values +func NewFilterV1DeleteInternalServerError() *FilterV1DeleteInternalServerError { + return &FilterV1DeleteInternalServerError{} +} + +/* +FilterV1DeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1DeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 delete internal server error response has a 2xx status code +func (o *FilterV1DeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 delete internal server error response has a 3xx status code +func (o *FilterV1DeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 delete internal server error response has a 4xx status code +func (o *FilterV1DeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 delete internal server error response has a 5xx status code +func (o *FilterV1DeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 delete internal server error response a status code equal to that given +func (o *FilterV1DeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 delete internal server error response +func (o *FilterV1DeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1DeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteInternalServerError", 500) +} + +func (o *FilterV1DeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/filters/{id}][%d] filterV1DeleteInternalServerError", 500) +} + +func (o *FilterV1DeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v1_get_parameters.go b/client/filters/filter_v1_get_parameters.go new file mode 100644 index 0000000..c2063c6 --- /dev/null +++ b/client/filters/filter_v1_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1GetParams creates a new FilterV1GetParams 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 NewFilterV1GetParams() *FilterV1GetParams { + return &FilterV1GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1GetParamsWithTimeout creates a new FilterV1GetParams object +// with the ability to set a timeout on a request. +func NewFilterV1GetParamsWithTimeout(timeout time.Duration) *FilterV1GetParams { + return &FilterV1GetParams{ + timeout: timeout, + } +} + +// NewFilterV1GetParamsWithContext creates a new FilterV1GetParams object +// with the ability to set a context for a request. +func NewFilterV1GetParamsWithContext(ctx context.Context) *FilterV1GetParams { + return &FilterV1GetParams{ + Context: ctx, + } +} + +// NewFilterV1GetParamsWithHTTPClient creates a new FilterV1GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1GetParamsWithHTTPClient(client *http.Client) *FilterV1GetParams { + return &FilterV1GetParams{ + HTTPClient: client, + } +} + +/* +FilterV1GetParams contains all the parameters to send to the API endpoint + + for the filter v1 get operation. + + Typically these are written to a http.Request. +*/ +type FilterV1GetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1GetParams) WithDefaults() *FilterV1GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v1 get params +func (o *FilterV1GetParams) WithTimeout(timeout time.Duration) *FilterV1GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 get params +func (o *FilterV1GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 get params +func (o *FilterV1GetParams) WithContext(ctx context.Context) *FilterV1GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 get params +func (o *FilterV1GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 get params +func (o *FilterV1GetParams) WithHTTPClient(client *http.Client) *FilterV1GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 get params +func (o *FilterV1GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v1 get params +func (o *FilterV1GetParams) WithID(id string) *FilterV1GetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v1 get params +func (o *FilterV1GetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_v1_get_responses.go b/client/filters/filter_v1_get_responses.go new file mode 100644 index 0000000..499e86f --- /dev/null +++ b/client/filters/filter_v1_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV1GetReader is a Reader for the FilterV1Get structure. +type FilterV1GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/filters/{id}] filterV1Get", response, response.Code()) + } +} + +// NewFilterV1GetOK creates a FilterV1GetOK with default headers values +func NewFilterV1GetOK() *FilterV1GetOK { + return &FilterV1GetOK{} +} + +/* +FilterV1GetOK describes a response with status code 200, with default header values. + +Requested filter. +*/ +type FilterV1GetOK struct { + Payload *models.FilterV1 +} + +// IsSuccess returns true when this filter v1 get o k response has a 2xx status code +func (o *FilterV1GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 get o k response has a 3xx status code +func (o *FilterV1GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get o k response has a 4xx status code +func (o *FilterV1GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 get o k response has a 5xx status code +func (o *FilterV1GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get o k response a status code equal to that given +func (o *FilterV1GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 get o k response +func (o *FilterV1GetOK) Code() int { + return 200 +} + +func (o *FilterV1GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetOK %s", 200, payload) +} + +func (o *FilterV1GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetOK %s", 200, payload) +} + +func (o *FilterV1GetOK) GetPayload() *models.FilterV1 { + return o.Payload +} + +func (o *FilterV1GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV1GetBadRequest creates a FilterV1GetBadRequest with default headers values +func NewFilterV1GetBadRequest() *FilterV1GetBadRequest { + return &FilterV1GetBadRequest{} +} + +/* +FilterV1GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1GetBadRequest struct { +} + +// IsSuccess returns true when this filter v1 get bad request response has a 2xx status code +func (o *FilterV1GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get bad request response has a 3xx status code +func (o *FilterV1GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get bad request response has a 4xx status code +func (o *FilterV1GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get bad request response has a 5xx status code +func (o *FilterV1GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get bad request response a status code equal to that given +func (o *FilterV1GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 get bad request response +func (o *FilterV1GetBadRequest) Code() int { + return 400 +} + +func (o *FilterV1GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetBadRequest", 400) +} + +func (o *FilterV1GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetBadRequest", 400) +} + +func (o *FilterV1GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetUnauthorized creates a FilterV1GetUnauthorized with default headers values +func NewFilterV1GetUnauthorized() *FilterV1GetUnauthorized { + return &FilterV1GetUnauthorized{} +} + +/* +FilterV1GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1GetUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 get unauthorized response has a 2xx status code +func (o *FilterV1GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get unauthorized response has a 3xx status code +func (o *FilterV1GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get unauthorized response has a 4xx status code +func (o *FilterV1GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get unauthorized response has a 5xx status code +func (o *FilterV1GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get unauthorized response a status code equal to that given +func (o *FilterV1GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 get unauthorized response +func (o *FilterV1GetUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetUnauthorized", 401) +} + +func (o *FilterV1GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetUnauthorized", 401) +} + +func (o *FilterV1GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetNotFound creates a FilterV1GetNotFound with default headers values +func NewFilterV1GetNotFound() *FilterV1GetNotFound { + return &FilterV1GetNotFound{} +} + +/* +FilterV1GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1GetNotFound struct { +} + +// IsSuccess returns true when this filter v1 get not found response has a 2xx status code +func (o *FilterV1GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get not found response has a 3xx status code +func (o *FilterV1GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get not found response has a 4xx status code +func (o *FilterV1GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get not found response has a 5xx status code +func (o *FilterV1GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get not found response a status code equal to that given +func (o *FilterV1GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 get not found response +func (o *FilterV1GetNotFound) Code() int { + return 404 +} + +func (o *FilterV1GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotFound", 404) +} + +func (o *FilterV1GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotFound", 404) +} + +func (o *FilterV1GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetNotAcceptable creates a FilterV1GetNotAcceptable with default headers values +func NewFilterV1GetNotAcceptable() *FilterV1GetNotAcceptable { + return &FilterV1GetNotAcceptable{} +} + +/* +FilterV1GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1GetNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 get not acceptable response has a 2xx status code +func (o *FilterV1GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get not acceptable response has a 3xx status code +func (o *FilterV1GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get not acceptable response has a 4xx status code +func (o *FilterV1GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 get not acceptable response has a 5xx status code +func (o *FilterV1GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 get not acceptable response a status code equal to that given +func (o *FilterV1GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 get not acceptable response +func (o *FilterV1GetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotAcceptable", 406) +} + +func (o *FilterV1GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetNotAcceptable", 406) +} + +func (o *FilterV1GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1GetInternalServerError creates a FilterV1GetInternalServerError with default headers values +func NewFilterV1GetInternalServerError() *FilterV1GetInternalServerError { + return &FilterV1GetInternalServerError{} +} + +/* +FilterV1GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1GetInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 get internal server error response has a 2xx status code +func (o *FilterV1GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 get internal server error response has a 3xx status code +func (o *FilterV1GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 get internal server error response has a 4xx status code +func (o *FilterV1GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 get internal server error response has a 5xx status code +func (o *FilterV1GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 get internal server error response a status code equal to that given +func (o *FilterV1GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 get internal server error response +func (o *FilterV1GetInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetInternalServerError", 500) +} + +func (o *FilterV1GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/filters/{id}][%d] filterV1GetInternalServerError", 500) +} + +func (o *FilterV1GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v1_post_parameters.go b/client/filters/filter_v1_post_parameters.go new file mode 100644 index 0000000..bb93786 --- /dev/null +++ b/client/filters/filter_v1_post_parameters.go @@ -0,0 +1,321 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1PostParams creates a new FilterV1PostParams 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 NewFilterV1PostParams() *FilterV1PostParams { + return &FilterV1PostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1PostParamsWithTimeout creates a new FilterV1PostParams object +// with the ability to set a timeout on a request. +func NewFilterV1PostParamsWithTimeout(timeout time.Duration) *FilterV1PostParams { + return &FilterV1PostParams{ + timeout: timeout, + } +} + +// NewFilterV1PostParamsWithContext creates a new FilterV1PostParams object +// with the ability to set a context for a request. +func NewFilterV1PostParamsWithContext(ctx context.Context) *FilterV1PostParams { + return &FilterV1PostParams{ + Context: ctx, + } +} + +// NewFilterV1PostParamsWithHTTPClient creates a new FilterV1PostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1PostParamsWithHTTPClient(client *http.Client) *FilterV1PostParams { + return &FilterV1PostParams{ + HTTPClient: client, + } +} + +/* +FilterV1PostParams contains all the parameters to send to the API endpoint + + for the filter v1 post operation. + + Typically these are written to a http.Request. +*/ +type FilterV1PostParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* Irreversible. + + Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. + + Sample: false + */ + Irreversible *bool + + /* Phrase. + + The text to be filtered. + + Sample: fnord + */ + Phrase string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PostParams) WithDefaults() *FilterV1PostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PostParams) SetDefaults() { + var ( + irreversibleDefault = bool(false) + + wholeWordDefault = bool(false) + ) + + val := FilterV1PostParams{ + Irreversible: &irreversibleDefault, + WholeWord: &wholeWordDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v1 post params +func (o *FilterV1PostParams) WithTimeout(timeout time.Duration) *FilterV1PostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 post params +func (o *FilterV1PostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 post params +func (o *FilterV1PostParams) WithContext(ctx context.Context) *FilterV1PostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 post params +func (o *FilterV1PostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 post params +func (o *FilterV1PostParams) WithHTTPClient(client *http.Client) *FilterV1PostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 post params +func (o *FilterV1PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v1 post params +func (o *FilterV1PostParams) WithFilterContext(context []string) *FilterV1PostParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v1 post params +func (o *FilterV1PostParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v1 post params +func (o *FilterV1PostParams) WithExpiresIn(expiresIn *float64) *FilterV1PostParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v1 post params +func (o *FilterV1PostParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithIrreversible adds the irreversible to the filter v1 post params +func (o *FilterV1PostParams) WithIrreversible(irreversible *bool) *FilterV1PostParams { + o.SetIrreversible(irreversible) + return o +} + +// SetIrreversible adds the irreversible to the filter v1 post params +func (o *FilterV1PostParams) SetIrreversible(irreversible *bool) { + o.Irreversible = irreversible +} + +// WithPhrase adds the phrase to the filter v1 post params +func (o *FilterV1PostParams) WithPhrase(phrase string) *FilterV1PostParams { + o.SetPhrase(phrase) + return o +} + +// SetPhrase adds the phrase to the filter v1 post params +func (o *FilterV1PostParams) SetPhrase(phrase string) { + o.Phrase = phrase +} + +// WithWholeWord adds the wholeWord to the filter v1 post params +func (o *FilterV1PostParams) WithWholeWord(wholeWord *bool) *FilterV1PostParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter v1 post params +func (o *FilterV1PostParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + if o.Irreversible != nil { + + // form param irreversible + var frIrreversible bool + if o.Irreversible != nil { + frIrreversible = *o.Irreversible + } + fIrreversible := swag.FormatBool(frIrreversible) + if fIrreversible != "" { + if err := r.SetFormParam("irreversible", fIrreversible); err != nil { + return err + } + } + } + + // form param phrase + frPhrase := o.Phrase + fPhrase := frPhrase + if fPhrase != "" { + if err := r.SetFormParam("phrase", fPhrase); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV1Post binds the parameter context[] +func (o *FilterV1PostParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} diff --git a/client/filters/filter_v1_post_responses.go b/client/filters/filter_v1_post_responses.go new file mode 100644 index 0000000..e860cc8 --- /dev/null +++ b/client/filters/filter_v1_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV1PostReader is a Reader for the FilterV1Post structure. +type FilterV1PostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1PostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1PostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1PostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1PostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV1PostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1PostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1PostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV1PostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV1PostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1PostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/filters] filterV1Post", response, response.Code()) + } +} + +// NewFilterV1PostOK creates a FilterV1PostOK with default headers values +func NewFilterV1PostOK() *FilterV1PostOK { + return &FilterV1PostOK{} +} + +/* +FilterV1PostOK describes a response with status code 200, with default header values. + +New filter. +*/ +type FilterV1PostOK struct { + Payload *models.FilterV1 +} + +// IsSuccess returns true when this filter v1 post o k response has a 2xx status code +func (o *FilterV1PostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 post o k response has a 3xx status code +func (o *FilterV1PostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post o k response has a 4xx status code +func (o *FilterV1PostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 post o k response has a 5xx status code +func (o *FilterV1PostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post o k response a status code equal to that given +func (o *FilterV1PostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 post o k response +func (o *FilterV1PostOK) Code() int { + return 200 +} + +func (o *FilterV1PostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostOK %s", 200, payload) +} + +func (o *FilterV1PostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostOK %s", 200, payload) +} + +func (o *FilterV1PostOK) GetPayload() *models.FilterV1 { + return o.Payload +} + +func (o *FilterV1PostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV1PostBadRequest creates a FilterV1PostBadRequest with default headers values +func NewFilterV1PostBadRequest() *FilterV1PostBadRequest { + return &FilterV1PostBadRequest{} +} + +/* +FilterV1PostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1PostBadRequest struct { +} + +// IsSuccess returns true when this filter v1 post bad request response has a 2xx status code +func (o *FilterV1PostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post bad request response has a 3xx status code +func (o *FilterV1PostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post bad request response has a 4xx status code +func (o *FilterV1PostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post bad request response has a 5xx status code +func (o *FilterV1PostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post bad request response a status code equal to that given +func (o *FilterV1PostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 post bad request response +func (o *FilterV1PostBadRequest) Code() int { + return 400 +} + +func (o *FilterV1PostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostBadRequest", 400) +} + +func (o *FilterV1PostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostBadRequest", 400) +} + +func (o *FilterV1PostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostUnauthorized creates a FilterV1PostUnauthorized with default headers values +func NewFilterV1PostUnauthorized() *FilterV1PostUnauthorized { + return &FilterV1PostUnauthorized{} +} + +/* +FilterV1PostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1PostUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 post unauthorized response has a 2xx status code +func (o *FilterV1PostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post unauthorized response has a 3xx status code +func (o *FilterV1PostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post unauthorized response has a 4xx status code +func (o *FilterV1PostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post unauthorized response has a 5xx status code +func (o *FilterV1PostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post unauthorized response a status code equal to that given +func (o *FilterV1PostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 post unauthorized response +func (o *FilterV1PostUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1PostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnauthorized", 401) +} + +func (o *FilterV1PostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnauthorized", 401) +} + +func (o *FilterV1PostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostForbidden creates a FilterV1PostForbidden with default headers values +func NewFilterV1PostForbidden() *FilterV1PostForbidden { + return &FilterV1PostForbidden{} +} + +/* +FilterV1PostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV1PostForbidden struct { +} + +// IsSuccess returns true when this filter v1 post forbidden response has a 2xx status code +func (o *FilterV1PostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post forbidden response has a 3xx status code +func (o *FilterV1PostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post forbidden response has a 4xx status code +func (o *FilterV1PostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post forbidden response has a 5xx status code +func (o *FilterV1PostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post forbidden response a status code equal to that given +func (o *FilterV1PostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v1 post forbidden response +func (o *FilterV1PostForbidden) Code() int { + return 403 +} + +func (o *FilterV1PostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostForbidden", 403) +} + +func (o *FilterV1PostForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostForbidden", 403) +} + +func (o *FilterV1PostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostNotFound creates a FilterV1PostNotFound with default headers values +func NewFilterV1PostNotFound() *FilterV1PostNotFound { + return &FilterV1PostNotFound{} +} + +/* +FilterV1PostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1PostNotFound struct { +} + +// IsSuccess returns true when this filter v1 post not found response has a 2xx status code +func (o *FilterV1PostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post not found response has a 3xx status code +func (o *FilterV1PostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post not found response has a 4xx status code +func (o *FilterV1PostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post not found response has a 5xx status code +func (o *FilterV1PostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post not found response a status code equal to that given +func (o *FilterV1PostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 post not found response +func (o *FilterV1PostNotFound) Code() int { + return 404 +} + +func (o *FilterV1PostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotFound", 404) +} + +func (o *FilterV1PostNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotFound", 404) +} + +func (o *FilterV1PostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostNotAcceptable creates a FilterV1PostNotAcceptable with default headers values +func NewFilterV1PostNotAcceptable() *FilterV1PostNotAcceptable { + return &FilterV1PostNotAcceptable{} +} + +/* +FilterV1PostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1PostNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 post not acceptable response has a 2xx status code +func (o *FilterV1PostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post not acceptable response has a 3xx status code +func (o *FilterV1PostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post not acceptable response has a 4xx status code +func (o *FilterV1PostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post not acceptable response has a 5xx status code +func (o *FilterV1PostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post not acceptable response a status code equal to that given +func (o *FilterV1PostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 post not acceptable response +func (o *FilterV1PostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1PostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotAcceptable", 406) +} + +func (o *FilterV1PostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostNotAcceptable", 406) +} + +func (o *FilterV1PostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostConflict creates a FilterV1PostConflict with default headers values +func NewFilterV1PostConflict() *FilterV1PostConflict { + return &FilterV1PostConflict{} +} + +/* +FilterV1PostConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterV1PostConflict struct { +} + +// IsSuccess returns true when this filter v1 post conflict response has a 2xx status code +func (o *FilterV1PostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post conflict response has a 3xx status code +func (o *FilterV1PostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post conflict response has a 4xx status code +func (o *FilterV1PostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post conflict response has a 5xx status code +func (o *FilterV1PostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post conflict response a status code equal to that given +func (o *FilterV1PostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v1 post conflict response +func (o *FilterV1PostConflict) Code() int { + return 409 +} + +func (o *FilterV1PostConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostConflict", 409) +} + +func (o *FilterV1PostConflict) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostConflict", 409) +} + +func (o *FilterV1PostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostUnprocessableEntity creates a FilterV1PostUnprocessableEntity with default headers values +func NewFilterV1PostUnprocessableEntity() *FilterV1PostUnprocessableEntity { + return &FilterV1PostUnprocessableEntity{} +} + +/* +FilterV1PostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV1PostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v1 post unprocessable entity response has a 2xx status code +func (o *FilterV1PostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post unprocessable entity response has a 3xx status code +func (o *FilterV1PostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post unprocessable entity response has a 4xx status code +func (o *FilterV1PostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 post unprocessable entity response has a 5xx status code +func (o *FilterV1PostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 post unprocessable entity response a status code equal to that given +func (o *FilterV1PostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v1 post unprocessable entity response +func (o *FilterV1PostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV1PostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnprocessableEntity", 422) +} + +func (o *FilterV1PostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostUnprocessableEntity", 422) +} + +func (o *FilterV1PostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PostInternalServerError creates a FilterV1PostInternalServerError with default headers values +func NewFilterV1PostInternalServerError() *FilterV1PostInternalServerError { + return &FilterV1PostInternalServerError{} +} + +/* +FilterV1PostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1PostInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 post internal server error response has a 2xx status code +func (o *FilterV1PostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 post internal server error response has a 3xx status code +func (o *FilterV1PostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 post internal server error response has a 4xx status code +func (o *FilterV1PostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 post internal server error response has a 5xx status code +func (o *FilterV1PostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 post internal server error response a status code equal to that given +func (o *FilterV1PostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 post internal server error response +func (o *FilterV1PostInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1PostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostInternalServerError", 500) +} + +func (o *FilterV1PostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/filters][%d] filterV1PostInternalServerError", 500) +} + +func (o *FilterV1PostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v1_put_parameters.go b/client/filters/filter_v1_put_parameters.go new file mode 100644 index 0000000..5e03a61 --- /dev/null +++ b/client/filters/filter_v1_put_parameters.go @@ -0,0 +1,343 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV1PutParams creates a new FilterV1PutParams 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 NewFilterV1PutParams() *FilterV1PutParams { + return &FilterV1PutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV1PutParamsWithTimeout creates a new FilterV1PutParams object +// with the ability to set a timeout on a request. +func NewFilterV1PutParamsWithTimeout(timeout time.Duration) *FilterV1PutParams { + return &FilterV1PutParams{ + timeout: timeout, + } +} + +// NewFilterV1PutParamsWithContext creates a new FilterV1PutParams object +// with the ability to set a context for a request. +func NewFilterV1PutParamsWithContext(ctx context.Context) *FilterV1PutParams { + return &FilterV1PutParams{ + Context: ctx, + } +} + +// NewFilterV1PutParamsWithHTTPClient creates a new FilterV1PutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV1PutParamsWithHTTPClient(client *http.Client) *FilterV1PutParams { + return &FilterV1PutParams{ + HTTPClient: client, + } +} + +/* +FilterV1PutParams contains all the parameters to send to the API endpoint + + for the filter v1 put operation. + + Typically these are written to a http.Request. +*/ +type FilterV1PutParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* ID. + + ID of the filter. + */ + ID string + + /* Irreversible. + + Should matching entities be removed from the user's timelines/views, instead of hidden? Not supported yet. + + Sample: false + */ + Irreversible *bool + + /* Phrase. + + The text to be filtered. + + Sample: fnord + */ + Phrase string + + /* WholeWord. + + Should the filter consider word boundaries? + + Sample: true + */ + WholeWord *bool + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v1 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PutParams) WithDefaults() *FilterV1PutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v1 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV1PutParams) SetDefaults() { + var ( + irreversibleDefault = bool(false) + + wholeWordDefault = bool(false) + ) + + val := FilterV1PutParams{ + Irreversible: &irreversibleDefault, + WholeWord: &wholeWordDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v1 put params +func (o *FilterV1PutParams) WithTimeout(timeout time.Duration) *FilterV1PutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v1 put params +func (o *FilterV1PutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v1 put params +func (o *FilterV1PutParams) WithContext(ctx context.Context) *FilterV1PutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v1 put params +func (o *FilterV1PutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v1 put params +func (o *FilterV1PutParams) WithHTTPClient(client *http.Client) *FilterV1PutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v1 put params +func (o *FilterV1PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v1 put params +func (o *FilterV1PutParams) WithFilterContext(context []string) *FilterV1PutParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v1 put params +func (o *FilterV1PutParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v1 put params +func (o *FilterV1PutParams) WithExpiresIn(expiresIn *float64) *FilterV1PutParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v1 put params +func (o *FilterV1PutParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithID adds the id to the filter v1 put params +func (o *FilterV1PutParams) WithID(id string) *FilterV1PutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v1 put params +func (o *FilterV1PutParams) SetID(id string) { + o.ID = id +} + +// WithIrreversible adds the irreversible to the filter v1 put params +func (o *FilterV1PutParams) WithIrreversible(irreversible *bool) *FilterV1PutParams { + o.SetIrreversible(irreversible) + return o +} + +// SetIrreversible adds the irreversible to the filter v1 put params +func (o *FilterV1PutParams) SetIrreversible(irreversible *bool) { + o.Irreversible = irreversible +} + +// WithPhrase adds the phrase to the filter v1 put params +func (o *FilterV1PutParams) WithPhrase(phrase string) *FilterV1PutParams { + o.SetPhrase(phrase) + return o +} + +// SetPhrase adds the phrase to the filter v1 put params +func (o *FilterV1PutParams) SetPhrase(phrase string) { + o.Phrase = phrase +} + +// WithWholeWord adds the wholeWord to the filter v1 put params +func (o *FilterV1PutParams) WithWholeWord(wholeWord *bool) *FilterV1PutParams { + o.SetWholeWord(wholeWord) + return o +} + +// SetWholeWord adds the wholeWord to the filter v1 put params +func (o *FilterV1PutParams) SetWholeWord(wholeWord *bool) { + o.WholeWord = wholeWord +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV1PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.Irreversible != nil { + + // form param irreversible + var frIrreversible bool + if o.Irreversible != nil { + frIrreversible = *o.Irreversible + } + fIrreversible := swag.FormatBool(frIrreversible) + if fIrreversible != "" { + if err := r.SetFormParam("irreversible", fIrreversible); err != nil { + return err + } + } + } + + // form param phrase + frPhrase := o.Phrase + fPhrase := frPhrase + if fPhrase != "" { + if err := r.SetFormParam("phrase", fPhrase); err != nil { + return err + } + } + + if o.WholeWord != nil { + + // form param whole_word + var frWholeWord bool + if o.WholeWord != nil { + frWholeWord = *o.WholeWord + } + fWholeWord := swag.FormatBool(frWholeWord) + if fWholeWord != "" { + if err := r.SetFormParam("whole_word", fWholeWord); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamFilterV1Put binds the parameter context[] +func (o *FilterV1PutParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} diff --git a/client/filters/filter_v1_put_responses.go b/client/filters/filter_v1_put_responses.go new file mode 100644 index 0000000..0c350b3 --- /dev/null +++ b/client/filters/filter_v1_put_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV1PutReader is a Reader for the FilterV1Put structure. +type FilterV1PutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV1PutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV1PutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV1PutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV1PutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV1PutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV1PutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV1PutNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV1PutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV1PutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV1PutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v1/filters/{id}] filterV1Put", response, response.Code()) + } +} + +// NewFilterV1PutOK creates a FilterV1PutOK with default headers values +func NewFilterV1PutOK() *FilterV1PutOK { + return &FilterV1PutOK{} +} + +/* +FilterV1PutOK describes a response with status code 200, with default header values. + +Updated filter. +*/ +type FilterV1PutOK struct { + Payload *models.FilterV1 +} + +// IsSuccess returns true when this filter v1 put o k response has a 2xx status code +func (o *FilterV1PutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v1 put o k response has a 3xx status code +func (o *FilterV1PutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put o k response has a 4xx status code +func (o *FilterV1PutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 put o k response has a 5xx status code +func (o *FilterV1PutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put o k response a status code equal to that given +func (o *FilterV1PutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v1 put o k response +func (o *FilterV1PutOK) Code() int { + return 200 +} + +func (o *FilterV1PutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutOK %s", 200, payload) +} + +func (o *FilterV1PutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutOK %s", 200, payload) +} + +func (o *FilterV1PutOK) GetPayload() *models.FilterV1 { + return o.Payload +} + +func (o *FilterV1PutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV1PutBadRequest creates a FilterV1PutBadRequest with default headers values +func NewFilterV1PutBadRequest() *FilterV1PutBadRequest { + return &FilterV1PutBadRequest{} +} + +/* +FilterV1PutBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV1PutBadRequest struct { +} + +// IsSuccess returns true when this filter v1 put bad request response has a 2xx status code +func (o *FilterV1PutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put bad request response has a 3xx status code +func (o *FilterV1PutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put bad request response has a 4xx status code +func (o *FilterV1PutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put bad request response has a 5xx status code +func (o *FilterV1PutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put bad request response a status code equal to that given +func (o *FilterV1PutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v1 put bad request response +func (o *FilterV1PutBadRequest) Code() int { + return 400 +} + +func (o *FilterV1PutBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutBadRequest", 400) +} + +func (o *FilterV1PutBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutBadRequest", 400) +} + +func (o *FilterV1PutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutUnauthorized creates a FilterV1PutUnauthorized with default headers values +func NewFilterV1PutUnauthorized() *FilterV1PutUnauthorized { + return &FilterV1PutUnauthorized{} +} + +/* +FilterV1PutUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV1PutUnauthorized struct { +} + +// IsSuccess returns true when this filter v1 put unauthorized response has a 2xx status code +func (o *FilterV1PutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put unauthorized response has a 3xx status code +func (o *FilterV1PutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put unauthorized response has a 4xx status code +func (o *FilterV1PutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put unauthorized response has a 5xx status code +func (o *FilterV1PutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put unauthorized response a status code equal to that given +func (o *FilterV1PutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v1 put unauthorized response +func (o *FilterV1PutUnauthorized) Code() int { + return 401 +} + +func (o *FilterV1PutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnauthorized", 401) +} + +func (o *FilterV1PutUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnauthorized", 401) +} + +func (o *FilterV1PutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutForbidden creates a FilterV1PutForbidden with default headers values +func NewFilterV1PutForbidden() *FilterV1PutForbidden { + return &FilterV1PutForbidden{} +} + +/* +FilterV1PutForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV1PutForbidden struct { +} + +// IsSuccess returns true when this filter v1 put forbidden response has a 2xx status code +func (o *FilterV1PutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put forbidden response has a 3xx status code +func (o *FilterV1PutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put forbidden response has a 4xx status code +func (o *FilterV1PutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put forbidden response has a 5xx status code +func (o *FilterV1PutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put forbidden response a status code equal to that given +func (o *FilterV1PutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v1 put forbidden response +func (o *FilterV1PutForbidden) Code() int { + return 403 +} + +func (o *FilterV1PutForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutForbidden", 403) +} + +func (o *FilterV1PutForbidden) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutForbidden", 403) +} + +func (o *FilterV1PutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutNotFound creates a FilterV1PutNotFound with default headers values +func NewFilterV1PutNotFound() *FilterV1PutNotFound { + return &FilterV1PutNotFound{} +} + +/* +FilterV1PutNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV1PutNotFound struct { +} + +// IsSuccess returns true when this filter v1 put not found response has a 2xx status code +func (o *FilterV1PutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put not found response has a 3xx status code +func (o *FilterV1PutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put not found response has a 4xx status code +func (o *FilterV1PutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put not found response has a 5xx status code +func (o *FilterV1PutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put not found response a status code equal to that given +func (o *FilterV1PutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v1 put not found response +func (o *FilterV1PutNotFound) Code() int { + return 404 +} + +func (o *FilterV1PutNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotFound", 404) +} + +func (o *FilterV1PutNotFound) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotFound", 404) +} + +func (o *FilterV1PutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutNotAcceptable creates a FilterV1PutNotAcceptable with default headers values +func NewFilterV1PutNotAcceptable() *FilterV1PutNotAcceptable { + return &FilterV1PutNotAcceptable{} +} + +/* +FilterV1PutNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV1PutNotAcceptable struct { +} + +// IsSuccess returns true when this filter v1 put not acceptable response has a 2xx status code +func (o *FilterV1PutNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put not acceptable response has a 3xx status code +func (o *FilterV1PutNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put not acceptable response has a 4xx status code +func (o *FilterV1PutNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put not acceptable response has a 5xx status code +func (o *FilterV1PutNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put not acceptable response a status code equal to that given +func (o *FilterV1PutNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v1 put not acceptable response +func (o *FilterV1PutNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV1PutNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotAcceptable", 406) +} + +func (o *FilterV1PutNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutNotAcceptable", 406) +} + +func (o *FilterV1PutNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutConflict creates a FilterV1PutConflict with default headers values +func NewFilterV1PutConflict() *FilterV1PutConflict { + return &FilterV1PutConflict{} +} + +/* +FilterV1PutConflict describes a response with status code 409, with default header values. + +conflict (duplicate keyword) +*/ +type FilterV1PutConflict struct { +} + +// IsSuccess returns true when this filter v1 put conflict response has a 2xx status code +func (o *FilterV1PutConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put conflict response has a 3xx status code +func (o *FilterV1PutConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put conflict response has a 4xx status code +func (o *FilterV1PutConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put conflict response has a 5xx status code +func (o *FilterV1PutConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put conflict response a status code equal to that given +func (o *FilterV1PutConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v1 put conflict response +func (o *FilterV1PutConflict) Code() int { + return 409 +} + +func (o *FilterV1PutConflict) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutConflict", 409) +} + +func (o *FilterV1PutConflict) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutConflict", 409) +} + +func (o *FilterV1PutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutUnprocessableEntity creates a FilterV1PutUnprocessableEntity with default headers values +func NewFilterV1PutUnprocessableEntity() *FilterV1PutUnprocessableEntity { + return &FilterV1PutUnprocessableEntity{} +} + +/* +FilterV1PutUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV1PutUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v1 put unprocessable entity response has a 2xx status code +func (o *FilterV1PutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put unprocessable entity response has a 3xx status code +func (o *FilterV1PutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put unprocessable entity response has a 4xx status code +func (o *FilterV1PutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v1 put unprocessable entity response has a 5xx status code +func (o *FilterV1PutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v1 put unprocessable entity response a status code equal to that given +func (o *FilterV1PutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v1 put unprocessable entity response +func (o *FilterV1PutUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV1PutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnprocessableEntity", 422) +} + +func (o *FilterV1PutUnprocessableEntity) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutUnprocessableEntity", 422) +} + +func (o *FilterV1PutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV1PutInternalServerError creates a FilterV1PutInternalServerError with default headers values +func NewFilterV1PutInternalServerError() *FilterV1PutInternalServerError { + return &FilterV1PutInternalServerError{} +} + +/* +FilterV1PutInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV1PutInternalServerError struct { +} + +// IsSuccess returns true when this filter v1 put internal server error response has a 2xx status code +func (o *FilterV1PutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v1 put internal server error response has a 3xx status code +func (o *FilterV1PutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v1 put internal server error response has a 4xx status code +func (o *FilterV1PutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v1 put internal server error response has a 5xx status code +func (o *FilterV1PutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v1 put internal server error response a status code equal to that given +func (o *FilterV1PutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v1 put internal server error response +func (o *FilterV1PutInternalServerError) Code() int { + return 500 +} + +func (o *FilterV1PutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutInternalServerError", 500) +} + +func (o *FilterV1PutInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v1/filters/{id}][%d] filterV1PutInternalServerError", 500) +} + +func (o *FilterV1PutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v2_delete_parameters.go b/client/filters/filter_v2_delete_parameters.go new file mode 100644 index 0000000..bdb8ed4 --- /dev/null +++ b/client/filters/filter_v2_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2DeleteParams creates a new FilterV2DeleteParams 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 NewFilterV2DeleteParams() *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2DeleteParamsWithTimeout creates a new FilterV2DeleteParams object +// with the ability to set a timeout on a request. +func NewFilterV2DeleteParamsWithTimeout(timeout time.Duration) *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + timeout: timeout, + } +} + +// NewFilterV2DeleteParamsWithContext creates a new FilterV2DeleteParams object +// with the ability to set a context for a request. +func NewFilterV2DeleteParamsWithContext(ctx context.Context) *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + Context: ctx, + } +} + +// NewFilterV2DeleteParamsWithHTTPClient creates a new FilterV2DeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2DeleteParamsWithHTTPClient(client *http.Client) *FilterV2DeleteParams { + return &FilterV2DeleteParams{ + HTTPClient: client, + } +} + +/* +FilterV2DeleteParams contains all the parameters to send to the API endpoint + + for the filter v2 delete operation. + + Typically these are written to a http.Request. +*/ +type FilterV2DeleteParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2DeleteParams) WithDefaults() *FilterV2DeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2DeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 delete params +func (o *FilterV2DeleteParams) WithTimeout(timeout time.Duration) *FilterV2DeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 delete params +func (o *FilterV2DeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 delete params +func (o *FilterV2DeleteParams) WithContext(ctx context.Context) *FilterV2DeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 delete params +func (o *FilterV2DeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 delete params +func (o *FilterV2DeleteParams) WithHTTPClient(client *http.Client) *FilterV2DeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 delete params +func (o *FilterV2DeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v2 delete params +func (o *FilterV2DeleteParams) WithID(id string) *FilterV2DeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 delete params +func (o *FilterV2DeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2DeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_v2_delete_responses.go b/client/filters/filter_v2_delete_responses.go new file mode 100644 index 0000000..b184a09 --- /dev/null +++ b/client/filters/filter_v2_delete_responses.go @@ -0,0 +1,398 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// FilterV2DeleteReader is a Reader for the FilterV2Delete structure. +type FilterV2DeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2DeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2DeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2DeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2DeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2DeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2DeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2DeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v2/filters/{id}] filterV2Delete", response, response.Code()) + } +} + +// NewFilterV2DeleteOK creates a FilterV2DeleteOK with default headers values +func NewFilterV2DeleteOK() *FilterV2DeleteOK { + return &FilterV2DeleteOK{} +} + +/* +FilterV2DeleteOK describes a response with status code 200, with default header values. + +filter deleted +*/ +type FilterV2DeleteOK struct { +} + +// IsSuccess returns true when this filter v2 delete o k response has a 2xx status code +func (o *FilterV2DeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 delete o k response has a 3xx status code +func (o *FilterV2DeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete o k response has a 4xx status code +func (o *FilterV2DeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 delete o k response has a 5xx status code +func (o *FilterV2DeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete o k response a status code equal to that given +func (o *FilterV2DeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 delete o k response +func (o *FilterV2DeleteOK) Code() int { + return 200 +} + +func (o *FilterV2DeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteOK", 200) +} + +func (o *FilterV2DeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteOK", 200) +} + +func (o *FilterV2DeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteBadRequest creates a FilterV2DeleteBadRequest with default headers values +func NewFilterV2DeleteBadRequest() *FilterV2DeleteBadRequest { + return &FilterV2DeleteBadRequest{} +} + +/* +FilterV2DeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2DeleteBadRequest struct { +} + +// IsSuccess returns true when this filter v2 delete bad request response has a 2xx status code +func (o *FilterV2DeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete bad request response has a 3xx status code +func (o *FilterV2DeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete bad request response has a 4xx status code +func (o *FilterV2DeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete bad request response has a 5xx status code +func (o *FilterV2DeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete bad request response a status code equal to that given +func (o *FilterV2DeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 delete bad request response +func (o *FilterV2DeleteBadRequest) Code() int { + return 400 +} + +func (o *FilterV2DeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteBadRequest", 400) +} + +func (o *FilterV2DeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteBadRequest", 400) +} + +func (o *FilterV2DeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteUnauthorized creates a FilterV2DeleteUnauthorized with default headers values +func NewFilterV2DeleteUnauthorized() *FilterV2DeleteUnauthorized { + return &FilterV2DeleteUnauthorized{} +} + +/* +FilterV2DeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2DeleteUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 delete unauthorized response has a 2xx status code +func (o *FilterV2DeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete unauthorized response has a 3xx status code +func (o *FilterV2DeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete unauthorized response has a 4xx status code +func (o *FilterV2DeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete unauthorized response has a 5xx status code +func (o *FilterV2DeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete unauthorized response a status code equal to that given +func (o *FilterV2DeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 delete unauthorized response +func (o *FilterV2DeleteUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2DeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteUnauthorized", 401) +} + +func (o *FilterV2DeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteUnauthorized", 401) +} + +func (o *FilterV2DeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteNotFound creates a FilterV2DeleteNotFound with default headers values +func NewFilterV2DeleteNotFound() *FilterV2DeleteNotFound { + return &FilterV2DeleteNotFound{} +} + +/* +FilterV2DeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2DeleteNotFound struct { +} + +// IsSuccess returns true when this filter v2 delete not found response has a 2xx status code +func (o *FilterV2DeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete not found response has a 3xx status code +func (o *FilterV2DeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete not found response has a 4xx status code +func (o *FilterV2DeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete not found response has a 5xx status code +func (o *FilterV2DeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete not found response a status code equal to that given +func (o *FilterV2DeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 delete not found response +func (o *FilterV2DeleteNotFound) Code() int { + return 404 +} + +func (o *FilterV2DeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotFound", 404) +} + +func (o *FilterV2DeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotFound", 404) +} + +func (o *FilterV2DeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteNotAcceptable creates a FilterV2DeleteNotAcceptable with default headers values +func NewFilterV2DeleteNotAcceptable() *FilterV2DeleteNotAcceptable { + return &FilterV2DeleteNotAcceptable{} +} + +/* +FilterV2DeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2DeleteNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 delete not acceptable response has a 2xx status code +func (o *FilterV2DeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete not acceptable response has a 3xx status code +func (o *FilterV2DeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete not acceptable response has a 4xx status code +func (o *FilterV2DeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 delete not acceptable response has a 5xx status code +func (o *FilterV2DeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 delete not acceptable response a status code equal to that given +func (o *FilterV2DeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 delete not acceptable response +func (o *FilterV2DeleteNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2DeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotAcceptable", 406) +} + +func (o *FilterV2DeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteNotAcceptable", 406) +} + +func (o *FilterV2DeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2DeleteInternalServerError creates a FilterV2DeleteInternalServerError with default headers values +func NewFilterV2DeleteInternalServerError() *FilterV2DeleteInternalServerError { + return &FilterV2DeleteInternalServerError{} +} + +/* +FilterV2DeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2DeleteInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 delete internal server error response has a 2xx status code +func (o *FilterV2DeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 delete internal server error response has a 3xx status code +func (o *FilterV2DeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 delete internal server error response has a 4xx status code +func (o *FilterV2DeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 delete internal server error response has a 5xx status code +func (o *FilterV2DeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 delete internal server error response a status code equal to that given +func (o *FilterV2DeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 delete internal server error response +func (o *FilterV2DeleteInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2DeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteInternalServerError", 500) +} + +func (o *FilterV2DeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v2/filters/{id}][%d] filterV2DeleteInternalServerError", 500) +} + +func (o *FilterV2DeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v2_get_parameters.go b/client/filters/filter_v2_get_parameters.go new file mode 100644 index 0000000..ffc1936 --- /dev/null +++ b/client/filters/filter_v2_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2GetParams creates a new FilterV2GetParams 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 NewFilterV2GetParams() *FilterV2GetParams { + return &FilterV2GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2GetParamsWithTimeout creates a new FilterV2GetParams object +// with the ability to set a timeout on a request. +func NewFilterV2GetParamsWithTimeout(timeout time.Duration) *FilterV2GetParams { + return &FilterV2GetParams{ + timeout: timeout, + } +} + +// NewFilterV2GetParamsWithContext creates a new FilterV2GetParams object +// with the ability to set a context for a request. +func NewFilterV2GetParamsWithContext(ctx context.Context) *FilterV2GetParams { + return &FilterV2GetParams{ + Context: ctx, + } +} + +// NewFilterV2GetParamsWithHTTPClient creates a new FilterV2GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2GetParamsWithHTTPClient(client *http.Client) *FilterV2GetParams { + return &FilterV2GetParams{ + HTTPClient: client, + } +} + +/* +FilterV2GetParams contains all the parameters to send to the API endpoint + + for the filter v2 get operation. + + Typically these are written to a http.Request. +*/ +type FilterV2GetParams struct { + + /* ID. + + ID of the filter + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2GetParams) WithDefaults() *FilterV2GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 get params +func (o *FilterV2GetParams) WithTimeout(timeout time.Duration) *FilterV2GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 get params +func (o *FilterV2GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 get params +func (o *FilterV2GetParams) WithContext(ctx context.Context) *FilterV2GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 get params +func (o *FilterV2GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 get params +func (o *FilterV2GetParams) WithHTTPClient(client *http.Client) *FilterV2GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 get params +func (o *FilterV2GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the filter v2 get params +func (o *FilterV2GetParams) WithID(id string) *FilterV2GetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 get params +func (o *FilterV2GetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filter_v2_get_responses.go b/client/filters/filter_v2_get_responses.go new file mode 100644 index 0000000..914315e --- /dev/null +++ b/client/filters/filter_v2_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV2GetReader is a Reader for the FilterV2Get structure. +type FilterV2GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters/{id}] filterV2Get", response, response.Code()) + } +} + +// NewFilterV2GetOK creates a FilterV2GetOK with default headers values +func NewFilterV2GetOK() *FilterV2GetOK { + return &FilterV2GetOK{} +} + +/* +FilterV2GetOK describes a response with status code 200, with default header values. + +Requested filter. +*/ +type FilterV2GetOK struct { + Payload *models.FilterV2 +} + +// IsSuccess returns true when this filter v2 get o k response has a 2xx status code +func (o *FilterV2GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 get o k response has a 3xx status code +func (o *FilterV2GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get o k response has a 4xx status code +func (o *FilterV2GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 get o k response has a 5xx status code +func (o *FilterV2GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get o k response a status code equal to that given +func (o *FilterV2GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 get o k response +func (o *FilterV2GetOK) Code() int { + return 200 +} + +func (o *FilterV2GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetOK %s", 200, payload) +} + +func (o *FilterV2GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetOK %s", 200, payload) +} + +func (o *FilterV2GetOK) GetPayload() *models.FilterV2 { + return o.Payload +} + +func (o *FilterV2GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV2GetBadRequest creates a FilterV2GetBadRequest with default headers values +func NewFilterV2GetBadRequest() *FilterV2GetBadRequest { + return &FilterV2GetBadRequest{} +} + +/* +FilterV2GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2GetBadRequest struct { +} + +// IsSuccess returns true when this filter v2 get bad request response has a 2xx status code +func (o *FilterV2GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get bad request response has a 3xx status code +func (o *FilterV2GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get bad request response has a 4xx status code +func (o *FilterV2GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get bad request response has a 5xx status code +func (o *FilterV2GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get bad request response a status code equal to that given +func (o *FilterV2GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 get bad request response +func (o *FilterV2GetBadRequest) Code() int { + return 400 +} + +func (o *FilterV2GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetBadRequest", 400) +} + +func (o *FilterV2GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetBadRequest", 400) +} + +func (o *FilterV2GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetUnauthorized creates a FilterV2GetUnauthorized with default headers values +func NewFilterV2GetUnauthorized() *FilterV2GetUnauthorized { + return &FilterV2GetUnauthorized{} +} + +/* +FilterV2GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2GetUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 get unauthorized response has a 2xx status code +func (o *FilterV2GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get unauthorized response has a 3xx status code +func (o *FilterV2GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get unauthorized response has a 4xx status code +func (o *FilterV2GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get unauthorized response has a 5xx status code +func (o *FilterV2GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get unauthorized response a status code equal to that given +func (o *FilterV2GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 get unauthorized response +func (o *FilterV2GetUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetUnauthorized", 401) +} + +func (o *FilterV2GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetUnauthorized", 401) +} + +func (o *FilterV2GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetNotFound creates a FilterV2GetNotFound with default headers values +func NewFilterV2GetNotFound() *FilterV2GetNotFound { + return &FilterV2GetNotFound{} +} + +/* +FilterV2GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2GetNotFound struct { +} + +// IsSuccess returns true when this filter v2 get not found response has a 2xx status code +func (o *FilterV2GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get not found response has a 3xx status code +func (o *FilterV2GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get not found response has a 4xx status code +func (o *FilterV2GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get not found response has a 5xx status code +func (o *FilterV2GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get not found response a status code equal to that given +func (o *FilterV2GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 get not found response +func (o *FilterV2GetNotFound) Code() int { + return 404 +} + +func (o *FilterV2GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotFound", 404) +} + +func (o *FilterV2GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotFound", 404) +} + +func (o *FilterV2GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetNotAcceptable creates a FilterV2GetNotAcceptable with default headers values +func NewFilterV2GetNotAcceptable() *FilterV2GetNotAcceptable { + return &FilterV2GetNotAcceptable{} +} + +/* +FilterV2GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2GetNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 get not acceptable response has a 2xx status code +func (o *FilterV2GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get not acceptable response has a 3xx status code +func (o *FilterV2GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get not acceptable response has a 4xx status code +func (o *FilterV2GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 get not acceptable response has a 5xx status code +func (o *FilterV2GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 get not acceptable response a status code equal to that given +func (o *FilterV2GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 get not acceptable response +func (o *FilterV2GetNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotAcceptable", 406) +} + +func (o *FilterV2GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetNotAcceptable", 406) +} + +func (o *FilterV2GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2GetInternalServerError creates a FilterV2GetInternalServerError with default headers values +func NewFilterV2GetInternalServerError() *FilterV2GetInternalServerError { + return &FilterV2GetInternalServerError{} +} + +/* +FilterV2GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2GetInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 get internal server error response has a 2xx status code +func (o *FilterV2GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 get internal server error response has a 3xx status code +func (o *FilterV2GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 get internal server error response has a 4xx status code +func (o *FilterV2GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 get internal server error response has a 5xx status code +func (o *FilterV2GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 get internal server error response a status code equal to that given +func (o *FilterV2GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 get internal server error response +func (o *FilterV2GetInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetInternalServerError", 500) +} + +func (o *FilterV2GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters/{id}][%d] filterV2GetInternalServerError", 500) +} + +func (o *FilterV2GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v2_post_parameters.go b/client/filters/filter_v2_post_parameters.go new file mode 100644 index 0000000..a19c745 --- /dev/null +++ b/client/filters/filter_v2_post_parameters.go @@ -0,0 +1,421 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PostParams creates a new FilterV2PostParams 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 NewFilterV2PostParams() *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PostParamsWithTimeout creates a new FilterV2PostParams object +// with the ability to set a timeout on a request. +func NewFilterV2PostParamsWithTimeout(timeout time.Duration) *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: timeout, + } +} + +// NewFilterV2PostParamsWithContext creates a new FilterV2PostParams object +// with the ability to set a context for a request. +func NewFilterV2PostParamsWithContext(ctx context.Context) *FilterV2PostParams { + return &FilterV2PostParams{ + Context: ctx, + } +} + +// NewFilterV2PostParamsWithHTTPClient creates a new FilterV2PostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PostParamsWithHTTPClient(client *http.Client) *FilterV2PostParams { + return &FilterV2PostParams{ + HTTPClient: client, + } +} + +/* +FilterV2PostParams contains all the parameters to send to the API endpoint + + for the filter v2 post operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PostParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* FilterAction. + + The action to be taken when a status matches this filter. + + Sample: warn + + Default: "warn" + */ + FilterAction *string + + /* KeywordsAttributesKeyword. + + Keywords to be added (if not using id param) or updated (if using id param). + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) WithDefaults() *FilterV2PostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) SetDefaults() { + var ( + filterActionDefault = string("warn") + ) + + val := FilterV2PostParams{ + FilterAction: &filterActionDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) WithTimeout(timeout time.Duration) *FilterV2PostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) WithContext(ctx context.Context) *FilterV2PostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) WithHTTPClient(client *http.Client) *FilterV2PostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v2 post params +func (o *FilterV2PostParams) WithFilterContext(context []string) *FilterV2PostParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v2 post params +func (o *FilterV2PostParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) WithExpiresIn(expiresIn *float64) *FilterV2PostParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) WithFilterAction(filterAction *string) *FilterV2PostParams { + o.SetFilterAction(filterAction) + return o +} + +// SetFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) SetFilterAction(filterAction *string) { + o.FilterAction = filterAction +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PostParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PostParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 post params +func (o *FilterV2PostParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PostParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 post params +func (o *FilterV2PostParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) WithTitle(title string) *FilterV2PostParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + if o.FilterAction != nil { + + // form param filter_action + var frFilterAction string + if o.FilterAction != nil { + frFilterAction = *o.FilterAction + } + fFilterAction := frFilterAction + if fFilterAction != "" { + if err := r.SetFormParam("filter_action", fFilterAction); err != nil { + return err + } + } + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); 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 +} + +// bindParamFilterV2Post binds the parameter context[] +func (o *FilterV2PostParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PostParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PostParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Post binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PostParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/client/filters/filter_v2_post_parameters.go.orig b/client/filters/filter_v2_post_parameters.go.orig new file mode 100644 index 0000000..990b351 --- /dev/null +++ b/client/filters/filter_v2_post_parameters.go.orig @@ -0,0 +1,421 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PostParams creates a new FilterV2PostParams 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 NewFilterV2PostParams() *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PostParamsWithTimeout creates a new FilterV2PostParams object +// with the ability to set a timeout on a request. +func NewFilterV2PostParamsWithTimeout(timeout time.Duration) *FilterV2PostParams { + return &FilterV2PostParams{ + timeout: timeout, + } +} + +// NewFilterV2PostParamsWithContext creates a new FilterV2PostParams object +// with the ability to set a context for a request. +func NewFilterV2PostParamsWithContext(ctx context.Context) *FilterV2PostParams { + return &FilterV2PostParams{ + Context: ctx, + } +} + +// NewFilterV2PostParamsWithHTTPClient creates a new FilterV2PostParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PostParamsWithHTTPClient(client *http.Client) *FilterV2PostParams { + return &FilterV2PostParams{ + HTTPClient: client, + } +} + +/* +FilterV2PostParams contains all the parameters to send to the API endpoint + + for the filter v2 post operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PostParams struct { + + /* Context. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + Context []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. If omitted, filter never expires. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* FilterAction. + + The action to be taken when a status matches this filter. + + Sample: warn + + Default: "warn" + */ + FilterAction *string + + /* KeywordsAttributesKeyword. + + Keywords to be added (if not using id param) or updated (if using id param). + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) WithDefaults() *FilterV2PostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PostParams) SetDefaults() { + var ( + filterActionDefault = string("warn") + ) + + val := FilterV2PostParams{ + FilterAction: &filterActionDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) WithTimeout(timeout time.Duration) *FilterV2PostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 post params +func (o *FilterV2PostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) WithContext(ctx context.Context) *FilterV2PostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) WithHTTPClient(client *http.Client) *FilterV2PostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 post params +func (o *FilterV2PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) WithContext(context []string) *FilterV2PostParams { + o.SetContext(context) + return o +} + +// SetContext adds the context to the filter v2 post params +func (o *FilterV2PostParams) SetContext(context []string) { + o.Context = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) WithExpiresIn(expiresIn *float64) *FilterV2PostParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 post params +func (o *FilterV2PostParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) WithFilterAction(filterAction *string) *FilterV2PostParams { + o.SetFilterAction(filterAction) + return o +} + +// SetFilterAction adds the filterAction to the filter v2 post params +func (o *FilterV2PostParams) SetFilterAction(filterAction *string) { + o.FilterAction = filterAction +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PostParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PostParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 post params +func (o *FilterV2PostParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 post params +func (o *FilterV2PostParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PostParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 post params +func (o *FilterV2PostParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) WithTitle(title string) *FilterV2PostParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 post params +func (o *FilterV2PostParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + if o.FilterAction != nil { + + // form param filter_action + var frFilterAction string + if o.FilterAction != nil { + frFilterAction = *o.FilterAction + } + fFilterAction := frFilterAction + if fFilterAction != "" { + if err := r.SetFormParam("filter_action", fFilterAction); err != nil { + return err + } + } + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); 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 +} + +// bindParamFilterV2Post binds the parameter context[] +func (o *FilterV2PostParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.Context + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PostParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Post binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PostParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Post binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PostParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/client/filters/filter_v2_post_responses.go b/client/filters/filter_v2_post_responses.go new file mode 100644 index 0000000..b004e25 --- /dev/null +++ b/client/filters/filter_v2_post_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV2PostReader is a Reader for the FilterV2Post structure. +type FilterV2PostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2PostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2PostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2PostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2PostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV2PostForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2PostNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2PostNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV2PostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV2PostUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2PostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v2/filters] filterV2Post", response, response.Code()) + } +} + +// NewFilterV2PostOK creates a FilterV2PostOK with default headers values +func NewFilterV2PostOK() *FilterV2PostOK { + return &FilterV2PostOK{} +} + +/* +FilterV2PostOK describes a response with status code 200, with default header values. + +New filter. +*/ +type FilterV2PostOK struct { + Payload *models.FilterV2 +} + +// IsSuccess returns true when this filter v2 post o k response has a 2xx status code +func (o *FilterV2PostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 post o k response has a 3xx status code +func (o *FilterV2PostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post o k response has a 4xx status code +func (o *FilterV2PostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 post o k response has a 5xx status code +func (o *FilterV2PostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post o k response a status code equal to that given +func (o *FilterV2PostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 post o k response +func (o *FilterV2PostOK) Code() int { + return 200 +} + +func (o *FilterV2PostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostOK %s", 200, payload) +} + +func (o *FilterV2PostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostOK %s", 200, payload) +} + +func (o *FilterV2PostOK) GetPayload() *models.FilterV2 { + return o.Payload +} + +func (o *FilterV2PostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV2PostBadRequest creates a FilterV2PostBadRequest with default headers values +func NewFilterV2PostBadRequest() *FilterV2PostBadRequest { + return &FilterV2PostBadRequest{} +} + +/* +FilterV2PostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2PostBadRequest struct { +} + +// IsSuccess returns true when this filter v2 post bad request response has a 2xx status code +func (o *FilterV2PostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post bad request response has a 3xx status code +func (o *FilterV2PostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post bad request response has a 4xx status code +func (o *FilterV2PostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post bad request response has a 5xx status code +func (o *FilterV2PostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post bad request response a status code equal to that given +func (o *FilterV2PostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 post bad request response +func (o *FilterV2PostBadRequest) Code() int { + return 400 +} + +func (o *FilterV2PostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostBadRequest", 400) +} + +func (o *FilterV2PostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostBadRequest", 400) +} + +func (o *FilterV2PostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostUnauthorized creates a FilterV2PostUnauthorized with default headers values +func NewFilterV2PostUnauthorized() *FilterV2PostUnauthorized { + return &FilterV2PostUnauthorized{} +} + +/* +FilterV2PostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2PostUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 post unauthorized response has a 2xx status code +func (o *FilterV2PostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post unauthorized response has a 3xx status code +func (o *FilterV2PostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post unauthorized response has a 4xx status code +func (o *FilterV2PostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post unauthorized response has a 5xx status code +func (o *FilterV2PostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post unauthorized response a status code equal to that given +func (o *FilterV2PostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 post unauthorized response +func (o *FilterV2PostUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2PostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnauthorized", 401) +} + +func (o *FilterV2PostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnauthorized", 401) +} + +func (o *FilterV2PostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostForbidden creates a FilterV2PostForbidden with default headers values +func NewFilterV2PostForbidden() *FilterV2PostForbidden { + return &FilterV2PostForbidden{} +} + +/* +FilterV2PostForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV2PostForbidden struct { +} + +// IsSuccess returns true when this filter v2 post forbidden response has a 2xx status code +func (o *FilterV2PostForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post forbidden response has a 3xx status code +func (o *FilterV2PostForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post forbidden response has a 4xx status code +func (o *FilterV2PostForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post forbidden response has a 5xx status code +func (o *FilterV2PostForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post forbidden response a status code equal to that given +func (o *FilterV2PostForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v2 post forbidden response +func (o *FilterV2PostForbidden) Code() int { + return 403 +} + +func (o *FilterV2PostForbidden) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostForbidden", 403) +} + +func (o *FilterV2PostForbidden) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostForbidden", 403) +} + +func (o *FilterV2PostForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostNotFound creates a FilterV2PostNotFound with default headers values +func NewFilterV2PostNotFound() *FilterV2PostNotFound { + return &FilterV2PostNotFound{} +} + +/* +FilterV2PostNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2PostNotFound struct { +} + +// IsSuccess returns true when this filter v2 post not found response has a 2xx status code +func (o *FilterV2PostNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post not found response has a 3xx status code +func (o *FilterV2PostNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post not found response has a 4xx status code +func (o *FilterV2PostNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post not found response has a 5xx status code +func (o *FilterV2PostNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post not found response a status code equal to that given +func (o *FilterV2PostNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 post not found response +func (o *FilterV2PostNotFound) Code() int { + return 404 +} + +func (o *FilterV2PostNotFound) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotFound", 404) +} + +func (o *FilterV2PostNotFound) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotFound", 404) +} + +func (o *FilterV2PostNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostNotAcceptable creates a FilterV2PostNotAcceptable with default headers values +func NewFilterV2PostNotAcceptable() *FilterV2PostNotAcceptable { + return &FilterV2PostNotAcceptable{} +} + +/* +FilterV2PostNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2PostNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 post not acceptable response has a 2xx status code +func (o *FilterV2PostNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post not acceptable response has a 3xx status code +func (o *FilterV2PostNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post not acceptable response has a 4xx status code +func (o *FilterV2PostNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post not acceptable response has a 5xx status code +func (o *FilterV2PostNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post not acceptable response a status code equal to that given +func (o *FilterV2PostNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 post not acceptable response +func (o *FilterV2PostNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2PostNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotAcceptable", 406) +} + +func (o *FilterV2PostNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostNotAcceptable", 406) +} + +func (o *FilterV2PostNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostConflict creates a FilterV2PostConflict with default headers values +func NewFilterV2PostConflict() *FilterV2PostConflict { + return &FilterV2PostConflict{} +} + +/* +FilterV2PostConflict describes a response with status code 409, with default header values. + +conflict (duplicate title, keyword, or status) +*/ +type FilterV2PostConflict struct { +} + +// IsSuccess returns true when this filter v2 post conflict response has a 2xx status code +func (o *FilterV2PostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post conflict response has a 3xx status code +func (o *FilterV2PostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post conflict response has a 4xx status code +func (o *FilterV2PostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post conflict response has a 5xx status code +func (o *FilterV2PostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post conflict response a status code equal to that given +func (o *FilterV2PostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v2 post conflict response +func (o *FilterV2PostConflict) Code() int { + return 409 +} + +func (o *FilterV2PostConflict) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostConflict", 409) +} + +func (o *FilterV2PostConflict) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostConflict", 409) +} + +func (o *FilterV2PostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostUnprocessableEntity creates a FilterV2PostUnprocessableEntity with default headers values +func NewFilterV2PostUnprocessableEntity() *FilterV2PostUnprocessableEntity { + return &FilterV2PostUnprocessableEntity{} +} + +/* +FilterV2PostUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV2PostUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v2 post unprocessable entity response has a 2xx status code +func (o *FilterV2PostUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post unprocessable entity response has a 3xx status code +func (o *FilterV2PostUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post unprocessable entity response has a 4xx status code +func (o *FilterV2PostUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 post unprocessable entity response has a 5xx status code +func (o *FilterV2PostUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 post unprocessable entity response a status code equal to that given +func (o *FilterV2PostUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v2 post unprocessable entity response +func (o *FilterV2PostUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV2PostUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnprocessableEntity", 422) +} + +func (o *FilterV2PostUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostUnprocessableEntity", 422) +} + +func (o *FilterV2PostUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PostInternalServerError creates a FilterV2PostInternalServerError with default headers values +func NewFilterV2PostInternalServerError() *FilterV2PostInternalServerError { + return &FilterV2PostInternalServerError{} +} + +/* +FilterV2PostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2PostInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 post internal server error response has a 2xx status code +func (o *FilterV2PostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 post internal server error response has a 3xx status code +func (o *FilterV2PostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 post internal server error response has a 4xx status code +func (o *FilterV2PostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 post internal server error response has a 5xx status code +func (o *FilterV2PostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 post internal server error response a status code equal to that given +func (o *FilterV2PostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 post internal server error response +func (o *FilterV2PostInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2PostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostInternalServerError", 500) +} + +func (o *FilterV2PostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v2/filters][%d] filterV2PostInternalServerError", 500) +} + +func (o *FilterV2PostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filter_v2_put_parameters.go b/client/filters/filter_v2_put_parameters.go new file mode 100644 index 0000000..46d60ec --- /dev/null +++ b/client/filters/filter_v2_put_parameters.go @@ -0,0 +1,396 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PutParams creates a new FilterV2PutParams 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 NewFilterV2PutParams() *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PutParamsWithTimeout creates a new FilterV2PutParams object +// with the ability to set a timeout on a request. +func NewFilterV2PutParamsWithTimeout(timeout time.Duration) *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: timeout, + } +} + +// NewFilterV2PutParamsWithContext creates a new FilterV2PutParams object +// with the ability to set a context for a request. +func NewFilterV2PutParamsWithContext(ctx context.Context) *FilterV2PutParams { + return &FilterV2PutParams{ + Context: ctx, + } +} + +// NewFilterV2PutParamsWithHTTPClient creates a new FilterV2PutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PutParamsWithHTTPClient(client *http.Client) *FilterV2PutParams { + return &FilterV2PutParams{ + HTTPClient: client, + } +} + +/* +FilterV2PutParams contains all the parameters to send to the API endpoint + + for the filter v2 put operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PutParams struct { + + /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + FilterContext []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* ID. + + ID of the filter. + */ + ID string + + /* KeywordsAttributesKeyword. + + Keywords to be added to the created filter. + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the newly created filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) WithDefaults() *FilterV2PutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) WithTimeout(timeout time.Duration) *FilterV2PutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) WithContext(ctx context.Context) *FilterV2PutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) WithHTTPClient(client *http.Client) *FilterV2PutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilterContext adds the filter context to the filter v2 put params +func (o *FilterV2PutParams) WithFilterContext(context []string) *FilterV2PutParams { + o.SetFilterContext(context) + return o +} + +// SetFilterContext adds the filter context to the filter v2 put params +func (o *FilterV2PutParams) SetFilterContext(context []string) { + o.FilterContext = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) WithExpiresIn(expiresIn *float64) *FilterV2PutParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithID adds the id to the filter v2 put params +func (o *FilterV2PutParams) WithID(id string) *FilterV2PutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 put params +func (o *FilterV2PutParams) SetID(id string) { + o.ID = id +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PutParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PutParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 put params +func (o *FilterV2PutParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PutParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 put params +func (o *FilterV2PutParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) WithTitle(title string) *FilterV2PutParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); 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 +} + +// bindParamFilterV2Put binds the parameter context[] +func (o *FilterV2PutParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PutParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PutParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Put binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PutParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/client/filters/filter_v2_put_parameters.go.orig b/client/filters/filter_v2_put_parameters.go.orig new file mode 100644 index 0000000..a8b726a --- /dev/null +++ b/client/filters/filter_v2_put_parameters.go.orig @@ -0,0 +1,396 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFilterV2PutParams creates a new FilterV2PutParams 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 NewFilterV2PutParams() *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFilterV2PutParamsWithTimeout creates a new FilterV2PutParams object +// with the ability to set a timeout on a request. +func NewFilterV2PutParamsWithTimeout(timeout time.Duration) *FilterV2PutParams { + return &FilterV2PutParams{ + timeout: timeout, + } +} + +// NewFilterV2PutParamsWithContext creates a new FilterV2PutParams object +// with the ability to set a context for a request. +func NewFilterV2PutParamsWithContext(ctx context.Context) *FilterV2PutParams { + return &FilterV2PutParams{ + Context: ctx, + } +} + +// NewFilterV2PutParamsWithHTTPClient creates a new FilterV2PutParams object +// with the ability to set a custom HTTPClient for a request. +func NewFilterV2PutParamsWithHTTPClient(client *http.Client) *FilterV2PutParams { + return &FilterV2PutParams{ + HTTPClient: client, + } +} + +/* +FilterV2PutParams contains all the parameters to send to the API endpoint + + for the filter v2 put operation. + + Typically these are written to a http.Request. +*/ +type FilterV2PutParams struct { + + /* Context. + + The contexts in which the filter should be applied. + + Sample: home, public + */ + Context []string + + /* ExpiresIn. + + Number of seconds from now that the filter should expire. + + Sample: 86400 + */ + ExpiresIn *float64 + + /* ID. + + ID of the filter. + */ + ID string + + /* KeywordsAttributesKeyword. + + Keywords to be added to the created filter. + */ + KeywordsAttributesKeyword []string + + /* KeywordsAttributesWholeWord. + + Should each keyword consider word boundaries? + */ + KeywordsAttributesWholeWord []bool + + /* StatusesAttributesStatusID. + + Statuses to be added to the newly created filter. + */ + StatusesAttributesStatusID []string + + /* Title. + + The name of the filter. + + Sample: illuminati nonsense + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) WithDefaults() *FilterV2PutParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filter v2 put params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FilterV2PutParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) WithTimeout(timeout time.Duration) *FilterV2PutParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filter v2 put params +func (o *FilterV2PutParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) WithContext(ctx context.Context) *FilterV2PutParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) WithHTTPClient(client *http.Client) *FilterV2PutParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filter v2 put params +func (o *FilterV2PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) WithContext(context []string) *FilterV2PutParams { + o.SetContext(context) + return o +} + +// SetContext adds the context to the filter v2 put params +func (o *FilterV2PutParams) SetContext(context []string) { + o.Context = context +} + +// WithExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) WithExpiresIn(expiresIn *float64) *FilterV2PutParams { + o.SetExpiresIn(expiresIn) + return o +} + +// SetExpiresIn adds the expiresIn to the filter v2 put params +func (o *FilterV2PutParams) SetExpiresIn(expiresIn *float64) { + o.ExpiresIn = expiresIn +} + +// WithID adds the id to the filter v2 put params +func (o *FilterV2PutParams) WithID(id string) *FilterV2PutParams { + o.SetID(id) + return o +} + +// SetID adds the id to the filter v2 put params +func (o *FilterV2PutParams) SetID(id string) { + o.ID = id +} + +// WithKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesKeyword(keywordsAttributesKeyword []string) *FilterV2PutParams { + o.SetKeywordsAttributesKeyword(keywordsAttributesKeyword) + return o +} + +// SetKeywordsAttributesKeyword adds the keywordsAttributesKeyword to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesKeyword(keywordsAttributesKeyword []string) { + o.KeywordsAttributesKeyword = keywordsAttributesKeyword +} + +// WithKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) WithKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) *FilterV2PutParams { + o.SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord) + return o +} + +// SetKeywordsAttributesWholeWord adds the keywordsAttributesWholeWord to the filter v2 put params +func (o *FilterV2PutParams) SetKeywordsAttributesWholeWord(keywordsAttributesWholeWord []bool) { + o.KeywordsAttributesWholeWord = keywordsAttributesWholeWord +} + +// WithStatusesAttributesStatusID adds the statusesAttributesStatusID to the filter v2 put params +func (o *FilterV2PutParams) WithStatusesAttributesStatusID(statusesAttributesStatusID []string) *FilterV2PutParams { + o.SetStatusesAttributesStatusID(statusesAttributesStatusID) + return o +} + +// SetStatusesAttributesStatusID adds the statusesAttributesStatusId to the filter v2 put params +func (o *FilterV2PutParams) SetStatusesAttributesStatusID(statusesAttributesStatusID []string) { + o.StatusesAttributesStatusID = statusesAttributesStatusID +} + +// WithTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) WithTitle(title string) *FilterV2PutParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the filter v2 put params +func (o *FilterV2PutParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *FilterV2PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Context != nil { + + // binding items for context[] + joinedContext := o.bindParamContext(reg) + + // form array param context[] + if err := r.SetFormParam("context[]", joinedContext...); err != nil { + return err + } + } + + if o.ExpiresIn != nil { + + // form param expires_in + var frExpiresIn float64 + if o.ExpiresIn != nil { + frExpiresIn = *o.ExpiresIn + } + fExpiresIn := swag.FormatFloat64(frExpiresIn) + if fExpiresIn != "" { + if err := r.SetFormParam("expires_in", fExpiresIn); err != nil { + return err + } + } + } + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if o.KeywordsAttributesKeyword != nil { + + // binding items for keywords_attributes[][keyword] + joinedKeywordsAttributesKeyword := o.bindParamKeywordsAttributesKeyword(reg) + + // form array param keywords_attributes[][keyword] + if err := r.SetFormParam("keywords_attributes[][keyword]", joinedKeywordsAttributesKeyword...); err != nil { + return err + } + } + + if o.KeywordsAttributesWholeWord != nil { + + // binding items for keywords_attributes[][whole_word] + joinedKeywordsAttributesWholeWord := o.bindParamKeywordsAttributesWholeWord(reg) + + // form array param keywords_attributes[][whole_word] + if err := r.SetFormParam("keywords_attributes[][whole_word]", joinedKeywordsAttributesWholeWord...); err != nil { + return err + } + } + + if o.StatusesAttributesStatusID != nil { + + // binding items for statuses_attributes[][status_id] + joinedStatusesAttributesStatusID := o.bindParamStatusesAttributesStatusID(reg) + + // form array param statuses_attributes[][status_id] + if err := r.SetFormParam("statuses_attributes[][status_id]", joinedStatusesAttributesStatusID...); 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 +} + +// bindParamFilterV2Put binds the parameter context[] +func (o *FilterV2PutParams) bindParamContext(formats strfmt.Registry) []string { + contextIR := o.Context + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string + + contextIIV := contextIIR // string as string + contextIC = append(contextIC, contextIIV) + } + + // items.CollectionFormat: "multi" + contextIS := swag.JoinByFormat(contextIC, "multi") + + return contextIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][keyword] +func (o *FilterV2PutParams) bindParamKeywordsAttributesKeyword(formats strfmt.Registry) []string { + keywordsAttributesKeywordIR := o.KeywordsAttributesKeyword + + var keywordsAttributesKeywordIC []string + for _, keywordsAttributesKeywordIIR := range keywordsAttributesKeywordIR { // explode []string + + keywordsAttributesKeywordIIV := keywordsAttributesKeywordIIR // string as string + keywordsAttributesKeywordIC = append(keywordsAttributesKeywordIC, keywordsAttributesKeywordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesKeywordIS := swag.JoinByFormat(keywordsAttributesKeywordIC, "multi") + + return keywordsAttributesKeywordIS +} + +// bindParamFilterV2Put binds the parameter keywords_attributes[][whole_word] +func (o *FilterV2PutParams) bindParamKeywordsAttributesWholeWord(formats strfmt.Registry) []string { + keywordsAttributesWholeWordIR := o.KeywordsAttributesWholeWord + + var keywordsAttributesWholeWordIC []string + for _, keywordsAttributesWholeWordIIR := range keywordsAttributesWholeWordIR { // explode []bool + + keywordsAttributesWholeWordIIV := swag.FormatBool(keywordsAttributesWholeWordIIR) // bool as string + keywordsAttributesWholeWordIC = append(keywordsAttributesWholeWordIC, keywordsAttributesWholeWordIIV) + } + + // items.CollectionFormat: "multi" + keywordsAttributesWholeWordIS := swag.JoinByFormat(keywordsAttributesWholeWordIC, "multi") + + return keywordsAttributesWholeWordIS +} + +// bindParamFilterV2Put binds the parameter statuses_attributes[][status_id] +func (o *FilterV2PutParams) bindParamStatusesAttributesStatusID(formats strfmt.Registry) []string { + statusesAttributesStatusIDIR := o.StatusesAttributesStatusID + + var statusesAttributesStatusIDIC []string + for _, statusesAttributesStatusIDIIR := range statusesAttributesStatusIDIR { // explode []string + + statusesAttributesStatusIDIIV := statusesAttributesStatusIDIIR // string as string + statusesAttributesStatusIDIC = append(statusesAttributesStatusIDIC, statusesAttributesStatusIDIIV) + } + + // items.CollectionFormat: "multi" + statusesAttributesStatusIDIS := swag.JoinByFormat(statusesAttributesStatusIDIC, "multi") + + return statusesAttributesStatusIDIS +} diff --git a/client/filters/filter_v2_put_responses.go b/client/filters/filter_v2_put_responses.go new file mode 100644 index 0000000..5ce8861 --- /dev/null +++ b/client/filters/filter_v2_put_responses.go @@ -0,0 +1,602 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FilterV2PutReader is a Reader for the FilterV2Put structure. +type FilterV2PutReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FilterV2PutReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFilterV2PutOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFilterV2PutBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFilterV2PutUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewFilterV2PutForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFilterV2PutNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFilterV2PutNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewFilterV2PutConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewFilterV2PutUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFilterV2PutInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v2/filters/{id}] filterV2Put", response, response.Code()) + } +} + +// NewFilterV2PutOK creates a FilterV2PutOK with default headers values +func NewFilterV2PutOK() *FilterV2PutOK { + return &FilterV2PutOK{} +} + +/* +FilterV2PutOK describes a response with status code 200, with default header values. + +Updated filter. +*/ +type FilterV2PutOK struct { + Payload *models.FilterV2 +} + +// IsSuccess returns true when this filter v2 put o k response has a 2xx status code +func (o *FilterV2PutOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filter v2 put o k response has a 3xx status code +func (o *FilterV2PutOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put o k response has a 4xx status code +func (o *FilterV2PutOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 put o k response has a 5xx status code +func (o *FilterV2PutOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put o k response a status code equal to that given +func (o *FilterV2PutOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filter v2 put o k response +func (o *FilterV2PutOK) Code() int { + return 200 +} + +func (o *FilterV2PutOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutOK %s", 200, payload) +} + +func (o *FilterV2PutOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutOK %s", 200, payload) +} + +func (o *FilterV2PutOK) GetPayload() *models.FilterV2 { + return o.Payload +} + +func (o *FilterV2PutOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.FilterV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFilterV2PutBadRequest creates a FilterV2PutBadRequest with default headers values +func NewFilterV2PutBadRequest() *FilterV2PutBadRequest { + return &FilterV2PutBadRequest{} +} + +/* +FilterV2PutBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FilterV2PutBadRequest struct { +} + +// IsSuccess returns true when this filter v2 put bad request response has a 2xx status code +func (o *FilterV2PutBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put bad request response has a 3xx status code +func (o *FilterV2PutBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put bad request response has a 4xx status code +func (o *FilterV2PutBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put bad request response has a 5xx status code +func (o *FilterV2PutBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put bad request response a status code equal to that given +func (o *FilterV2PutBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filter v2 put bad request response +func (o *FilterV2PutBadRequest) Code() int { + return 400 +} + +func (o *FilterV2PutBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutBadRequest", 400) +} + +func (o *FilterV2PutBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutBadRequest", 400) +} + +func (o *FilterV2PutBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutUnauthorized creates a FilterV2PutUnauthorized with default headers values +func NewFilterV2PutUnauthorized() *FilterV2PutUnauthorized { + return &FilterV2PutUnauthorized{} +} + +/* +FilterV2PutUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FilterV2PutUnauthorized struct { +} + +// IsSuccess returns true when this filter v2 put unauthorized response has a 2xx status code +func (o *FilterV2PutUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put unauthorized response has a 3xx status code +func (o *FilterV2PutUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put unauthorized response has a 4xx status code +func (o *FilterV2PutUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put unauthorized response has a 5xx status code +func (o *FilterV2PutUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put unauthorized response a status code equal to that given +func (o *FilterV2PutUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filter v2 put unauthorized response +func (o *FilterV2PutUnauthorized) Code() int { + return 401 +} + +func (o *FilterV2PutUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnauthorized", 401) +} + +func (o *FilterV2PutUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnauthorized", 401) +} + +func (o *FilterV2PutUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutForbidden creates a FilterV2PutForbidden with default headers values +func NewFilterV2PutForbidden() *FilterV2PutForbidden { + return &FilterV2PutForbidden{} +} + +/* +FilterV2PutForbidden describes a response with status code 403, with default header values. + +forbidden to moved accounts +*/ +type FilterV2PutForbidden struct { +} + +// IsSuccess returns true when this filter v2 put forbidden response has a 2xx status code +func (o *FilterV2PutForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put forbidden response has a 3xx status code +func (o *FilterV2PutForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put forbidden response has a 4xx status code +func (o *FilterV2PutForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put forbidden response has a 5xx status code +func (o *FilterV2PutForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put forbidden response a status code equal to that given +func (o *FilterV2PutForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the filter v2 put forbidden response +func (o *FilterV2PutForbidden) Code() int { + return 403 +} + +func (o *FilterV2PutForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutForbidden", 403) +} + +func (o *FilterV2PutForbidden) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutForbidden", 403) +} + +func (o *FilterV2PutForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutNotFound creates a FilterV2PutNotFound with default headers values +func NewFilterV2PutNotFound() *FilterV2PutNotFound { + return &FilterV2PutNotFound{} +} + +/* +FilterV2PutNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FilterV2PutNotFound struct { +} + +// IsSuccess returns true when this filter v2 put not found response has a 2xx status code +func (o *FilterV2PutNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put not found response has a 3xx status code +func (o *FilterV2PutNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put not found response has a 4xx status code +func (o *FilterV2PutNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put not found response has a 5xx status code +func (o *FilterV2PutNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put not found response a status code equal to that given +func (o *FilterV2PutNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filter v2 put not found response +func (o *FilterV2PutNotFound) Code() int { + return 404 +} + +func (o *FilterV2PutNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotFound", 404) +} + +func (o *FilterV2PutNotFound) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotFound", 404) +} + +func (o *FilterV2PutNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutNotAcceptable creates a FilterV2PutNotAcceptable with default headers values +func NewFilterV2PutNotAcceptable() *FilterV2PutNotAcceptable { + return &FilterV2PutNotAcceptable{} +} + +/* +FilterV2PutNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FilterV2PutNotAcceptable struct { +} + +// IsSuccess returns true when this filter v2 put not acceptable response has a 2xx status code +func (o *FilterV2PutNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put not acceptable response has a 3xx status code +func (o *FilterV2PutNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put not acceptable response has a 4xx status code +func (o *FilterV2PutNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put not acceptable response has a 5xx status code +func (o *FilterV2PutNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put not acceptable response a status code equal to that given +func (o *FilterV2PutNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filter v2 put not acceptable response +func (o *FilterV2PutNotAcceptable) Code() int { + return 406 +} + +func (o *FilterV2PutNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotAcceptable", 406) +} + +func (o *FilterV2PutNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutNotAcceptable", 406) +} + +func (o *FilterV2PutNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutConflict creates a FilterV2PutConflict with default headers values +func NewFilterV2PutConflict() *FilterV2PutConflict { + return &FilterV2PutConflict{} +} + +/* +FilterV2PutConflict describes a response with status code 409, with default header values. + +conflict (duplicate title, keyword, or status) +*/ +type FilterV2PutConflict struct { +} + +// IsSuccess returns true when this filter v2 put conflict response has a 2xx status code +func (o *FilterV2PutConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put conflict response has a 3xx status code +func (o *FilterV2PutConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put conflict response has a 4xx status code +func (o *FilterV2PutConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put conflict response has a 5xx status code +func (o *FilterV2PutConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put conflict response a status code equal to that given +func (o *FilterV2PutConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the filter v2 put conflict response +func (o *FilterV2PutConflict) Code() int { + return 409 +} + +func (o *FilterV2PutConflict) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutConflict", 409) +} + +func (o *FilterV2PutConflict) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutConflict", 409) +} + +func (o *FilterV2PutConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutUnprocessableEntity creates a FilterV2PutUnprocessableEntity with default headers values +func NewFilterV2PutUnprocessableEntity() *FilterV2PutUnprocessableEntity { + return &FilterV2PutUnprocessableEntity{} +} + +/* +FilterV2PutUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable content +*/ +type FilterV2PutUnprocessableEntity struct { +} + +// IsSuccess returns true when this filter v2 put unprocessable entity response has a 2xx status code +func (o *FilterV2PutUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put unprocessable entity response has a 3xx status code +func (o *FilterV2PutUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put unprocessable entity response has a 4xx status code +func (o *FilterV2PutUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this filter v2 put unprocessable entity response has a 5xx status code +func (o *FilterV2PutUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this filter v2 put unprocessable entity response a status code equal to that given +func (o *FilterV2PutUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the filter v2 put unprocessable entity response +func (o *FilterV2PutUnprocessableEntity) Code() int { + return 422 +} + +func (o *FilterV2PutUnprocessableEntity) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnprocessableEntity", 422) +} + +func (o *FilterV2PutUnprocessableEntity) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutUnprocessableEntity", 422) +} + +func (o *FilterV2PutUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFilterV2PutInternalServerError creates a FilterV2PutInternalServerError with default headers values +func NewFilterV2PutInternalServerError() *FilterV2PutInternalServerError { + return &FilterV2PutInternalServerError{} +} + +/* +FilterV2PutInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FilterV2PutInternalServerError struct { +} + +// IsSuccess returns true when this filter v2 put internal server error response has a 2xx status code +func (o *FilterV2PutInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filter v2 put internal server error response has a 3xx status code +func (o *FilterV2PutInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filter v2 put internal server error response has a 4xx status code +func (o *FilterV2PutInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filter v2 put internal server error response has a 5xx status code +func (o *FilterV2PutInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filter v2 put internal server error response a status code equal to that given +func (o *FilterV2PutInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filter v2 put internal server error response +func (o *FilterV2PutInternalServerError) Code() int { + return 500 +} + +func (o *FilterV2PutInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutInternalServerError", 500) +} + +func (o *FilterV2PutInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v2/filters/{id}][%d] filterV2PutInternalServerError", 500) +} + +func (o *FilterV2PutInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filters_client.go b/client/filters/filters_client.go new file mode 100644 index 0000000..a3db9bd --- /dev/null +++ b/client/filters/filters_client.go @@ -0,0 +1,877 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new filters API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new filters API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new filters API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for filters API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + FilterKeywordDelete(params *FilterKeywordDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordDeleteOK, error) + + FilterKeywordGet(params *FilterKeywordGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordGetOK, error) + + FilterKeywordPost(params *FilterKeywordPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPostOK, error) + + FilterKeywordPut(params *FilterKeywordPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPutOK, error) + + FilterKeywordsGet(params *FilterKeywordsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordsGetOK, error) + + FilterStatusDelete(params *FilterStatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusDeleteOK, error) + + FilterStatusGet(params *FilterStatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusGetOK, error) + + FilterStatusPost(params *FilterStatusPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusPostOK, error) + + FilterStatusesGet(params *FilterStatusesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusesGetOK, error) + + FilterV1Delete(params *FilterV1DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1DeleteOK, error) + + FilterV1Get(params *FilterV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1GetOK, error) + + FilterV1Post(params *FilterV1PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PostOK, error) + + FilterV1Put(params *FilterV1PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PutOK, error) + + FilterV2Delete(params *FilterV2DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2DeleteOK, error) + + FilterV2Get(params *FilterV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2GetOK, error) + + FilterV2Post(params *FilterV2PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PostOK, error) + + FilterV2Put(params *FilterV2PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PutOK, error) + + FiltersV1Get(params *FiltersV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV1GetOK, error) + + FiltersV2Get(params *FiltersV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV2GetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +FilterKeywordDelete deletes a single filter keyword with the given ID +*/ +func (a *Client) FilterKeywordDelete(params *FilterKeywordDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordDelete", + Method: "DELETE", + PathPattern: "/api/v2/filters/keywords/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterKeywordDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterKeywordDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordGet gets a single filter keyword with the given ID +*/ +func (a *Client) FilterKeywordGet(params *FilterKeywordGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordGet", + Method: "GET", + PathPattern: "/api/v2/filters/keywords/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterKeywordGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterKeywordGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordPost adds a filter keyword to an existing filter +*/ +func (a *Client) FilterKeywordPost(params *FilterKeywordPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordPostParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordPost", + Method: "POST", + PathPattern: "/api/v2/filters/{id}/keywords", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterKeywordPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterKeywordPost: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordPut updates a single filter keyword with the given ID +*/ +func (a *Client) FilterKeywordPut(params *FilterKeywordPutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordPutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordPutParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordPut", + Method: "PUT", + PathPattern: "/api/v2/filters/keywords{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordPutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterKeywordPutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterKeywordPut: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterKeywordsGet gets all filter keywords for a given filter +*/ +func (a *Client) FilterKeywordsGet(params *FilterKeywordsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterKeywordsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterKeywordsGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterKeywordsGet", + Method: "GET", + PathPattern: "/api/v2/filters/{id}/keywords", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterKeywordsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterKeywordsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterKeywordsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusDelete deletes a single filter status with the given ID +*/ +func (a *Client) FilterStatusDelete(params *FilterStatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusDelete", + Method: "DELETE", + PathPattern: "/api/v2/filters/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterStatusDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterStatusDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusGet gets a single filter status with the given ID +*/ +func (a *Client) FilterStatusGet(params *FilterStatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusGet", + Method: "GET", + PathPattern: "/api/v2/filters/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterStatusGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterStatusGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusPost adds a filter status to an existing filter +*/ +func (a *Client) FilterStatusPost(params *FilterStatusPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusPostParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusPost", + Method: "POST", + PathPattern: "/api/v2/filters/{id}/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterStatusPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterStatusPost: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterStatusesGet gets all filter statuses for a given filter +*/ +func (a *Client) FilterStatusesGet(params *FilterStatusesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterStatusesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterStatusesGetParams() + } + op := &runtime.ClientOperation{ + ID: "filterStatusesGet", + Method: "GET", + PathPattern: "/api/v2/filters/{id}/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterStatusesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterStatusesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterStatusesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Delete deletes a single filter with the given ID +*/ +func (a *Client) FilterV1Delete(params *FilterV1DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1DeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1DeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Delete", + Method: "DELETE", + PathPattern: "/api/v1/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1DeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV1DeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV1Delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Get gets a single filter with the given ID +*/ +func (a *Client) FilterV1Get(params *FilterV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1GetParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Get", + Method: "GET", + PathPattern: "/api/v1/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1GetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV1GetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV1Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Post creates a single filter +*/ +func (a *Client) FilterV1Post(params *FilterV1PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1PostParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Post", + Method: "POST", + PathPattern: "/api/v1/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1PostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV1PostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV1Post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV1Put updates a single filter with the given ID +*/ +func (a *Client) FilterV1Put(params *FilterV1PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV1PutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV1PutParams() + } + op := &runtime.ClientOperation{ + ID: "filterV1Put", + Method: "PUT", + PathPattern: "/api/v1/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV1PutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV1PutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV1Put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV2Delete deletes a single filter with the given ID +*/ +func (a *Client) FilterV2Delete(params *FilterV2DeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2DeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2DeleteParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Delete", + Method: "DELETE", + PathPattern: "/api/v2/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2DeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV2DeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV2Delete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV2Get gets a single filter with the given ID +*/ +func (a *Client) FilterV2Get(params *FilterV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2GetParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Get", + Method: "GET", + PathPattern: "/api/v2/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2GetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV2GetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV2Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FilterV2Post creates a single filter +*/ +func (a *Client) FilterV2Post(params *FilterV2PostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2PostParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Post", + Method: "POST", + PathPattern: "/api/v2/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2PostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV2PostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV2Post: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + FilterV2Put updates a single filter with the given ID + + Note that this is actually closer to a PATCH operation: + +only provided fields will be updated, and omitted fields will remain set to previous values. +*/ +func (a *Client) FilterV2Put(params *FilterV2PutParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FilterV2PutOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFilterV2PutParams() + } + op := &runtime.ClientOperation{ + ID: "filterV2Put", + Method: "PUT", + PathPattern: "/api/v2/filters/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FilterV2PutReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FilterV2PutOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filterV2Put: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FiltersV1Get gets all filters for the authenticated account +*/ +func (a *Client) FiltersV1Get(params *FiltersV1GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV1GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFiltersV1GetParams() + } + op := &runtime.ClientOperation{ + ID: "filtersV1Get", + Method: "GET", + PathPattern: "/api/v1/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FiltersV1GetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FiltersV1GetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filtersV1Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +FiltersV2Get gets all filters for the authenticated account +*/ +func (a *Client) FiltersV2Get(params *FiltersV2GetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*FiltersV2GetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewFiltersV2GetParams() + } + op := &runtime.ClientOperation{ + ID: "filtersV2Get", + Method: "GET", + PathPattern: "/api/v2/filters", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &FiltersV2GetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*FiltersV2GetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for filtersV2Get: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/filters/filters_v1_get_parameters.go b/client/filters/filters_v1_get_parameters.go new file mode 100644 index 0000000..389bdde --- /dev/null +++ b/client/filters/filters_v1_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFiltersV1GetParams creates a new FiltersV1GetParams 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 NewFiltersV1GetParams() *FiltersV1GetParams { + return &FiltersV1GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFiltersV1GetParamsWithTimeout creates a new FiltersV1GetParams object +// with the ability to set a timeout on a request. +func NewFiltersV1GetParamsWithTimeout(timeout time.Duration) *FiltersV1GetParams { + return &FiltersV1GetParams{ + timeout: timeout, + } +} + +// NewFiltersV1GetParamsWithContext creates a new FiltersV1GetParams object +// with the ability to set a context for a request. +func NewFiltersV1GetParamsWithContext(ctx context.Context) *FiltersV1GetParams { + return &FiltersV1GetParams{ + Context: ctx, + } +} + +// NewFiltersV1GetParamsWithHTTPClient creates a new FiltersV1GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFiltersV1GetParamsWithHTTPClient(client *http.Client) *FiltersV1GetParams { + return &FiltersV1GetParams{ + HTTPClient: client, + } +} + +/* +FiltersV1GetParams contains all the parameters to send to the API endpoint + + for the filters v1 get operation. + + Typically these are written to a http.Request. +*/ +type FiltersV1GetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filters v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV1GetParams) WithDefaults() *FiltersV1GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filters v1 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV1GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filters v1 get params +func (o *FiltersV1GetParams) WithTimeout(timeout time.Duration) *FiltersV1GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filters v1 get params +func (o *FiltersV1GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filters v1 get params +func (o *FiltersV1GetParams) WithContext(ctx context.Context) *FiltersV1GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filters v1 get params +func (o *FiltersV1GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filters v1 get params +func (o *FiltersV1GetParams) WithHTTPClient(client *http.Client) *FiltersV1GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filters v1 get params +func (o *FiltersV1GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *FiltersV1GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filters_v1_get_responses.go b/client/filters/filters_v1_get_responses.go new file mode 100644 index 0000000..b2b22a1 --- /dev/null +++ b/client/filters/filters_v1_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FiltersV1GetReader is a Reader for the FiltersV1Get structure. +type FiltersV1GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FiltersV1GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFiltersV1GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFiltersV1GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFiltersV1GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFiltersV1GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFiltersV1GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFiltersV1GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/filters] filtersV1Get", response, response.Code()) + } +} + +// NewFiltersV1GetOK creates a FiltersV1GetOK with default headers values +func NewFiltersV1GetOK() *FiltersV1GetOK { + return &FiltersV1GetOK{} +} + +/* +FiltersV1GetOK describes a response with status code 200, with default header values. + +Requested filters. +*/ +type FiltersV1GetOK struct { + Payload []*models.FilterV1 +} + +// IsSuccess returns true when this filters v1 get o k response has a 2xx status code +func (o *FiltersV1GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filters v1 get o k response has a 3xx status code +func (o *FiltersV1GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get o k response has a 4xx status code +func (o *FiltersV1GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v1 get o k response has a 5xx status code +func (o *FiltersV1GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get o k response a status code equal to that given +func (o *FiltersV1GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filters v1 get o k response +func (o *FiltersV1GetOK) Code() int { + return 200 +} + +func (o *FiltersV1GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetOK %s", 200, payload) +} + +func (o *FiltersV1GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetOK %s", 200, payload) +} + +func (o *FiltersV1GetOK) GetPayload() []*models.FilterV1 { + return o.Payload +} + +func (o *FiltersV1GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFiltersV1GetBadRequest creates a FiltersV1GetBadRequest with default headers values +func NewFiltersV1GetBadRequest() *FiltersV1GetBadRequest { + return &FiltersV1GetBadRequest{} +} + +/* +FiltersV1GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FiltersV1GetBadRequest struct { +} + +// IsSuccess returns true when this filters v1 get bad request response has a 2xx status code +func (o *FiltersV1GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get bad request response has a 3xx status code +func (o *FiltersV1GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get bad request response has a 4xx status code +func (o *FiltersV1GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get bad request response has a 5xx status code +func (o *FiltersV1GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get bad request response a status code equal to that given +func (o *FiltersV1GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filters v1 get bad request response +func (o *FiltersV1GetBadRequest) Code() int { + return 400 +} + +func (o *FiltersV1GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetBadRequest", 400) +} + +func (o *FiltersV1GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetBadRequest", 400) +} + +func (o *FiltersV1GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetUnauthorized creates a FiltersV1GetUnauthorized with default headers values +func NewFiltersV1GetUnauthorized() *FiltersV1GetUnauthorized { + return &FiltersV1GetUnauthorized{} +} + +/* +FiltersV1GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FiltersV1GetUnauthorized struct { +} + +// IsSuccess returns true when this filters v1 get unauthorized response has a 2xx status code +func (o *FiltersV1GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get unauthorized response has a 3xx status code +func (o *FiltersV1GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get unauthorized response has a 4xx status code +func (o *FiltersV1GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get unauthorized response has a 5xx status code +func (o *FiltersV1GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get unauthorized response a status code equal to that given +func (o *FiltersV1GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filters v1 get unauthorized response +func (o *FiltersV1GetUnauthorized) Code() int { + return 401 +} + +func (o *FiltersV1GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetUnauthorized", 401) +} + +func (o *FiltersV1GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetUnauthorized", 401) +} + +func (o *FiltersV1GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetNotFound creates a FiltersV1GetNotFound with default headers values +func NewFiltersV1GetNotFound() *FiltersV1GetNotFound { + return &FiltersV1GetNotFound{} +} + +/* +FiltersV1GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FiltersV1GetNotFound struct { +} + +// IsSuccess returns true when this filters v1 get not found response has a 2xx status code +func (o *FiltersV1GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get not found response has a 3xx status code +func (o *FiltersV1GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get not found response has a 4xx status code +func (o *FiltersV1GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get not found response has a 5xx status code +func (o *FiltersV1GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get not found response a status code equal to that given +func (o *FiltersV1GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filters v1 get not found response +func (o *FiltersV1GetNotFound) Code() int { + return 404 +} + +func (o *FiltersV1GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotFound", 404) +} + +func (o *FiltersV1GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotFound", 404) +} + +func (o *FiltersV1GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetNotAcceptable creates a FiltersV1GetNotAcceptable with default headers values +func NewFiltersV1GetNotAcceptable() *FiltersV1GetNotAcceptable { + return &FiltersV1GetNotAcceptable{} +} + +/* +FiltersV1GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FiltersV1GetNotAcceptable struct { +} + +// IsSuccess returns true when this filters v1 get not acceptable response has a 2xx status code +func (o *FiltersV1GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get not acceptable response has a 3xx status code +func (o *FiltersV1GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get not acceptable response has a 4xx status code +func (o *FiltersV1GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v1 get not acceptable response has a 5xx status code +func (o *FiltersV1GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v1 get not acceptable response a status code equal to that given +func (o *FiltersV1GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filters v1 get not acceptable response +func (o *FiltersV1GetNotAcceptable) Code() int { + return 406 +} + +func (o *FiltersV1GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotAcceptable", 406) +} + +func (o *FiltersV1GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetNotAcceptable", 406) +} + +func (o *FiltersV1GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV1GetInternalServerError creates a FiltersV1GetInternalServerError with default headers values +func NewFiltersV1GetInternalServerError() *FiltersV1GetInternalServerError { + return &FiltersV1GetInternalServerError{} +} + +/* +FiltersV1GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FiltersV1GetInternalServerError struct { +} + +// IsSuccess returns true when this filters v1 get internal server error response has a 2xx status code +func (o *FiltersV1GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v1 get internal server error response has a 3xx status code +func (o *FiltersV1GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v1 get internal server error response has a 4xx status code +func (o *FiltersV1GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v1 get internal server error response has a 5xx status code +func (o *FiltersV1GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filters v1 get internal server error response a status code equal to that given +func (o *FiltersV1GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filters v1 get internal server error response +func (o *FiltersV1GetInternalServerError) Code() int { + return 500 +} + +func (o *FiltersV1GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetInternalServerError", 500) +} + +func (o *FiltersV1GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/filters][%d] filtersV1GetInternalServerError", 500) +} + +func (o *FiltersV1GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/filters/filters_v2_get_parameters.go b/client/filters/filters_v2_get_parameters.go new file mode 100644 index 0000000..5b75aa1 --- /dev/null +++ b/client/filters/filters_v2_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// 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" +) + +// NewFiltersV2GetParams creates a new FiltersV2GetParams 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 NewFiltersV2GetParams() *FiltersV2GetParams { + return &FiltersV2GetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewFiltersV2GetParamsWithTimeout creates a new FiltersV2GetParams object +// with the ability to set a timeout on a request. +func NewFiltersV2GetParamsWithTimeout(timeout time.Duration) *FiltersV2GetParams { + return &FiltersV2GetParams{ + timeout: timeout, + } +} + +// NewFiltersV2GetParamsWithContext creates a new FiltersV2GetParams object +// with the ability to set a context for a request. +func NewFiltersV2GetParamsWithContext(ctx context.Context) *FiltersV2GetParams { + return &FiltersV2GetParams{ + Context: ctx, + } +} + +// NewFiltersV2GetParamsWithHTTPClient creates a new FiltersV2GetParams object +// with the ability to set a custom HTTPClient for a request. +func NewFiltersV2GetParamsWithHTTPClient(client *http.Client) *FiltersV2GetParams { + return &FiltersV2GetParams{ + HTTPClient: client, + } +} + +/* +FiltersV2GetParams contains all the parameters to send to the API endpoint + + for the filters v2 get operation. + + Typically these are written to a http.Request. +*/ +type FiltersV2GetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the filters v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV2GetParams) WithDefaults() *FiltersV2GetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the filters v2 get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *FiltersV2GetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the filters v2 get params +func (o *FiltersV2GetParams) WithTimeout(timeout time.Duration) *FiltersV2GetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the filters v2 get params +func (o *FiltersV2GetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the filters v2 get params +func (o *FiltersV2GetParams) WithContext(ctx context.Context) *FiltersV2GetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the filters v2 get params +func (o *FiltersV2GetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the filters v2 get params +func (o *FiltersV2GetParams) WithHTTPClient(client *http.Client) *FiltersV2GetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the filters v2 get params +func (o *FiltersV2GetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *FiltersV2GetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/filters/filters_v2_get_responses.go b/client/filters/filters_v2_get_responses.go new file mode 100644 index 0000000..430f199 --- /dev/null +++ b/client/filters/filters_v2_get_responses.go @@ -0,0 +1,414 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package filters + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// FiltersV2GetReader is a Reader for the FiltersV2Get structure. +type FiltersV2GetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *FiltersV2GetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewFiltersV2GetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewFiltersV2GetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewFiltersV2GetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewFiltersV2GetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewFiltersV2GetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewFiltersV2GetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/filters] filtersV2Get", response, response.Code()) + } +} + +// NewFiltersV2GetOK creates a FiltersV2GetOK with default headers values +func NewFiltersV2GetOK() *FiltersV2GetOK { + return &FiltersV2GetOK{} +} + +/* +FiltersV2GetOK describes a response with status code 200, with default header values. + +Requested filters. +*/ +type FiltersV2GetOK struct { + Payload []*models.FilterV2 +} + +// IsSuccess returns true when this filters v2 get o k response has a 2xx status code +func (o *FiltersV2GetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this filters v2 get o k response has a 3xx status code +func (o *FiltersV2GetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get o k response has a 4xx status code +func (o *FiltersV2GetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v2 get o k response has a 5xx status code +func (o *FiltersV2GetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get o k response a status code equal to that given +func (o *FiltersV2GetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the filters v2 get o k response +func (o *FiltersV2GetOK) Code() int { + return 200 +} + +func (o *FiltersV2GetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetOK %s", 200, payload) +} + +func (o *FiltersV2GetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetOK %s", 200, payload) +} + +func (o *FiltersV2GetOK) GetPayload() []*models.FilterV2 { + return o.Payload +} + +func (o *FiltersV2GetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewFiltersV2GetBadRequest creates a FiltersV2GetBadRequest with default headers values +func NewFiltersV2GetBadRequest() *FiltersV2GetBadRequest { + return &FiltersV2GetBadRequest{} +} + +/* +FiltersV2GetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type FiltersV2GetBadRequest struct { +} + +// IsSuccess returns true when this filters v2 get bad request response has a 2xx status code +func (o *FiltersV2GetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get bad request response has a 3xx status code +func (o *FiltersV2GetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get bad request response has a 4xx status code +func (o *FiltersV2GetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get bad request response has a 5xx status code +func (o *FiltersV2GetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get bad request response a status code equal to that given +func (o *FiltersV2GetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the filters v2 get bad request response +func (o *FiltersV2GetBadRequest) Code() int { + return 400 +} + +func (o *FiltersV2GetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetBadRequest", 400) +} + +func (o *FiltersV2GetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetBadRequest", 400) +} + +func (o *FiltersV2GetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetUnauthorized creates a FiltersV2GetUnauthorized with default headers values +func NewFiltersV2GetUnauthorized() *FiltersV2GetUnauthorized { + return &FiltersV2GetUnauthorized{} +} + +/* +FiltersV2GetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type FiltersV2GetUnauthorized struct { +} + +// IsSuccess returns true when this filters v2 get unauthorized response has a 2xx status code +func (o *FiltersV2GetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get unauthorized response has a 3xx status code +func (o *FiltersV2GetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get unauthorized response has a 4xx status code +func (o *FiltersV2GetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get unauthorized response has a 5xx status code +func (o *FiltersV2GetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get unauthorized response a status code equal to that given +func (o *FiltersV2GetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the filters v2 get unauthorized response +func (o *FiltersV2GetUnauthorized) Code() int { + return 401 +} + +func (o *FiltersV2GetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetUnauthorized", 401) +} + +func (o *FiltersV2GetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetUnauthorized", 401) +} + +func (o *FiltersV2GetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetNotFound creates a FiltersV2GetNotFound with default headers values +func NewFiltersV2GetNotFound() *FiltersV2GetNotFound { + return &FiltersV2GetNotFound{} +} + +/* +FiltersV2GetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type FiltersV2GetNotFound struct { +} + +// IsSuccess returns true when this filters v2 get not found response has a 2xx status code +func (o *FiltersV2GetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get not found response has a 3xx status code +func (o *FiltersV2GetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get not found response has a 4xx status code +func (o *FiltersV2GetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get not found response has a 5xx status code +func (o *FiltersV2GetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get not found response a status code equal to that given +func (o *FiltersV2GetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the filters v2 get not found response +func (o *FiltersV2GetNotFound) Code() int { + return 404 +} + +func (o *FiltersV2GetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotFound", 404) +} + +func (o *FiltersV2GetNotFound) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotFound", 404) +} + +func (o *FiltersV2GetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetNotAcceptable creates a FiltersV2GetNotAcceptable with default headers values +func NewFiltersV2GetNotAcceptable() *FiltersV2GetNotAcceptable { + return &FiltersV2GetNotAcceptable{} +} + +/* +FiltersV2GetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type FiltersV2GetNotAcceptable struct { +} + +// IsSuccess returns true when this filters v2 get not acceptable response has a 2xx status code +func (o *FiltersV2GetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get not acceptable response has a 3xx status code +func (o *FiltersV2GetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get not acceptable response has a 4xx status code +func (o *FiltersV2GetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this filters v2 get not acceptable response has a 5xx status code +func (o *FiltersV2GetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this filters v2 get not acceptable response a status code equal to that given +func (o *FiltersV2GetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the filters v2 get not acceptable response +func (o *FiltersV2GetNotAcceptable) Code() int { + return 406 +} + +func (o *FiltersV2GetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotAcceptable", 406) +} + +func (o *FiltersV2GetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetNotAcceptable", 406) +} + +func (o *FiltersV2GetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewFiltersV2GetInternalServerError creates a FiltersV2GetInternalServerError with default headers values +func NewFiltersV2GetInternalServerError() *FiltersV2GetInternalServerError { + return &FiltersV2GetInternalServerError{} +} + +/* +FiltersV2GetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type FiltersV2GetInternalServerError struct { +} + +// IsSuccess returns true when this filters v2 get internal server error response has a 2xx status code +func (o *FiltersV2GetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this filters v2 get internal server error response has a 3xx status code +func (o *FiltersV2GetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this filters v2 get internal server error response has a 4xx status code +func (o *FiltersV2GetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this filters v2 get internal server error response has a 5xx status code +func (o *FiltersV2GetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this filters v2 get internal server error response a status code equal to that given +func (o *FiltersV2GetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the filters v2 get internal server error response +func (o *FiltersV2GetInternalServerError) Code() int { + return 500 +} + +func (o *FiltersV2GetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetInternalServerError", 500) +} + +func (o *FiltersV2GetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/filters][%d] filtersV2GetInternalServerError", 500) +} + +func (o *FiltersV2GetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/follow_requests/authorize_follow_request_parameters.go b/client/follow_requests/authorize_follow_request_parameters.go new file mode 100644 index 0000000..905d870 --- /dev/null +++ b/client/follow_requests/authorize_follow_request_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" +) + +// NewAuthorizeFollowRequestParams creates a new AuthorizeFollowRequestParams 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 NewAuthorizeFollowRequestParams() *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAuthorizeFollowRequestParamsWithTimeout creates a new AuthorizeFollowRequestParams object +// with the ability to set a timeout on a request. +func NewAuthorizeFollowRequestParamsWithTimeout(timeout time.Duration) *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + timeout: timeout, + } +} + +// NewAuthorizeFollowRequestParamsWithContext creates a new AuthorizeFollowRequestParams object +// with the ability to set a context for a request. +func NewAuthorizeFollowRequestParamsWithContext(ctx context.Context) *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + Context: ctx, + } +} + +// NewAuthorizeFollowRequestParamsWithHTTPClient creates a new AuthorizeFollowRequestParams object +// with the ability to set a custom HTTPClient for a request. +func NewAuthorizeFollowRequestParamsWithHTTPClient(client *http.Client) *AuthorizeFollowRequestParams { + return &AuthorizeFollowRequestParams{ + HTTPClient: client, + } +} + +/* +AuthorizeFollowRequestParams contains all the parameters to send to the API endpoint + + for the authorize follow request operation. + + Typically these are written to a http.Request. +*/ +type AuthorizeFollowRequestParams struct { + + /* AccountID. + + ID of the account requesting to follow you. + */ + AccountID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the authorize follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthorizeFollowRequestParams) WithDefaults() *AuthorizeFollowRequestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the authorize follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AuthorizeFollowRequestParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithTimeout(timeout time.Duration) *AuthorizeFollowRequestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithContext(ctx context.Context) *AuthorizeFollowRequestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithHTTPClient(client *http.Client) *AuthorizeFollowRequestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the authorize follow request params +func (o *AuthorizeFollowRequestParams) WithAccountID(accountID string) *AuthorizeFollowRequestParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the authorize follow request params +func (o *AuthorizeFollowRequestParams) SetAccountID(accountID string) { + o.AccountID = accountID +} + +// WriteToRequest writes these params to a swagger request +func (o *AuthorizeFollowRequestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param account_id + if err := r.SetPathParam("account_id", o.AccountID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/follow_requests/authorize_follow_request_responses.go b/client/follow_requests/authorize_follow_request_responses.go new file mode 100644 index 0000000..9122c3a --- /dev/null +++ b/client/follow_requests/authorize_follow_request_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// AuthorizeFollowRequestReader is a Reader for the AuthorizeFollowRequest structure. +type AuthorizeFollowRequestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AuthorizeFollowRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAuthorizeFollowRequestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAuthorizeFollowRequestBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAuthorizeFollowRequestUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAuthorizeFollowRequestNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAuthorizeFollowRequestNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAuthorizeFollowRequestInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/follow_requests/{account_id}/authorize] authorizeFollowRequest", response, response.Code()) + } +} + +// NewAuthorizeFollowRequestOK creates a AuthorizeFollowRequestOK with default headers values +func NewAuthorizeFollowRequestOK() *AuthorizeFollowRequestOK { + return &AuthorizeFollowRequestOK{} +} + +/* +AuthorizeFollowRequestOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type AuthorizeFollowRequestOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this authorize follow request o k response has a 2xx status code +func (o *AuthorizeFollowRequestOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this authorize follow request o k response has a 3xx status code +func (o *AuthorizeFollowRequestOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request o k response has a 4xx status code +func (o *AuthorizeFollowRequestOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this authorize follow request o k response has a 5xx status code +func (o *AuthorizeFollowRequestOK) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request o k response a status code equal to that given +func (o *AuthorizeFollowRequestOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the authorize follow request o k response +func (o *AuthorizeFollowRequestOK) Code() int { + return 200 +} + +func (o *AuthorizeFollowRequestOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestOK %s", 200, payload) +} + +func (o *AuthorizeFollowRequestOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestOK %s", 200, payload) +} + +func (o *AuthorizeFollowRequestOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *AuthorizeFollowRequestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewAuthorizeFollowRequestBadRequest creates a AuthorizeFollowRequestBadRequest with default headers values +func NewAuthorizeFollowRequestBadRequest() *AuthorizeFollowRequestBadRequest { + return &AuthorizeFollowRequestBadRequest{} +} + +/* +AuthorizeFollowRequestBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AuthorizeFollowRequestBadRequest struct { +} + +// IsSuccess returns true when this authorize follow request bad request response has a 2xx status code +func (o *AuthorizeFollowRequestBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request bad request response has a 3xx status code +func (o *AuthorizeFollowRequestBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request bad request response has a 4xx status code +func (o *AuthorizeFollowRequestBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request bad request response has a 5xx status code +func (o *AuthorizeFollowRequestBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request bad request response a status code equal to that given +func (o *AuthorizeFollowRequestBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the authorize follow request bad request response +func (o *AuthorizeFollowRequestBadRequest) Code() int { + return 400 +} + +func (o *AuthorizeFollowRequestBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestBadRequest", 400) +} + +func (o *AuthorizeFollowRequestBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestBadRequest", 400) +} + +func (o *AuthorizeFollowRequestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestUnauthorized creates a AuthorizeFollowRequestUnauthorized with default headers values +func NewAuthorizeFollowRequestUnauthorized() *AuthorizeFollowRequestUnauthorized { + return &AuthorizeFollowRequestUnauthorized{} +} + +/* +AuthorizeFollowRequestUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AuthorizeFollowRequestUnauthorized struct { +} + +// IsSuccess returns true when this authorize follow request unauthorized response has a 2xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request unauthorized response has a 3xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request unauthorized response has a 4xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request unauthorized response has a 5xx status code +func (o *AuthorizeFollowRequestUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request unauthorized response a status code equal to that given +func (o *AuthorizeFollowRequestUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the authorize follow request unauthorized response +func (o *AuthorizeFollowRequestUnauthorized) Code() int { + return 401 +} + +func (o *AuthorizeFollowRequestUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestUnauthorized", 401) +} + +func (o *AuthorizeFollowRequestUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestUnauthorized", 401) +} + +func (o *AuthorizeFollowRequestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestNotFound creates a AuthorizeFollowRequestNotFound with default headers values +func NewAuthorizeFollowRequestNotFound() *AuthorizeFollowRequestNotFound { + return &AuthorizeFollowRequestNotFound{} +} + +/* +AuthorizeFollowRequestNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AuthorizeFollowRequestNotFound struct { +} + +// IsSuccess returns true when this authorize follow request not found response has a 2xx status code +func (o *AuthorizeFollowRequestNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request not found response has a 3xx status code +func (o *AuthorizeFollowRequestNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request not found response has a 4xx status code +func (o *AuthorizeFollowRequestNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request not found response has a 5xx status code +func (o *AuthorizeFollowRequestNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request not found response a status code equal to that given +func (o *AuthorizeFollowRequestNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the authorize follow request not found response +func (o *AuthorizeFollowRequestNotFound) Code() int { + return 404 +} + +func (o *AuthorizeFollowRequestNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotFound", 404) +} + +func (o *AuthorizeFollowRequestNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotFound", 404) +} + +func (o *AuthorizeFollowRequestNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestNotAcceptable creates a AuthorizeFollowRequestNotAcceptable with default headers values +func NewAuthorizeFollowRequestNotAcceptable() *AuthorizeFollowRequestNotAcceptable { + return &AuthorizeFollowRequestNotAcceptable{} +} + +/* +AuthorizeFollowRequestNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AuthorizeFollowRequestNotAcceptable struct { +} + +// IsSuccess returns true when this authorize follow request not acceptable response has a 2xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request not acceptable response has a 3xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request not acceptable response has a 4xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this authorize follow request not acceptable response has a 5xx status code +func (o *AuthorizeFollowRequestNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this authorize follow request not acceptable response a status code equal to that given +func (o *AuthorizeFollowRequestNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the authorize follow request not acceptable response +func (o *AuthorizeFollowRequestNotAcceptable) Code() int { + return 406 +} + +func (o *AuthorizeFollowRequestNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotAcceptable", 406) +} + +func (o *AuthorizeFollowRequestNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestNotAcceptable", 406) +} + +func (o *AuthorizeFollowRequestNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAuthorizeFollowRequestInternalServerError creates a AuthorizeFollowRequestInternalServerError with default headers values +func NewAuthorizeFollowRequestInternalServerError() *AuthorizeFollowRequestInternalServerError { + return &AuthorizeFollowRequestInternalServerError{} +} + +/* +AuthorizeFollowRequestInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AuthorizeFollowRequestInternalServerError struct { +} + +// IsSuccess returns true when this authorize follow request internal server error response has a 2xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this authorize follow request internal server error response has a 3xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this authorize follow request internal server error response has a 4xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this authorize follow request internal server error response has a 5xx status code +func (o *AuthorizeFollowRequestInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this authorize follow request internal server error response a status code equal to that given +func (o *AuthorizeFollowRequestInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the authorize follow request internal server error response +func (o *AuthorizeFollowRequestInternalServerError) Code() int { + return 500 +} + +func (o *AuthorizeFollowRequestInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestInternalServerError", 500) +} + +func (o *AuthorizeFollowRequestInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/authorize][%d] authorizeFollowRequestInternalServerError", 500) +} + +func (o *AuthorizeFollowRequestInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/follow_requests/follow_requests_client.go b/client/follow_requests/follow_requests_client.go new file mode 100644 index 0000000..dd53904 --- /dev/null +++ b/client/follow_requests/follow_requests_client.go @@ -0,0 +1,198 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new follow requests API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new follow requests API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new follow requests API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for follow requests API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + AuthorizeFollowRequest(params *AuthorizeFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthorizeFollowRequestOK, error) + + GetFollowRequests(params *GetFollowRequestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFollowRequestsOK, error) + + RejectFollowRequest(params *RejectFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RejectFollowRequestOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +AuthorizeFollowRequest accepts authorize follow request from the given account ID + +Accept a follow request and put the requesting account in your 'followers' list. +*/ +func (a *Client) AuthorizeFollowRequest(params *AuthorizeFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AuthorizeFollowRequestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAuthorizeFollowRequestParams() + } + op := &runtime.ClientOperation{ + ID: "authorizeFollowRequest", + Method: "POST", + PathPattern: "/api/v1/follow_requests/{account_id}/authorize", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AuthorizeFollowRequestReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AuthorizeFollowRequestOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for authorizeFollowRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + GetFollowRequests gets an array of accounts that have requested to follow you + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) GetFollowRequests(params *GetFollowRequestsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetFollowRequestsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetFollowRequestsParams() + } + op := &runtime.ClientOperation{ + ID: "getFollowRequests", + Method: "GET", + PathPattern: "/api/v1/follow_requests", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetFollowRequestsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetFollowRequestsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for getFollowRequests: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RejectFollowRequest rejects deny follow request from the given account ID +*/ +func (a *Client) RejectFollowRequest(params *RejectFollowRequestParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RejectFollowRequestOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRejectFollowRequestParams() + } + op := &runtime.ClientOperation{ + ID: "rejectFollowRequest", + Method: "POST", + PathPattern: "/api/v1/follow_requests/{account_id}/reject", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RejectFollowRequestReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*RejectFollowRequestOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for rejectFollowRequest: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/follow_requests/get_follow_requests_parameters.go b/client/follow_requests/get_follow_requests_parameters.go new file mode 100644 index 0000000..7f23814 --- /dev/null +++ b/client/follow_requests/get_follow_requests_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" +) + +// NewGetFollowRequestsParams creates a new GetFollowRequestsParams 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 NewGetFollowRequestsParams() *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetFollowRequestsParamsWithTimeout creates a new GetFollowRequestsParams object +// with the ability to set a timeout on a request. +func NewGetFollowRequestsParamsWithTimeout(timeout time.Duration) *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + timeout: timeout, + } +} + +// NewGetFollowRequestsParamsWithContext creates a new GetFollowRequestsParams object +// with the ability to set a context for a request. +func NewGetFollowRequestsParamsWithContext(ctx context.Context) *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + Context: ctx, + } +} + +// NewGetFollowRequestsParamsWithHTTPClient creates a new GetFollowRequestsParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetFollowRequestsParamsWithHTTPClient(client *http.Client) *GetFollowRequestsParams { + return &GetFollowRequestsParams{ + HTTPClient: client, + } +} + +/* +GetFollowRequestsParams contains all the parameters to send to the API endpoint + + for the get follow requests operation. + + Typically these are written to a http.Request. +*/ +type GetFollowRequestsParams struct { + + /* Limit. + + Number of follow requesting accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only follow requesting accounts *OLDER* than the given max ID. The follow requester with the specified ID will not be included in the response. NOTE: the ID is of the internal follow request, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only follow requesting accounts *IMMEDIATELY NEWER* than the given min ID. The follow requester with the specified ID will not be included in the response. NOTE: the ID is of the internal follow request, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only follow requesting accounts *NEWER* than the given since ID. The follow requester with the specified ID will not be included in the response. NOTE: the ID is of the internal follow request, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get follow requests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFollowRequestsParams) WithDefaults() *GetFollowRequestsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get follow requests params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetFollowRequestsParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := GetFollowRequestsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the get follow requests params +func (o *GetFollowRequestsParams) WithTimeout(timeout time.Duration) *GetFollowRequestsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get follow requests params +func (o *GetFollowRequestsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get follow requests params +func (o *GetFollowRequestsParams) WithContext(ctx context.Context) *GetFollowRequestsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get follow requests params +func (o *GetFollowRequestsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get follow requests params +func (o *GetFollowRequestsParams) WithHTTPClient(client *http.Client) *GetFollowRequestsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get follow requests params +func (o *GetFollowRequestsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the get follow requests params +func (o *GetFollowRequestsParams) WithLimit(limit *int64) *GetFollowRequestsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the get follow requests params +func (o *GetFollowRequestsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the get follow requests params +func (o *GetFollowRequestsParams) WithMaxID(maxID *string) *GetFollowRequestsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the get follow requests params +func (o *GetFollowRequestsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the get follow requests params +func (o *GetFollowRequestsParams) WithMinID(minID *string) *GetFollowRequestsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the get follow requests params +func (o *GetFollowRequestsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the get follow requests params +func (o *GetFollowRequestsParams) WithSinceID(sinceID *string) *GetFollowRequestsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the get follow requests params +func (o *GetFollowRequestsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *GetFollowRequestsParams) 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.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 +} diff --git a/client/follow_requests/get_follow_requests_responses.go b/client/follow_requests/get_follow_requests_responses.go new file mode 100644 index 0000000..69a2c5d --- /dev/null +++ b/client/follow_requests/get_follow_requests_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// GetFollowRequestsReader is a Reader for the GetFollowRequests structure. +type GetFollowRequestsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetFollowRequestsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetFollowRequestsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetFollowRequestsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetFollowRequestsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewGetFollowRequestsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewGetFollowRequestsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewGetFollowRequestsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/follow_requests] getFollowRequests", response, response.Code()) + } +} + +// NewGetFollowRequestsOK creates a GetFollowRequestsOK with default headers values +func NewGetFollowRequestsOK() *GetFollowRequestsOK { + return &GetFollowRequestsOK{} +} + +/* +GetFollowRequestsOK describes a response with status code 200, with default header values. + +GetFollowRequestsOK get follow requests o k +*/ +type GetFollowRequestsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this get follow requests o k response has a 2xx status code +func (o *GetFollowRequestsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get follow requests o k response has a 3xx status code +func (o *GetFollowRequestsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests o k response has a 4xx status code +func (o *GetFollowRequestsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get follow requests o k response has a 5xx status code +func (o *GetFollowRequestsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests o k response a status code equal to that given +func (o *GetFollowRequestsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get follow requests o k response +func (o *GetFollowRequestsOK) Code() int { + return 200 +} + +func (o *GetFollowRequestsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsOK %s", 200, payload) +} + +func (o *GetFollowRequestsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsOK %s", 200, payload) +} + +func (o *GetFollowRequestsOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *GetFollowRequestsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetFollowRequestsBadRequest creates a GetFollowRequestsBadRequest with default headers values +func NewGetFollowRequestsBadRequest() *GetFollowRequestsBadRequest { + return &GetFollowRequestsBadRequest{} +} + +/* +GetFollowRequestsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type GetFollowRequestsBadRequest struct { +} + +// IsSuccess returns true when this get follow requests bad request response has a 2xx status code +func (o *GetFollowRequestsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests bad request response has a 3xx status code +func (o *GetFollowRequestsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests bad request response has a 4xx status code +func (o *GetFollowRequestsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests bad request response has a 5xx status code +func (o *GetFollowRequestsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests bad request response a status code equal to that given +func (o *GetFollowRequestsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get follow requests bad request response +func (o *GetFollowRequestsBadRequest) Code() int { + return 400 +} + +func (o *GetFollowRequestsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsBadRequest", 400) +} + +func (o *GetFollowRequestsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsBadRequest", 400) +} + +func (o *GetFollowRequestsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsUnauthorized creates a GetFollowRequestsUnauthorized with default headers values +func NewGetFollowRequestsUnauthorized() *GetFollowRequestsUnauthorized { + return &GetFollowRequestsUnauthorized{} +} + +/* +GetFollowRequestsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type GetFollowRequestsUnauthorized struct { +} + +// IsSuccess returns true when this get follow requests unauthorized response has a 2xx status code +func (o *GetFollowRequestsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests unauthorized response has a 3xx status code +func (o *GetFollowRequestsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests unauthorized response has a 4xx status code +func (o *GetFollowRequestsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests unauthorized response has a 5xx status code +func (o *GetFollowRequestsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests unauthorized response a status code equal to that given +func (o *GetFollowRequestsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get follow requests unauthorized response +func (o *GetFollowRequestsUnauthorized) Code() int { + return 401 +} + +func (o *GetFollowRequestsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsUnauthorized", 401) +} + +func (o *GetFollowRequestsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsUnauthorized", 401) +} + +func (o *GetFollowRequestsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsNotFound creates a GetFollowRequestsNotFound with default headers values +func NewGetFollowRequestsNotFound() *GetFollowRequestsNotFound { + return &GetFollowRequestsNotFound{} +} + +/* +GetFollowRequestsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type GetFollowRequestsNotFound struct { +} + +// IsSuccess returns true when this get follow requests not found response has a 2xx status code +func (o *GetFollowRequestsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests not found response has a 3xx status code +func (o *GetFollowRequestsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests not found response has a 4xx status code +func (o *GetFollowRequestsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests not found response has a 5xx status code +func (o *GetFollowRequestsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests not found response a status code equal to that given +func (o *GetFollowRequestsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the get follow requests not found response +func (o *GetFollowRequestsNotFound) Code() int { + return 404 +} + +func (o *GetFollowRequestsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotFound", 404) +} + +func (o *GetFollowRequestsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotFound", 404) +} + +func (o *GetFollowRequestsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsNotAcceptable creates a GetFollowRequestsNotAcceptable with default headers values +func NewGetFollowRequestsNotAcceptable() *GetFollowRequestsNotAcceptable { + return &GetFollowRequestsNotAcceptable{} +} + +/* +GetFollowRequestsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type GetFollowRequestsNotAcceptable struct { +} + +// IsSuccess returns true when this get follow requests not acceptable response has a 2xx status code +func (o *GetFollowRequestsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests not acceptable response has a 3xx status code +func (o *GetFollowRequestsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests not acceptable response has a 4xx status code +func (o *GetFollowRequestsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this get follow requests not acceptable response has a 5xx status code +func (o *GetFollowRequestsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this get follow requests not acceptable response a status code equal to that given +func (o *GetFollowRequestsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the get follow requests not acceptable response +func (o *GetFollowRequestsNotAcceptable) Code() int { + return 406 +} + +func (o *GetFollowRequestsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotAcceptable", 406) +} + +func (o *GetFollowRequestsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsNotAcceptable", 406) +} + +func (o *GetFollowRequestsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetFollowRequestsInternalServerError creates a GetFollowRequestsInternalServerError with default headers values +func NewGetFollowRequestsInternalServerError() *GetFollowRequestsInternalServerError { + return &GetFollowRequestsInternalServerError{} +} + +/* +GetFollowRequestsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type GetFollowRequestsInternalServerError struct { +} + +// IsSuccess returns true when this get follow requests internal server error response has a 2xx status code +func (o *GetFollowRequestsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get follow requests internal server error response has a 3xx status code +func (o *GetFollowRequestsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get follow requests internal server error response has a 4xx status code +func (o *GetFollowRequestsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this get follow requests internal server error response has a 5xx status code +func (o *GetFollowRequestsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this get follow requests internal server error response a status code equal to that given +func (o *GetFollowRequestsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the get follow requests internal server error response +func (o *GetFollowRequestsInternalServerError) Code() int { + return 500 +} + +func (o *GetFollowRequestsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsInternalServerError", 500) +} + +func (o *GetFollowRequestsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/follow_requests][%d] getFollowRequestsInternalServerError", 500) +} + +func (o *GetFollowRequestsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/follow_requests/reject_follow_request_parameters.go b/client/follow_requests/reject_follow_request_parameters.go new file mode 100644 index 0000000..810f337 --- /dev/null +++ b/client/follow_requests/reject_follow_request_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// 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" +) + +// NewRejectFollowRequestParams creates a new RejectFollowRequestParams 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 NewRejectFollowRequestParams() *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRejectFollowRequestParamsWithTimeout creates a new RejectFollowRequestParams object +// with the ability to set a timeout on a request. +func NewRejectFollowRequestParamsWithTimeout(timeout time.Duration) *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + timeout: timeout, + } +} + +// NewRejectFollowRequestParamsWithContext creates a new RejectFollowRequestParams object +// with the ability to set a context for a request. +func NewRejectFollowRequestParamsWithContext(ctx context.Context) *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + Context: ctx, + } +} + +// NewRejectFollowRequestParamsWithHTTPClient creates a new RejectFollowRequestParams object +// with the ability to set a custom HTTPClient for a request. +func NewRejectFollowRequestParamsWithHTTPClient(client *http.Client) *RejectFollowRequestParams { + return &RejectFollowRequestParams{ + HTTPClient: client, + } +} + +/* +RejectFollowRequestParams contains all the parameters to send to the API endpoint + + for the reject follow request operation. + + Typically these are written to a http.Request. +*/ +type RejectFollowRequestParams struct { + + /* AccountID. + + ID of the account requesting to follow you. + */ + AccountID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the reject follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RejectFollowRequestParams) WithDefaults() *RejectFollowRequestParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the reject follow request params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RejectFollowRequestParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the reject follow request params +func (o *RejectFollowRequestParams) WithTimeout(timeout time.Duration) *RejectFollowRequestParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the reject follow request params +func (o *RejectFollowRequestParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the reject follow request params +func (o *RejectFollowRequestParams) WithContext(ctx context.Context) *RejectFollowRequestParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the reject follow request params +func (o *RejectFollowRequestParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the reject follow request params +func (o *RejectFollowRequestParams) WithHTTPClient(client *http.Client) *RejectFollowRequestParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the reject follow request params +func (o *RejectFollowRequestParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the reject follow request params +func (o *RejectFollowRequestParams) WithAccountID(accountID string) *RejectFollowRequestParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the reject follow request params +func (o *RejectFollowRequestParams) SetAccountID(accountID string) { + o.AccountID = accountID +} + +// WriteToRequest writes these params to a swagger request +func (o *RejectFollowRequestParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param account_id + if err := r.SetPathParam("account_id", o.AccountID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/follow_requests/reject_follow_request_responses.go b/client/follow_requests/reject_follow_request_responses.go new file mode 100644 index 0000000..16a702f --- /dev/null +++ b/client/follow_requests/reject_follow_request_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package follow_requests + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RejectFollowRequestReader is a Reader for the RejectFollowRequest structure. +type RejectFollowRequestReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RejectFollowRequestReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRejectFollowRequestOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRejectFollowRequestBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRejectFollowRequestUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRejectFollowRequestNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRejectFollowRequestNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRejectFollowRequestInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/follow_requests/{account_id}/reject] rejectFollowRequest", response, response.Code()) + } +} + +// NewRejectFollowRequestOK creates a RejectFollowRequestOK with default headers values +func NewRejectFollowRequestOK() *RejectFollowRequestOK { + return &RejectFollowRequestOK{} +} + +/* +RejectFollowRequestOK describes a response with status code 200, with default header values. + +Your relationship to this account. +*/ +type RejectFollowRequestOK struct { + Payload *models.Relationship +} + +// IsSuccess returns true when this reject follow request o k response has a 2xx status code +func (o *RejectFollowRequestOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this reject follow request o k response has a 3xx status code +func (o *RejectFollowRequestOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request o k response has a 4xx status code +func (o *RejectFollowRequestOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this reject follow request o k response has a 5xx status code +func (o *RejectFollowRequestOK) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request o k response a status code equal to that given +func (o *RejectFollowRequestOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the reject follow request o k response +func (o *RejectFollowRequestOK) Code() int { + return 200 +} + +func (o *RejectFollowRequestOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestOK %s", 200, payload) +} + +func (o *RejectFollowRequestOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestOK %s", 200, payload) +} + +func (o *RejectFollowRequestOK) GetPayload() *models.Relationship { + return o.Payload +} + +func (o *RejectFollowRequestOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Relationship) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRejectFollowRequestBadRequest creates a RejectFollowRequestBadRequest with default headers values +func NewRejectFollowRequestBadRequest() *RejectFollowRequestBadRequest { + return &RejectFollowRequestBadRequest{} +} + +/* +RejectFollowRequestBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RejectFollowRequestBadRequest struct { +} + +// IsSuccess returns true when this reject follow request bad request response has a 2xx status code +func (o *RejectFollowRequestBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request bad request response has a 3xx status code +func (o *RejectFollowRequestBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request bad request response has a 4xx status code +func (o *RejectFollowRequestBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request bad request response has a 5xx status code +func (o *RejectFollowRequestBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request bad request response a status code equal to that given +func (o *RejectFollowRequestBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the reject follow request bad request response +func (o *RejectFollowRequestBadRequest) Code() int { + return 400 +} + +func (o *RejectFollowRequestBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestBadRequest", 400) +} + +func (o *RejectFollowRequestBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestBadRequest", 400) +} + +func (o *RejectFollowRequestBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestUnauthorized creates a RejectFollowRequestUnauthorized with default headers values +func NewRejectFollowRequestUnauthorized() *RejectFollowRequestUnauthorized { + return &RejectFollowRequestUnauthorized{} +} + +/* +RejectFollowRequestUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RejectFollowRequestUnauthorized struct { +} + +// IsSuccess returns true when this reject follow request unauthorized response has a 2xx status code +func (o *RejectFollowRequestUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request unauthorized response has a 3xx status code +func (o *RejectFollowRequestUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request unauthorized response has a 4xx status code +func (o *RejectFollowRequestUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request unauthorized response has a 5xx status code +func (o *RejectFollowRequestUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request unauthorized response a status code equal to that given +func (o *RejectFollowRequestUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the reject follow request unauthorized response +func (o *RejectFollowRequestUnauthorized) Code() int { + return 401 +} + +func (o *RejectFollowRequestUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestUnauthorized", 401) +} + +func (o *RejectFollowRequestUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestUnauthorized", 401) +} + +func (o *RejectFollowRequestUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestNotFound creates a RejectFollowRequestNotFound with default headers values +func NewRejectFollowRequestNotFound() *RejectFollowRequestNotFound { + return &RejectFollowRequestNotFound{} +} + +/* +RejectFollowRequestNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RejectFollowRequestNotFound struct { +} + +// IsSuccess returns true when this reject follow request not found response has a 2xx status code +func (o *RejectFollowRequestNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request not found response has a 3xx status code +func (o *RejectFollowRequestNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request not found response has a 4xx status code +func (o *RejectFollowRequestNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request not found response has a 5xx status code +func (o *RejectFollowRequestNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request not found response a status code equal to that given +func (o *RejectFollowRequestNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the reject follow request not found response +func (o *RejectFollowRequestNotFound) Code() int { + return 404 +} + +func (o *RejectFollowRequestNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotFound", 404) +} + +func (o *RejectFollowRequestNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotFound", 404) +} + +func (o *RejectFollowRequestNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestNotAcceptable creates a RejectFollowRequestNotAcceptable with default headers values +func NewRejectFollowRequestNotAcceptable() *RejectFollowRequestNotAcceptable { + return &RejectFollowRequestNotAcceptable{} +} + +/* +RejectFollowRequestNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RejectFollowRequestNotAcceptable struct { +} + +// IsSuccess returns true when this reject follow request not acceptable response has a 2xx status code +func (o *RejectFollowRequestNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request not acceptable response has a 3xx status code +func (o *RejectFollowRequestNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request not acceptable response has a 4xx status code +func (o *RejectFollowRequestNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this reject follow request not acceptable response has a 5xx status code +func (o *RejectFollowRequestNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this reject follow request not acceptable response a status code equal to that given +func (o *RejectFollowRequestNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the reject follow request not acceptable response +func (o *RejectFollowRequestNotAcceptable) Code() int { + return 406 +} + +func (o *RejectFollowRequestNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotAcceptable", 406) +} + +func (o *RejectFollowRequestNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestNotAcceptable", 406) +} + +func (o *RejectFollowRequestNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRejectFollowRequestInternalServerError creates a RejectFollowRequestInternalServerError with default headers values +func NewRejectFollowRequestInternalServerError() *RejectFollowRequestInternalServerError { + return &RejectFollowRequestInternalServerError{} +} + +/* +RejectFollowRequestInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RejectFollowRequestInternalServerError struct { +} + +// IsSuccess returns true when this reject follow request internal server error response has a 2xx status code +func (o *RejectFollowRequestInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reject follow request internal server error response has a 3xx status code +func (o *RejectFollowRequestInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reject follow request internal server error response has a 4xx status code +func (o *RejectFollowRequestInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this reject follow request internal server error response has a 5xx status code +func (o *RejectFollowRequestInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this reject follow request internal server error response a status code equal to that given +func (o *RejectFollowRequestInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the reject follow request internal server error response +func (o *RejectFollowRequestInternalServerError) Code() int { + return 500 +} + +func (o *RejectFollowRequestInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestInternalServerError", 500) +} + +func (o *RejectFollowRequestInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/follow_requests/{account_id}/reject][%d] rejectFollowRequestInternalServerError", 500) +} + +func (o *RejectFollowRequestInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/go_to_social_swagger_documentation_client.go b/client/go_to_social_swagger_documentation_client.go new file mode 100644 index 0000000..66c545c --- /dev/null +++ b/client/go_to_social_swagger_documentation_client.go @@ -0,0 +1,262 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package client + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/client/accounts" + "git.coopcloud.tech/decentral1se/gtslib/client/admin" + "git.coopcloud.tech/decentral1se/gtslib/client/apps" + "git.coopcloud.tech/decentral1se/gtslib/client/blocks" + "git.coopcloud.tech/decentral1se/gtslib/client/bookmarks" + "git.coopcloud.tech/decentral1se/gtslib/client/conversations" + "git.coopcloud.tech/decentral1se/gtslib/client/custom_emojis" + "git.coopcloud.tech/decentral1se/gtslib/client/debug" + "git.coopcloud.tech/decentral1se/gtslib/client/favourites" + "git.coopcloud.tech/decentral1se/gtslib/client/featured_tags" + "git.coopcloud.tech/decentral1se/gtslib/client/federation" + "git.coopcloud.tech/decentral1se/gtslib/client/filters" + "git.coopcloud.tech/decentral1se/gtslib/client/follow_requests" + "git.coopcloud.tech/decentral1se/gtslib/client/health" + "git.coopcloud.tech/decentral1se/gtslib/client/instance" + "git.coopcloud.tech/decentral1se/gtslib/client/interaction_policies" + "git.coopcloud.tech/decentral1se/gtslib/client/lists" + "git.coopcloud.tech/decentral1se/gtslib/client/markers" + "git.coopcloud.tech/decentral1se/gtslib/client/media" + "git.coopcloud.tech/decentral1se/gtslib/client/mutes" + "git.coopcloud.tech/decentral1se/gtslib/client/nodeinfo" + "git.coopcloud.tech/decentral1se/gtslib/client/notifications" + "git.coopcloud.tech/decentral1se/gtslib/client/nr_well_known" + "git.coopcloud.tech/decentral1se/gtslib/client/polls" + "git.coopcloud.tech/decentral1se/gtslib/client/preferences" + "git.coopcloud.tech/decentral1se/gtslib/client/reports" + "git.coopcloud.tech/decentral1se/gtslib/client/search" + "git.coopcloud.tech/decentral1se/gtslib/client/statuses" + "git.coopcloud.tech/decentral1se/gtslib/client/streaming" + "git.coopcloud.tech/decentral1se/gtslib/client/timelines" + "git.coopcloud.tech/decentral1se/gtslib/client/user" +) + +// Default go to social swagger documentation HTTP client. +var Default = NewHTTPClient(nil) + +const ( + // DefaultHost is the default Host + // found in Meta (info) section of spec file + DefaultHost string = "example.org" + // DefaultBasePath is the default BasePath + // found in Meta (info) section of spec file + DefaultBasePath string = "/" +) + +// DefaultSchemes are the default schemes found in Meta (info) section of spec file +var DefaultSchemes = []string{"http", "https", "wss"} + +// NewHTTPClient creates a new go to social swagger documentation HTTP client. +func NewHTTPClient(formats strfmt.Registry) *GoToSocialSwaggerDocumentation { + return NewHTTPClientWithConfig(formats, nil) +} + +// NewHTTPClientWithConfig creates a new go to social swagger documentation HTTP client, +// using a customizable transport config. +func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GoToSocialSwaggerDocumentation { + // ensure nullable parameters have default + if cfg == nil { + cfg = DefaultTransportConfig() + } + + // create transport and client + transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) + return New(transport, formats) +} + +// New creates a new go to social swagger documentation client +func New(transport runtime.ClientTransport, formats strfmt.Registry) *GoToSocialSwaggerDocumentation { + // ensure nullable parameters have default + if formats == nil { + formats = strfmt.Default + } + + cli := new(GoToSocialSwaggerDocumentation) + cli.Transport = transport + cli.Accounts = accounts.New(transport, formats) + cli.Admin = admin.New(transport, formats) + cli.Apps = apps.New(transport, formats) + cli.Blocks = blocks.New(transport, formats) + cli.Bookmarks = bookmarks.New(transport, formats) + cli.Conversations = conversations.New(transport, formats) + cli.CustomEmojis = custom_emojis.New(transport, formats) + cli.Debug = debug.New(transport, formats) + cli.Favourites = favourites.New(transport, formats) + cli.FeaturedTags = featured_tags.New(transport, formats) + cli.Federation = federation.New(transport, formats) + cli.Filters = filters.New(transport, formats) + cli.FollowRequests = follow_requests.New(transport, formats) + cli.Health = health.New(transport, formats) + cli.Instance = instance.New(transport, formats) + cli.InteractionPolicies = interaction_policies.New(transport, formats) + cli.Lists = lists.New(transport, formats) + cli.Markers = markers.New(transport, formats) + cli.Media = media.New(transport, formats) + cli.Mutes = mutes.New(transport, formats) + cli.Nodeinfo = nodeinfo.New(transport, formats) + cli.Notifications = notifications.New(transport, formats) + cli.NrWellKnown = nr_well_known.New(transport, formats) + cli.Polls = polls.New(transport, formats) + cli.Preferences = preferences.New(transport, formats) + cli.Reports = reports.New(transport, formats) + cli.Search = search.New(transport, formats) + cli.Statuses = statuses.New(transport, formats) + cli.Streaming = streaming.New(transport, formats) + cli.Timelines = timelines.New(transport, formats) + cli.User = user.New(transport, formats) + return cli +} + +// DefaultTransportConfig creates a TransportConfig with the +// default settings taken from the meta section of the spec file. +func DefaultTransportConfig() *TransportConfig { + return &TransportConfig{ + Host: DefaultHost, + BasePath: DefaultBasePath, + Schemes: DefaultSchemes, + } +} + +// TransportConfig contains the transport related info, +// found in the meta section of the spec file. +type TransportConfig struct { + Host string + BasePath string + Schemes []string +} + +// WithHost overrides the default host, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithHost(host string) *TransportConfig { + cfg.Host = host + return cfg +} + +// WithBasePath overrides the default basePath, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { + cfg.BasePath = basePath + return cfg +} + +// WithSchemes overrides the default schemes, +// provided by the meta section of the spec file. +func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { + cfg.Schemes = schemes + return cfg +} + +// GoToSocialSwaggerDocumentation is a client for go to social swagger documentation +type GoToSocialSwaggerDocumentation struct { + Accounts accounts.ClientService + + Admin admin.ClientService + + Apps apps.ClientService + + Blocks blocks.ClientService + + Bookmarks bookmarks.ClientService + + Conversations conversations.ClientService + + CustomEmojis custom_emojis.ClientService + + Debug debug.ClientService + + Favourites favourites.ClientService + + FeaturedTags featured_tags.ClientService + + Federation federation.ClientService + + Filters filters.ClientService + + FollowRequests follow_requests.ClientService + + Health health.ClientService + + Instance instance.ClientService + + InteractionPolicies interaction_policies.ClientService + + Lists lists.ClientService + + Markers markers.ClientService + + Media media.ClientService + + Mutes mutes.ClientService + + Nodeinfo nodeinfo.ClientService + + Notifications notifications.ClientService + + NrWellKnown nr_well_known.ClientService + + Polls polls.ClientService + + Preferences preferences.ClientService + + Reports reports.ClientService + + Search search.ClientService + + Statuses statuses.ClientService + + Streaming streaming.ClientService + + Timelines timelines.ClientService + + User user.ClientService + + Transport runtime.ClientTransport +} + +// SetTransport changes the transport on the client and all its subresources +func (c *GoToSocialSwaggerDocumentation) SetTransport(transport runtime.ClientTransport) { + c.Transport = transport + c.Accounts.SetTransport(transport) + c.Admin.SetTransport(transport) + c.Apps.SetTransport(transport) + c.Blocks.SetTransport(transport) + c.Bookmarks.SetTransport(transport) + c.Conversations.SetTransport(transport) + c.CustomEmojis.SetTransport(transport) + c.Debug.SetTransport(transport) + c.Favourites.SetTransport(transport) + c.FeaturedTags.SetTransport(transport) + c.Federation.SetTransport(transport) + c.Filters.SetTransport(transport) + c.FollowRequests.SetTransport(transport) + c.Health.SetTransport(transport) + c.Instance.SetTransport(transport) + c.InteractionPolicies.SetTransport(transport) + c.Lists.SetTransport(transport) + c.Markers.SetTransport(transport) + c.Media.SetTransport(transport) + c.Mutes.SetTransport(transport) + c.Nodeinfo.SetTransport(transport) + c.Notifications.SetTransport(transport) + c.NrWellKnown.SetTransport(transport) + c.Polls.SetTransport(transport) + c.Preferences.SetTransport(transport) + c.Reports.SetTransport(transport) + c.Search.SetTransport(transport) + c.Statuses.SetTransport(transport) + c.Streaming.SetTransport(transport) + c.Timelines.SetTransport(transport) + c.User.SetTransport(transport) +} diff --git a/client/health/health_client.go b/client/health/health_client.go new file mode 100644 index 0000000..34e569c --- /dev/null +++ b/client/health/health_client.go @@ -0,0 +1,229 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new health API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new health API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new health API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for health API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + LiveGet(params *LiveGetParams, opts ...ClientOption) (*LiveGetOK, error) + + LiveHead(params *LiveHeadParams, opts ...ClientOption) (*LiveHeadOK, error) + + ReadyGet(params *ReadyGetParams, opts ...ClientOption) (*ReadyGetOK, error) + + ReadyHead(params *ReadyHeadParams, opts ...ClientOption) (*ReadyHeadOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +LiveGet returns code 200 with no body if go to social is live ie able to respond to HTTP requests +*/ +func (a *Client) LiveGet(params *LiveGetParams, opts ...ClientOption) (*LiveGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewLiveGetParams() + } + op := &runtime.ClientOperation{ + ID: "liveGet", + Method: "GET", + PathPattern: "/livez", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &LiveGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*LiveGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for liveGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +LiveHead returns code 200 if go to social is live ie able to respond to HTTP requests +*/ +func (a *Client) LiveHead(params *LiveHeadParams, opts ...ClientOption) (*LiveHeadOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewLiveHeadParams() + } + op := &runtime.ClientOperation{ + ID: "liveHead", + Method: "HEAD", + PathPattern: "/livez", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &LiveHeadReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*LiveHeadOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for liveHead: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ReadyGet returns code 200 with no body if go to social is ready ie able to connect to the database backend and do a simple s e l e c t + +If GtS is not ready, 500 Internal Error will be returned, and an error will be logged (but not returned to the caller, to avoid leaking internals). +*/ +func (a *Client) ReadyGet(params *ReadyGetParams, opts ...ClientOption) (*ReadyGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReadyGetParams() + } + op := &runtime.ClientOperation{ + ID: "readyGet", + Method: "GET", + PathPattern: "/readyz", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReadyGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ReadyGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for readyGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ReadyHead returns code 200 with no body if go to social is ready ie able to connect to the database backend and do a simple s e l e c t + +If GtS is not ready, 500 Internal Error will be returned, and an error will be logged (but not returned to the caller, to avoid leaking internals). +*/ +func (a *Client) ReadyHead(params *ReadyHeadParams, opts ...ClientOption) (*ReadyHeadOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReadyHeadParams() + } + op := &runtime.ClientOperation{ + ID: "readyHead", + Method: "HEAD", + PathPattern: "/readyz", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReadyHeadReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ReadyHeadOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for readyHead: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/health/live_get_parameters.go b/client/health/live_get_parameters.go new file mode 100644 index 0000000..6961e6b --- /dev/null +++ b/client/health/live_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewLiveGetParams creates a new LiveGetParams 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 NewLiveGetParams() *LiveGetParams { + return &LiveGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewLiveGetParamsWithTimeout creates a new LiveGetParams object +// with the ability to set a timeout on a request. +func NewLiveGetParamsWithTimeout(timeout time.Duration) *LiveGetParams { + return &LiveGetParams{ + timeout: timeout, + } +} + +// NewLiveGetParamsWithContext creates a new LiveGetParams object +// with the ability to set a context for a request. +func NewLiveGetParamsWithContext(ctx context.Context) *LiveGetParams { + return &LiveGetParams{ + Context: ctx, + } +} + +// NewLiveGetParamsWithHTTPClient creates a new LiveGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewLiveGetParamsWithHTTPClient(client *http.Client) *LiveGetParams { + return &LiveGetParams{ + HTTPClient: client, + } +} + +/* +LiveGetParams contains all the parameters to send to the API endpoint + + for the live get operation. + + Typically these are written to a http.Request. +*/ +type LiveGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the live get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveGetParams) WithDefaults() *LiveGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the live get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the live get params +func (o *LiveGetParams) WithTimeout(timeout time.Duration) *LiveGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the live get params +func (o *LiveGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the live get params +func (o *LiveGetParams) WithContext(ctx context.Context) *LiveGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the live get params +func (o *LiveGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the live get params +func (o *LiveGetParams) WithHTTPClient(client *http.Client) *LiveGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the live get params +func (o *LiveGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *LiveGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/health/live_get_responses.go b/client/health/live_get_responses.go new file mode 100644 index 0000000..c6a54da --- /dev/null +++ b/client/health/live_get_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// LiveGetReader is a Reader for the LiveGet structure. +type LiveGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *LiveGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewLiveGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /livez] liveGet", response, response.Code()) + } +} + +// NewLiveGetOK creates a LiveGetOK with default headers values +func NewLiveGetOK() *LiveGetOK { + return &LiveGetOK{} +} + +/* +LiveGetOK describes a response with status code 200, with default header values. + +OK +*/ +type LiveGetOK struct { +} + +// IsSuccess returns true when this live get o k response has a 2xx status code +func (o *LiveGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this live get o k response has a 3xx status code +func (o *LiveGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this live get o k response has a 4xx status code +func (o *LiveGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this live get o k response has a 5xx status code +func (o *LiveGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this live get o k response a status code equal to that given +func (o *LiveGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the live get o k response +func (o *LiveGetOK) Code() int { + return 200 +} + +func (o *LiveGetOK) Error() string { + return fmt.Sprintf("[GET /livez][%d] liveGetOK", 200) +} + +func (o *LiveGetOK) String() string { + return fmt.Sprintf("[GET /livez][%d] liveGetOK", 200) +} + +func (o *LiveGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/health/live_head_parameters.go b/client/health/live_head_parameters.go new file mode 100644 index 0000000..7129dec --- /dev/null +++ b/client/health/live_head_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewLiveHeadParams creates a new LiveHeadParams 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 NewLiveHeadParams() *LiveHeadParams { + return &LiveHeadParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewLiveHeadParamsWithTimeout creates a new LiveHeadParams object +// with the ability to set a timeout on a request. +func NewLiveHeadParamsWithTimeout(timeout time.Duration) *LiveHeadParams { + return &LiveHeadParams{ + timeout: timeout, + } +} + +// NewLiveHeadParamsWithContext creates a new LiveHeadParams object +// with the ability to set a context for a request. +func NewLiveHeadParamsWithContext(ctx context.Context) *LiveHeadParams { + return &LiveHeadParams{ + Context: ctx, + } +} + +// NewLiveHeadParamsWithHTTPClient creates a new LiveHeadParams object +// with the ability to set a custom HTTPClient for a request. +func NewLiveHeadParamsWithHTTPClient(client *http.Client) *LiveHeadParams { + return &LiveHeadParams{ + HTTPClient: client, + } +} + +/* +LiveHeadParams contains all the parameters to send to the API endpoint + + for the live head operation. + + Typically these are written to a http.Request. +*/ +type LiveHeadParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the live head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveHeadParams) WithDefaults() *LiveHeadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the live head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *LiveHeadParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the live head params +func (o *LiveHeadParams) WithTimeout(timeout time.Duration) *LiveHeadParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the live head params +func (o *LiveHeadParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the live head params +func (o *LiveHeadParams) WithContext(ctx context.Context) *LiveHeadParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the live head params +func (o *LiveHeadParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the live head params +func (o *LiveHeadParams) WithHTTPClient(client *http.Client) *LiveHeadParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the live head params +func (o *LiveHeadParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *LiveHeadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/health/live_head_responses.go b/client/health/live_head_responses.go new file mode 100644 index 0000000..b85cb27 --- /dev/null +++ b/client/health/live_head_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// LiveHeadReader is a Reader for the LiveHead structure. +type LiveHeadReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *LiveHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewLiveHeadOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /livez] liveHead", response, response.Code()) + } +} + +// NewLiveHeadOK creates a LiveHeadOK with default headers values +func NewLiveHeadOK() *LiveHeadOK { + return &LiveHeadOK{} +} + +/* +LiveHeadOK describes a response with status code 200, with default header values. + +OK +*/ +type LiveHeadOK struct { +} + +// IsSuccess returns true when this live head o k response has a 2xx status code +func (o *LiveHeadOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this live head o k response has a 3xx status code +func (o *LiveHeadOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this live head o k response has a 4xx status code +func (o *LiveHeadOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this live head o k response has a 5xx status code +func (o *LiveHeadOK) IsServerError() bool { + return false +} + +// IsCode returns true when this live head o k response a status code equal to that given +func (o *LiveHeadOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the live head o k response +func (o *LiveHeadOK) Code() int { + return 200 +} + +func (o *LiveHeadOK) Error() string { + return fmt.Sprintf("[HEAD /livez][%d] liveHeadOK", 200) +} + +func (o *LiveHeadOK) String() string { + return fmt.Sprintf("[HEAD /livez][%d] liveHeadOK", 200) +} + +func (o *LiveHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/health/ready_get_parameters.go b/client/health/ready_get_parameters.go new file mode 100644 index 0000000..bc847dc --- /dev/null +++ b/client/health/ready_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewReadyGetParams creates a new ReadyGetParams 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 NewReadyGetParams() *ReadyGetParams { + return &ReadyGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReadyGetParamsWithTimeout creates a new ReadyGetParams object +// with the ability to set a timeout on a request. +func NewReadyGetParamsWithTimeout(timeout time.Duration) *ReadyGetParams { + return &ReadyGetParams{ + timeout: timeout, + } +} + +// NewReadyGetParamsWithContext creates a new ReadyGetParams object +// with the ability to set a context for a request. +func NewReadyGetParamsWithContext(ctx context.Context) *ReadyGetParams { + return &ReadyGetParams{ + Context: ctx, + } +} + +// NewReadyGetParamsWithHTTPClient creates a new ReadyGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewReadyGetParamsWithHTTPClient(client *http.Client) *ReadyGetParams { + return &ReadyGetParams{ + HTTPClient: client, + } +} + +/* +ReadyGetParams contains all the parameters to send to the API endpoint + + for the ready get operation. + + Typically these are written to a http.Request. +*/ +type ReadyGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the ready get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyGetParams) WithDefaults() *ReadyGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the ready get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the ready get params +func (o *ReadyGetParams) WithTimeout(timeout time.Duration) *ReadyGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the ready get params +func (o *ReadyGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the ready get params +func (o *ReadyGetParams) WithContext(ctx context.Context) *ReadyGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the ready get params +func (o *ReadyGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the ready get params +func (o *ReadyGetParams) WithHTTPClient(client *http.Client) *ReadyGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the ready get params +func (o *ReadyGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ReadyGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/health/ready_get_responses.go b/client/health/ready_get_responses.go new file mode 100644 index 0000000..a1cfd76 --- /dev/null +++ b/client/health/ready_get_responses.go @@ -0,0 +1,150 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// ReadyGetReader is a Reader for the ReadyGet structure. +type ReadyGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReadyGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReadyGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 500: + result := NewReadyGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /readyz] readyGet", response, response.Code()) + } +} + +// NewReadyGetOK creates a ReadyGetOK with default headers values +func NewReadyGetOK() *ReadyGetOK { + return &ReadyGetOK{} +} + +/* +ReadyGetOK describes a response with status code 200, with default header values. + +OK +*/ +type ReadyGetOK struct { +} + +// IsSuccess returns true when this ready get o k response has a 2xx status code +func (o *ReadyGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this ready get o k response has a 3xx status code +func (o *ReadyGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this ready get o k response has a 4xx status code +func (o *ReadyGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this ready get o k response has a 5xx status code +func (o *ReadyGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this ready get o k response a status code equal to that given +func (o *ReadyGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the ready get o k response +func (o *ReadyGetOK) Code() int { + return 200 +} + +func (o *ReadyGetOK) Error() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetOK", 200) +} + +func (o *ReadyGetOK) String() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetOK", 200) +} + +func (o *ReadyGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReadyGetInternalServerError creates a ReadyGetInternalServerError with default headers values +func NewReadyGetInternalServerError() *ReadyGetInternalServerError { + return &ReadyGetInternalServerError{} +} + +/* +ReadyGetInternalServerError describes a response with status code 500, with default header values. + +Not ready. Check logs for error message. +*/ +type ReadyGetInternalServerError struct { +} + +// IsSuccess returns true when this ready get internal server error response has a 2xx status code +func (o *ReadyGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this ready get internal server error response has a 3xx status code +func (o *ReadyGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this ready get internal server error response has a 4xx status code +func (o *ReadyGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this ready get internal server error response has a 5xx status code +func (o *ReadyGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this ready get internal server error response a status code equal to that given +func (o *ReadyGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the ready get internal server error response +func (o *ReadyGetInternalServerError) Code() int { + return 500 +} + +func (o *ReadyGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetInternalServerError", 500) +} + +func (o *ReadyGetInternalServerError) String() string { + return fmt.Sprintf("[GET /readyz][%d] readyGetInternalServerError", 500) +} + +func (o *ReadyGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/health/ready_head_parameters.go b/client/health/ready_head_parameters.go new file mode 100644 index 0000000..2469cc5 --- /dev/null +++ b/client/health/ready_head_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// 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" +) + +// NewReadyHeadParams creates a new ReadyHeadParams 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 NewReadyHeadParams() *ReadyHeadParams { + return &ReadyHeadParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReadyHeadParamsWithTimeout creates a new ReadyHeadParams object +// with the ability to set a timeout on a request. +func NewReadyHeadParamsWithTimeout(timeout time.Duration) *ReadyHeadParams { + return &ReadyHeadParams{ + timeout: timeout, + } +} + +// NewReadyHeadParamsWithContext creates a new ReadyHeadParams object +// with the ability to set a context for a request. +func NewReadyHeadParamsWithContext(ctx context.Context) *ReadyHeadParams { + return &ReadyHeadParams{ + Context: ctx, + } +} + +// NewReadyHeadParamsWithHTTPClient creates a new ReadyHeadParams object +// with the ability to set a custom HTTPClient for a request. +func NewReadyHeadParamsWithHTTPClient(client *http.Client) *ReadyHeadParams { + return &ReadyHeadParams{ + HTTPClient: client, + } +} + +/* +ReadyHeadParams contains all the parameters to send to the API endpoint + + for the ready head operation. + + Typically these are written to a http.Request. +*/ +type ReadyHeadParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the ready head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyHeadParams) WithDefaults() *ReadyHeadParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the ready head params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReadyHeadParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the ready head params +func (o *ReadyHeadParams) WithTimeout(timeout time.Duration) *ReadyHeadParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the ready head params +func (o *ReadyHeadParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the ready head params +func (o *ReadyHeadParams) WithContext(ctx context.Context) *ReadyHeadParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the ready head params +func (o *ReadyHeadParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the ready head params +func (o *ReadyHeadParams) WithHTTPClient(client *http.Client) *ReadyHeadParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the ready head params +func (o *ReadyHeadParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ReadyHeadParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/health/ready_head_responses.go b/client/health/ready_head_responses.go new file mode 100644 index 0000000..30e9d2e --- /dev/null +++ b/client/health/ready_head_responses.go @@ -0,0 +1,88 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package health + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// ReadyHeadReader is a Reader for the ReadyHead structure. +type ReadyHeadReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReadyHeadReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReadyHeadOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[HEAD /readyz] readyHead", response, response.Code()) + } +} + +// NewReadyHeadOK creates a ReadyHeadOK with default headers values +func NewReadyHeadOK() *ReadyHeadOK { + return &ReadyHeadOK{} +} + +/* +ReadyHeadOK describes a response with status code 200, with default header values. + +OK +*/ +type ReadyHeadOK struct { +} + +// IsSuccess returns true when this ready head o k response has a 2xx status code +func (o *ReadyHeadOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this ready head o k response has a 3xx status code +func (o *ReadyHeadOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this ready head o k response has a 4xx status code +func (o *ReadyHeadOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this ready head o k response has a 5xx status code +func (o *ReadyHeadOK) IsServerError() bool { + return false +} + +// IsCode returns true when this ready head o k response a status code equal to that given +func (o *ReadyHeadOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the ready head o k response +func (o *ReadyHeadOK) Code() int { + return 200 +} + +func (o *ReadyHeadOK) Error() string { + return fmt.Sprintf("[HEAD /readyz][%d] readyHeadOK", 200) +} + +func (o *ReadyHeadOK) String() string { + return fmt.Sprintf("[HEAD /readyz][%d] readyHeadOK", 200) +} + +func (o *ReadyHeadOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/instance/instance_client.go b/client/instance/instance_client.go new file mode 100644 index 0000000..9bcbbc6 --- /dev/null +++ b/client/instance/instance_client.go @@ -0,0 +1,294 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new instance API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new instance API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new instance API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for instance API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + InstanceGetV1(params *InstanceGetV1Params, opts ...ClientOption) (*InstanceGetV1OK, error) + + InstanceGetV2(params *InstanceGetV2Params, opts ...ClientOption) (*InstanceGetV2OK, error) + + InstancePeersGet(params *InstancePeersGetParams, opts ...ClientOption) (*InstancePeersGetOK, error) + + InstanceUpdate(params *InstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstanceUpdateOK, error) + + Rules(params *RulesParams, opts ...ClientOption) (*RulesOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +InstanceGetV1 views instance information +*/ +func (a *Client) InstanceGetV1(params *InstanceGetV1Params, opts ...ClientOption) (*InstanceGetV1OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstanceGetV1Params() + } + op := &runtime.ClientOperation{ + ID: "instanceGetV1", + Method: "GET", + PathPattern: "/api/v1/instance", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstanceGetV1Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*InstanceGetV1OK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for instanceGetV1: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InstanceGetV2 views instance information +*/ +func (a *Client) InstanceGetV2(params *InstanceGetV2Params, opts ...ClientOption) (*InstanceGetV2OK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstanceGetV2Params() + } + op := &runtime.ClientOperation{ + ID: "instanceGetV2", + Method: "GET", + PathPattern: "/api/v2/instance", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstanceGetV2Reader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*InstanceGetV2OK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for instanceGetV2: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InstancePeersGet instance peers get API +*/ +func (a *Client) InstancePeersGet(params *InstancePeersGetParams, opts ...ClientOption) (*InstancePeersGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstancePeersGetParams() + } + op := &runtime.ClientOperation{ + ID: "instancePeersGet", + Method: "GET", + PathPattern: "/api/v1/instance/peers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstancePeersGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*InstancePeersGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for instancePeersGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +InstanceUpdate updates your instance information and or upload a new avatar header for the instance + +This requires admin permissions on the instance. +*/ +func (a *Client) InstanceUpdate(params *InstanceUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*InstanceUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewInstanceUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "instanceUpdate", + Method: "PATCH", + PathPattern: "/api/v1/instance", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &InstanceUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*InstanceUpdateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for instanceUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +Rules views instance rules public + +The rules will be returned in order (sorted by Order ascending). +*/ +func (a *Client) Rules(params *RulesParams, opts ...ClientOption) (*RulesOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRulesParams() + } + op := &runtime.ClientOperation{ + ID: "rules", + Method: "GET", + PathPattern: "/api/v1/instance/rules", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RulesReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*RulesOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for rules: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/instance/instance_get_v1_parameters.go b/client/instance/instance_get_v1_parameters.go new file mode 100644 index 0000000..4124b6a --- /dev/null +++ b/client/instance/instance_get_v1_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstanceGetV1Params creates a new InstanceGetV1Params 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 NewInstanceGetV1Params() *InstanceGetV1Params { + return &InstanceGetV1Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstanceGetV1ParamsWithTimeout creates a new InstanceGetV1Params object +// with the ability to set a timeout on a request. +func NewInstanceGetV1ParamsWithTimeout(timeout time.Duration) *InstanceGetV1Params { + return &InstanceGetV1Params{ + timeout: timeout, + } +} + +// NewInstanceGetV1ParamsWithContext creates a new InstanceGetV1Params object +// with the ability to set a context for a request. +func NewInstanceGetV1ParamsWithContext(ctx context.Context) *InstanceGetV1Params { + return &InstanceGetV1Params{ + Context: ctx, + } +} + +// NewInstanceGetV1ParamsWithHTTPClient creates a new InstanceGetV1Params object +// with the ability to set a custom HTTPClient for a request. +func NewInstanceGetV1ParamsWithHTTPClient(client *http.Client) *InstanceGetV1Params { + return &InstanceGetV1Params{ + HTTPClient: client, + } +} + +/* +InstanceGetV1Params contains all the parameters to send to the API endpoint + + for the instance get v1 operation. + + Typically these are written to a http.Request. +*/ +type InstanceGetV1Params struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV1Params) WithDefaults() *InstanceGetV1Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance get v1 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV1Params) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the instance get v1 params +func (o *InstanceGetV1Params) WithTimeout(timeout time.Duration) *InstanceGetV1Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance get v1 params +func (o *InstanceGetV1Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance get v1 params +func (o *InstanceGetV1Params) WithContext(ctx context.Context) *InstanceGetV1Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance get v1 params +func (o *InstanceGetV1Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance get v1 params +func (o *InstanceGetV1Params) WithHTTPClient(client *http.Client) *InstanceGetV1Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance get v1 params +func (o *InstanceGetV1Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *InstanceGetV1Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instance/instance_get_v1_responses.go b/client/instance/instance_get_v1_responses.go new file mode 100644 index 0000000..b8b0e8a --- /dev/null +++ b/client/instance/instance_get_v1_responses.go @@ -0,0 +1,230 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstanceGetV1Reader is a Reader for the InstanceGetV1 structure. +type InstanceGetV1Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstanceGetV1Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstanceGetV1OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 406: + result := NewInstanceGetV1NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstanceGetV1InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/instance] instanceGetV1", response, response.Code()) + } +} + +// NewInstanceGetV1OK creates a InstanceGetV1OK with default headers values +func NewInstanceGetV1OK() *InstanceGetV1OK { + return &InstanceGetV1OK{} +} + +/* +InstanceGetV1OK describes a response with status code 200, with default header values. + +Instance information. +*/ +type InstanceGetV1OK struct { + Payload *models.InstanceV1 +} + +// IsSuccess returns true when this instance get v1 o k response has a 2xx status code +func (o *InstanceGetV1OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance get v1 o k response has a 3xx status code +func (o *InstanceGetV1OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v1 o k response has a 4xx status code +func (o *InstanceGetV1OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v1 o k response has a 5xx status code +func (o *InstanceGetV1OK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v1 o k response a status code equal to that given +func (o *InstanceGetV1OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance get v1 o k response +func (o *InstanceGetV1OK) Code() int { + return 200 +} + +func (o *InstanceGetV1OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1OK %s", 200, payload) +} + +func (o *InstanceGetV1OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1OK %s", 200, payload) +} + +func (o *InstanceGetV1OK) GetPayload() *models.InstanceV1 { + return o.Payload +} + +func (o *InstanceGetV1OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInstanceGetV1NotAcceptable creates a InstanceGetV1NotAcceptable with default headers values +func NewInstanceGetV1NotAcceptable() *InstanceGetV1NotAcceptable { + return &InstanceGetV1NotAcceptable{} +} + +/* +InstanceGetV1NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstanceGetV1NotAcceptable struct { +} + +// IsSuccess returns true when this instance get v1 not acceptable response has a 2xx status code +func (o *InstanceGetV1NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v1 not acceptable response has a 3xx status code +func (o *InstanceGetV1NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v1 not acceptable response has a 4xx status code +func (o *InstanceGetV1NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance get v1 not acceptable response has a 5xx status code +func (o *InstanceGetV1NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v1 not acceptable response a status code equal to that given +func (o *InstanceGetV1NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance get v1 not acceptable response +func (o *InstanceGetV1NotAcceptable) Code() int { + return 406 +} + +func (o *InstanceGetV1NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1NotAcceptable", 406) +} + +func (o *InstanceGetV1NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1NotAcceptable", 406) +} + +func (o *InstanceGetV1NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceGetV1InternalServerError creates a InstanceGetV1InternalServerError with default headers values +func NewInstanceGetV1InternalServerError() *InstanceGetV1InternalServerError { + return &InstanceGetV1InternalServerError{} +} + +/* +InstanceGetV1InternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type InstanceGetV1InternalServerError struct { +} + +// IsSuccess returns true when this instance get v1 internal server error response has a 2xx status code +func (o *InstanceGetV1InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v1 internal server error response has a 3xx status code +func (o *InstanceGetV1InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v1 internal server error response has a 4xx status code +func (o *InstanceGetV1InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v1 internal server error response has a 5xx status code +func (o *InstanceGetV1InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance get v1 internal server error response a status code equal to that given +func (o *InstanceGetV1InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance get v1 internal server error response +func (o *InstanceGetV1InternalServerError) Code() int { + return 500 +} + +func (o *InstanceGetV1InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1InternalServerError", 500) +} + +func (o *InstanceGetV1InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/instance][%d] instanceGetV1InternalServerError", 500) +} + +func (o *InstanceGetV1InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/instance/instance_get_v2_parameters.go b/client/instance/instance_get_v2_parameters.go new file mode 100644 index 0000000..140d7cb --- /dev/null +++ b/client/instance/instance_get_v2_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstanceGetV2Params creates a new InstanceGetV2Params 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 NewInstanceGetV2Params() *InstanceGetV2Params { + return &InstanceGetV2Params{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstanceGetV2ParamsWithTimeout creates a new InstanceGetV2Params object +// with the ability to set a timeout on a request. +func NewInstanceGetV2ParamsWithTimeout(timeout time.Duration) *InstanceGetV2Params { + return &InstanceGetV2Params{ + timeout: timeout, + } +} + +// NewInstanceGetV2ParamsWithContext creates a new InstanceGetV2Params object +// with the ability to set a context for a request. +func NewInstanceGetV2ParamsWithContext(ctx context.Context) *InstanceGetV2Params { + return &InstanceGetV2Params{ + Context: ctx, + } +} + +// NewInstanceGetV2ParamsWithHTTPClient creates a new InstanceGetV2Params object +// with the ability to set a custom HTTPClient for a request. +func NewInstanceGetV2ParamsWithHTTPClient(client *http.Client) *InstanceGetV2Params { + return &InstanceGetV2Params{ + HTTPClient: client, + } +} + +/* +InstanceGetV2Params contains all the parameters to send to the API endpoint + + for the instance get v2 operation. + + Typically these are written to a http.Request. +*/ +type InstanceGetV2Params struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV2Params) WithDefaults() *InstanceGetV2Params { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance get v2 params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceGetV2Params) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the instance get v2 params +func (o *InstanceGetV2Params) WithTimeout(timeout time.Duration) *InstanceGetV2Params { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance get v2 params +func (o *InstanceGetV2Params) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance get v2 params +func (o *InstanceGetV2Params) WithContext(ctx context.Context) *InstanceGetV2Params { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance get v2 params +func (o *InstanceGetV2Params) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance get v2 params +func (o *InstanceGetV2Params) WithHTTPClient(client *http.Client) *InstanceGetV2Params { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance get v2 params +func (o *InstanceGetV2Params) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *InstanceGetV2Params) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instance/instance_get_v2_responses.go b/client/instance/instance_get_v2_responses.go new file mode 100644 index 0000000..6edaaca --- /dev/null +++ b/client/instance/instance_get_v2_responses.go @@ -0,0 +1,230 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstanceGetV2Reader is a Reader for the InstanceGetV2 structure. +type InstanceGetV2Reader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstanceGetV2Reader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstanceGetV2OK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 406: + result := NewInstanceGetV2NotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstanceGetV2InternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v2/instance] instanceGetV2", response, response.Code()) + } +} + +// NewInstanceGetV2OK creates a InstanceGetV2OK with default headers values +func NewInstanceGetV2OK() *InstanceGetV2OK { + return &InstanceGetV2OK{} +} + +/* +InstanceGetV2OK describes a response with status code 200, with default header values. + +Instance information. +*/ +type InstanceGetV2OK struct { + Payload *models.InstanceV2 +} + +// IsSuccess returns true when this instance get v2 o k response has a 2xx status code +func (o *InstanceGetV2OK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance get v2 o k response has a 3xx status code +func (o *InstanceGetV2OK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v2 o k response has a 4xx status code +func (o *InstanceGetV2OK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v2 o k response has a 5xx status code +func (o *InstanceGetV2OK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v2 o k response a status code equal to that given +func (o *InstanceGetV2OK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance get v2 o k response +func (o *InstanceGetV2OK) Code() int { + return 200 +} + +func (o *InstanceGetV2OK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2OK %s", 200, payload) +} + +func (o *InstanceGetV2OK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2OK %s", 200, payload) +} + +func (o *InstanceGetV2OK) GetPayload() *models.InstanceV2 { + return o.Payload +} + +func (o *InstanceGetV2OK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceV2) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInstanceGetV2NotAcceptable creates a InstanceGetV2NotAcceptable with default headers values +func NewInstanceGetV2NotAcceptable() *InstanceGetV2NotAcceptable { + return &InstanceGetV2NotAcceptable{} +} + +/* +InstanceGetV2NotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstanceGetV2NotAcceptable struct { +} + +// IsSuccess returns true when this instance get v2 not acceptable response has a 2xx status code +func (o *InstanceGetV2NotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v2 not acceptable response has a 3xx status code +func (o *InstanceGetV2NotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v2 not acceptable response has a 4xx status code +func (o *InstanceGetV2NotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance get v2 not acceptable response has a 5xx status code +func (o *InstanceGetV2NotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance get v2 not acceptable response a status code equal to that given +func (o *InstanceGetV2NotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance get v2 not acceptable response +func (o *InstanceGetV2NotAcceptable) Code() int { + return 406 +} + +func (o *InstanceGetV2NotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2NotAcceptable", 406) +} + +func (o *InstanceGetV2NotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2NotAcceptable", 406) +} + +func (o *InstanceGetV2NotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceGetV2InternalServerError creates a InstanceGetV2InternalServerError with default headers values +func NewInstanceGetV2InternalServerError() *InstanceGetV2InternalServerError { + return &InstanceGetV2InternalServerError{} +} + +/* +InstanceGetV2InternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type InstanceGetV2InternalServerError struct { +} + +// IsSuccess returns true when this instance get v2 internal server error response has a 2xx status code +func (o *InstanceGetV2InternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance get v2 internal server error response has a 3xx status code +func (o *InstanceGetV2InternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance get v2 internal server error response has a 4xx status code +func (o *InstanceGetV2InternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance get v2 internal server error response has a 5xx status code +func (o *InstanceGetV2InternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance get v2 internal server error response a status code equal to that given +func (o *InstanceGetV2InternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance get v2 internal server error response +func (o *InstanceGetV2InternalServerError) Code() int { + return 500 +} + +func (o *InstanceGetV2InternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2InternalServerError", 500) +} + +func (o *InstanceGetV2InternalServerError) String() string { + return fmt.Sprintf("[GET /api/v2/instance][%d] instanceGetV2InternalServerError", 500) +} + +func (o *InstanceGetV2InternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/instance/instance_peers_get_parameters.go b/client/instance/instance_peers_get_parameters.go new file mode 100644 index 0000000..9048ab1 --- /dev/null +++ b/client/instance/instance_peers_get_parameters.go @@ -0,0 +1,186 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstancePeersGetParams creates a new InstancePeersGetParams 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 NewInstancePeersGetParams() *InstancePeersGetParams { + return &InstancePeersGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstancePeersGetParamsWithTimeout creates a new InstancePeersGetParams object +// with the ability to set a timeout on a request. +func NewInstancePeersGetParamsWithTimeout(timeout time.Duration) *InstancePeersGetParams { + return &InstancePeersGetParams{ + timeout: timeout, + } +} + +// NewInstancePeersGetParamsWithContext creates a new InstancePeersGetParams object +// with the ability to set a context for a request. +func NewInstancePeersGetParamsWithContext(ctx context.Context) *InstancePeersGetParams { + return &InstancePeersGetParams{ + Context: ctx, + } +} + +// NewInstancePeersGetParamsWithHTTPClient creates a new InstancePeersGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewInstancePeersGetParamsWithHTTPClient(client *http.Client) *InstancePeersGetParams { + return &InstancePeersGetParams{ + HTTPClient: client, + } +} + +/* +InstancePeersGetParams contains all the parameters to send to the API endpoint + + for the instance peers get operation. + + Typically these are written to a http.Request. +*/ +type InstancePeersGetParams struct { + + /* Filter. + + Comma-separated list of filters to apply to results. Recognized filters are: + - `open` -- include peers that are not suspended or silenced + - `suspended` -- include peers that have been suspended. + + If filter is `open`, only instances that haven't been suspended or silenced will be returned. + + If filter is `suspended`, only suspended instances will be shown. + + If filter is `open,suspended`, then all known instances will be returned. + + If filter is an empty string or not set, then `open` will be assumed as the default. + + Default: "open" + */ + Filter *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance peers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstancePeersGetParams) WithDefaults() *InstancePeersGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance peers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstancePeersGetParams) SetDefaults() { + var ( + filterDefault = string("open") + ) + + val := InstancePeersGetParams{ + Filter: &filterDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the instance peers get params +func (o *InstancePeersGetParams) WithTimeout(timeout time.Duration) *InstancePeersGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance peers get params +func (o *InstancePeersGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance peers get params +func (o *InstancePeersGetParams) WithContext(ctx context.Context) *InstancePeersGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance peers get params +func (o *InstancePeersGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance peers get params +func (o *InstancePeersGetParams) WithHTTPClient(client *http.Client) *InstancePeersGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance peers get params +func (o *InstancePeersGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithFilter adds the filter to the instance peers get params +func (o *InstancePeersGetParams) WithFilter(filter *string) *InstancePeersGetParams { + o.SetFilter(filter) + return o +} + +// SetFilter adds the filter to the instance peers get params +func (o *InstancePeersGetParams) SetFilter(filter *string) { + o.Filter = filter +} + +// WriteToRequest writes these params to a swagger request +func (o *InstancePeersGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Filter != nil { + + // query param filter + var qrFilter string + + if o.Filter != nil { + qrFilter = *o.Filter + } + qFilter := qrFilter + if qFilter != "" { + + if err := r.SetQueryParam("filter", qFilter); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instance/instance_peers_get_responses.go b/client/instance/instance_peers_get_responses.go new file mode 100644 index 0000000..879385a --- /dev/null +++ b/client/instance/instance_peers_get_responses.go @@ -0,0 +1,482 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstancePeersGetReader is a Reader for the InstancePeersGet structure. +type InstancePeersGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstancePeersGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstancePeersGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewInstancePeersGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewInstancePeersGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewInstancePeersGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInstancePeersGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewInstancePeersGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstancePeersGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/instance/peers] instancePeersGet", response, response.Code()) + } +} + +// NewInstancePeersGetOK creates a InstancePeersGetOK with default headers values +func NewInstancePeersGetOK() *InstancePeersGetOK { + return &InstancePeersGetOK{} +} + +/* + InstancePeersGetOK describes a response with status code 200, with default header values. + + If no filter parameter is provided, or filter is empty, then a legacy, Mastodon-API compatible response will be returned. This will consist of just a 'flat' array of strings like `["example.com", "example.org"]`, which corresponds to domains this instance peers with. + +If a filter parameter is provided, then an array of objects with at least a `domain` key set on each object will be returned. + +Domains that are silenced or suspended will also have a key `suspended_at` or `silenced_at` that contains an iso8601 date string. If one of these keys is not present on the domain object, it is open. Suspended instances may in some cases be obfuscated, which means they will have some letters replaced by `*` to make it more difficult for bad actors to target instances with harassment. + +Whether a flat response or a more detailed response is returned, domains will be sorted alphabetically by hostname. +*/ +type InstancePeersGetOK struct { + Payload []*models.Domain +} + +// IsSuccess returns true when this instance peers get o k response has a 2xx status code +func (o *InstancePeersGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance peers get o k response has a 3xx status code +func (o *InstancePeersGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get o k response has a 4xx status code +func (o *InstancePeersGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance peers get o k response has a 5xx status code +func (o *InstancePeersGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get o k response a status code equal to that given +func (o *InstancePeersGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance peers get o k response +func (o *InstancePeersGetOK) Code() int { + return 200 +} + +func (o *InstancePeersGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetOK %s", 200, payload) +} + +func (o *InstancePeersGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetOK %s", 200, payload) +} + +func (o *InstancePeersGetOK) GetPayload() []*models.Domain { + return o.Payload +} + +func (o *InstancePeersGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInstancePeersGetBadRequest creates a InstancePeersGetBadRequest with default headers values +func NewInstancePeersGetBadRequest() *InstancePeersGetBadRequest { + return &InstancePeersGetBadRequest{} +} + +/* +InstancePeersGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type InstancePeersGetBadRequest struct { +} + +// IsSuccess returns true when this instance peers get bad request response has a 2xx status code +func (o *InstancePeersGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get bad request response has a 3xx status code +func (o *InstancePeersGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get bad request response has a 4xx status code +func (o *InstancePeersGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get bad request response has a 5xx status code +func (o *InstancePeersGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get bad request response a status code equal to that given +func (o *InstancePeersGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the instance peers get bad request response +func (o *InstancePeersGetBadRequest) Code() int { + return 400 +} + +func (o *InstancePeersGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetBadRequest", 400) +} + +func (o *InstancePeersGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetBadRequest", 400) +} + +func (o *InstancePeersGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetUnauthorized creates a InstancePeersGetUnauthorized with default headers values +func NewInstancePeersGetUnauthorized() *InstancePeersGetUnauthorized { + return &InstancePeersGetUnauthorized{} +} + +/* +InstancePeersGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type InstancePeersGetUnauthorized struct { +} + +// IsSuccess returns true when this instance peers get unauthorized response has a 2xx status code +func (o *InstancePeersGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get unauthorized response has a 3xx status code +func (o *InstancePeersGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get unauthorized response has a 4xx status code +func (o *InstancePeersGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get unauthorized response has a 5xx status code +func (o *InstancePeersGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get unauthorized response a status code equal to that given +func (o *InstancePeersGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the instance peers get unauthorized response +func (o *InstancePeersGetUnauthorized) Code() int { + return 401 +} + +func (o *InstancePeersGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetUnauthorized", 401) +} + +func (o *InstancePeersGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetUnauthorized", 401) +} + +func (o *InstancePeersGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetForbidden creates a InstancePeersGetForbidden with default headers values +func NewInstancePeersGetForbidden() *InstancePeersGetForbidden { + return &InstancePeersGetForbidden{} +} + +/* +InstancePeersGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type InstancePeersGetForbidden struct { +} + +// IsSuccess returns true when this instance peers get forbidden response has a 2xx status code +func (o *InstancePeersGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get forbidden response has a 3xx status code +func (o *InstancePeersGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get forbidden response has a 4xx status code +func (o *InstancePeersGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get forbidden response has a 5xx status code +func (o *InstancePeersGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get forbidden response a status code equal to that given +func (o *InstancePeersGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the instance peers get forbidden response +func (o *InstancePeersGetForbidden) Code() int { + return 403 +} + +func (o *InstancePeersGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetForbidden", 403) +} + +func (o *InstancePeersGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetForbidden", 403) +} + +func (o *InstancePeersGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetNotFound creates a InstancePeersGetNotFound with default headers values +func NewInstancePeersGetNotFound() *InstancePeersGetNotFound { + return &InstancePeersGetNotFound{} +} + +/* +InstancePeersGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type InstancePeersGetNotFound struct { +} + +// IsSuccess returns true when this instance peers get not found response has a 2xx status code +func (o *InstancePeersGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get not found response has a 3xx status code +func (o *InstancePeersGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get not found response has a 4xx status code +func (o *InstancePeersGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get not found response has a 5xx status code +func (o *InstancePeersGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get not found response a status code equal to that given +func (o *InstancePeersGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the instance peers get not found response +func (o *InstancePeersGetNotFound) Code() int { + return 404 +} + +func (o *InstancePeersGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotFound", 404) +} + +func (o *InstancePeersGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotFound", 404) +} + +func (o *InstancePeersGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetNotAcceptable creates a InstancePeersGetNotAcceptable with default headers values +func NewInstancePeersGetNotAcceptable() *InstancePeersGetNotAcceptable { + return &InstancePeersGetNotAcceptable{} +} + +/* +InstancePeersGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstancePeersGetNotAcceptable struct { +} + +// IsSuccess returns true when this instance peers get not acceptable response has a 2xx status code +func (o *InstancePeersGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get not acceptable response has a 3xx status code +func (o *InstancePeersGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get not acceptable response has a 4xx status code +func (o *InstancePeersGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance peers get not acceptable response has a 5xx status code +func (o *InstancePeersGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance peers get not acceptable response a status code equal to that given +func (o *InstancePeersGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance peers get not acceptable response +func (o *InstancePeersGetNotAcceptable) Code() int { + return 406 +} + +func (o *InstancePeersGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotAcceptable", 406) +} + +func (o *InstancePeersGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetNotAcceptable", 406) +} + +func (o *InstancePeersGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstancePeersGetInternalServerError creates a InstancePeersGetInternalServerError with default headers values +func NewInstancePeersGetInternalServerError() *InstancePeersGetInternalServerError { + return &InstancePeersGetInternalServerError{} +} + +/* +InstancePeersGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type InstancePeersGetInternalServerError struct { +} + +// IsSuccess returns true when this instance peers get internal server error response has a 2xx status code +func (o *InstancePeersGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance peers get internal server error response has a 3xx status code +func (o *InstancePeersGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance peers get internal server error response has a 4xx status code +func (o *InstancePeersGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance peers get internal server error response has a 5xx status code +func (o *InstancePeersGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance peers get internal server error response a status code equal to that given +func (o *InstancePeersGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance peers get internal server error response +func (o *InstancePeersGetInternalServerError) Code() int { + return 500 +} + +func (o *InstancePeersGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetInternalServerError", 500) +} + +func (o *InstancePeersGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/instance/peers][%d] instancePeersGetInternalServerError", 500) +} + +func (o *InstancePeersGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/instance/instance_update_parameters.go b/client/instance/instance_update_parameters.go new file mode 100644 index 0000000..5b1ffbc --- /dev/null +++ b/client/instance/instance_update_parameters.go @@ -0,0 +1,359 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewInstanceUpdateParams creates a new InstanceUpdateParams 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 NewInstanceUpdateParams() *InstanceUpdateParams { + return &InstanceUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewInstanceUpdateParamsWithTimeout creates a new InstanceUpdateParams object +// with the ability to set a timeout on a request. +func NewInstanceUpdateParamsWithTimeout(timeout time.Duration) *InstanceUpdateParams { + return &InstanceUpdateParams{ + timeout: timeout, + } +} + +// NewInstanceUpdateParamsWithContext creates a new InstanceUpdateParams object +// with the ability to set a context for a request. +func NewInstanceUpdateParamsWithContext(ctx context.Context) *InstanceUpdateParams { + return &InstanceUpdateParams{ + Context: ctx, + } +} + +// NewInstanceUpdateParamsWithHTTPClient creates a new InstanceUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewInstanceUpdateParamsWithHTTPClient(client *http.Client) *InstanceUpdateParams { + return &InstanceUpdateParams{ + HTTPClient: client, + } +} + +/* +InstanceUpdateParams contains all the parameters to send to the API endpoint + + for the instance update operation. + + Typically these are written to a http.Request. +*/ +type InstanceUpdateParams struct { + + /* ContactEmail. + + Email address to use as the instance contact. + */ + ContactEmail string + + /* ContactUsername. + + Username of the contact account. This must be the username of an instance admin. + */ + ContactUsername string + + /* Description. + + Longer description of the instance. + */ + Description string + + /* Header. + + Header image to use for the instance. + */ + Header runtime.NamedReadCloser + + /* ShortDescription. + + Short description of the instance. + */ + ShortDescription string + + /* Terms. + + Terms and conditions of the instance. + */ + Terms string + + /* Thumbnail. + + Thumbnail image to use for the instance. + */ + Thumbnail runtime.NamedReadCloser + + /* ThumbnailDescription. + + Image description of the submitted instance thumbnail. + */ + ThumbnailDescription *string + + /* Title. + + Title to use for the instance. + */ + Title string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceUpdateParams) WithDefaults() *InstanceUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the instance update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *InstanceUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the instance update params +func (o *InstanceUpdateParams) WithTimeout(timeout time.Duration) *InstanceUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the instance update params +func (o *InstanceUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the instance update params +func (o *InstanceUpdateParams) WithContext(ctx context.Context) *InstanceUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the instance update params +func (o *InstanceUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the instance update params +func (o *InstanceUpdateParams) WithHTTPClient(client *http.Client) *InstanceUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the instance update params +func (o *InstanceUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContactEmail adds the contactEmail to the instance update params +func (o *InstanceUpdateParams) WithContactEmail(contactEmail string) *InstanceUpdateParams { + o.SetContactEmail(contactEmail) + return o +} + +// SetContactEmail adds the contactEmail to the instance update params +func (o *InstanceUpdateParams) SetContactEmail(contactEmail string) { + o.ContactEmail = contactEmail +} + +// WithContactUsername adds the contactUsername to the instance update params +func (o *InstanceUpdateParams) WithContactUsername(contactUsername string) *InstanceUpdateParams { + o.SetContactUsername(contactUsername) + return o +} + +// SetContactUsername adds the contactUsername to the instance update params +func (o *InstanceUpdateParams) SetContactUsername(contactUsername string) { + o.ContactUsername = contactUsername +} + +// WithDescription adds the description to the instance update params +func (o *InstanceUpdateParams) WithDescription(description string) *InstanceUpdateParams { + o.SetDescription(description) + return o +} + +// SetDescription adds the description to the instance update params +func (o *InstanceUpdateParams) SetDescription(description string) { + o.Description = description +} + +// WithHeader adds the header to the instance update params +func (o *InstanceUpdateParams) WithHeader(header runtime.NamedReadCloser) *InstanceUpdateParams { + o.SetHeader(header) + return o +} + +// SetHeader adds the header to the instance update params +func (o *InstanceUpdateParams) SetHeader(header runtime.NamedReadCloser) { + o.Header = header +} + +// WithShortDescription adds the shortDescription to the instance update params +func (o *InstanceUpdateParams) WithShortDescription(shortDescription string) *InstanceUpdateParams { + o.SetShortDescription(shortDescription) + return o +} + +// SetShortDescription adds the shortDescription to the instance update params +func (o *InstanceUpdateParams) SetShortDescription(shortDescription string) { + o.ShortDescription = shortDescription +} + +// WithTerms adds the terms to the instance update params +func (o *InstanceUpdateParams) WithTerms(terms string) *InstanceUpdateParams { + o.SetTerms(terms) + return o +} + +// SetTerms adds the terms to the instance update params +func (o *InstanceUpdateParams) SetTerms(terms string) { + o.Terms = terms +} + +// WithThumbnail adds the thumbnail to the instance update params +func (o *InstanceUpdateParams) WithThumbnail(thumbnail runtime.NamedReadCloser) *InstanceUpdateParams { + o.SetThumbnail(thumbnail) + return o +} + +// SetThumbnail adds the thumbnail to the instance update params +func (o *InstanceUpdateParams) SetThumbnail(thumbnail runtime.NamedReadCloser) { + o.Thumbnail = thumbnail +} + +// WithThumbnailDescription adds the thumbnailDescription to the instance update params +func (o *InstanceUpdateParams) WithThumbnailDescription(thumbnailDescription *string) *InstanceUpdateParams { + o.SetThumbnailDescription(thumbnailDescription) + return o +} + +// SetThumbnailDescription adds the thumbnailDescription to the instance update params +func (o *InstanceUpdateParams) SetThumbnailDescription(thumbnailDescription *string) { + o.ThumbnailDescription = thumbnailDescription +} + +// WithTitle adds the title to the instance update params +func (o *InstanceUpdateParams) WithTitle(title string) *InstanceUpdateParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the instance update params +func (o *InstanceUpdateParams) SetTitle(title string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *InstanceUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param contact_email + frContactEmail := o.ContactEmail + fContactEmail := frContactEmail + if err := r.SetFormParam("contact_email", fContactEmail); err != nil { + return err + } + + // form param contact_username + frContactUsername := o.ContactUsername + fContactUsername := frContactUsername + if err := r.SetFormParam("contact_username", fContactUsername); err != nil { + return err + } + + // form param description + frDescription := o.Description + fDescription := frDescription + if err := r.SetFormParam("description", fDescription); err != nil { + return err + } + + if o.Header != nil { + + if o.Header != nil { + // form file param header + if err := r.SetFileParam("header", o.Header); err != nil { + return err + } + } + } + + // form param short_description + frShortDescription := o.ShortDescription + fShortDescription := frShortDescription + if err := r.SetFormParam("short_description", fShortDescription); err != nil { + return err + } + + // form param terms + frTerms := o.Terms + fTerms := frTerms + if err := r.SetFormParam("terms", fTerms); err != nil { + return err + } + + if o.Thumbnail != nil { + + if o.Thumbnail != nil { + // form file param thumbnail + if err := r.SetFileParam("thumbnail", o.Thumbnail); err != nil { + return err + } + } + } + + if o.ThumbnailDescription != nil { + + // form param thumbnail_description + var frThumbnailDescription string + if o.ThumbnailDescription != nil { + frThumbnailDescription = *o.ThumbnailDescription + } + fThumbnailDescription := frThumbnailDescription + if fThumbnailDescription != "" { + if err := r.SetFormParam("thumbnail_description", fThumbnailDescription); err != nil { + return err + } + } + } + + // form param title + frTitle := o.Title + fTitle := frTitle + if err := r.SetFormParam("title", fTitle); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instance/instance_update_responses.go b/client/instance/instance_update_responses.go new file mode 100644 index 0000000..d2dc250 --- /dev/null +++ b/client/instance/instance_update_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// InstanceUpdateReader is a Reader for the InstanceUpdate structure. +type InstanceUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *InstanceUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewInstanceUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewInstanceUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewInstanceUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewInstanceUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewInstanceUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewInstanceUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewInstanceUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/instance] instanceUpdate", response, response.Code()) + } +} + +// NewInstanceUpdateOK creates a InstanceUpdateOK with default headers values +func NewInstanceUpdateOK() *InstanceUpdateOK { + return &InstanceUpdateOK{} +} + +/* +InstanceUpdateOK describes a response with status code 200, with default header values. + +The newly updated instance. +*/ +type InstanceUpdateOK struct { + Payload *models.InstanceV1 +} + +// IsSuccess returns true when this instance update o k response has a 2xx status code +func (o *InstanceUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this instance update o k response has a 3xx status code +func (o *InstanceUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update o k response has a 4xx status code +func (o *InstanceUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance update o k response has a 5xx status code +func (o *InstanceUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update o k response a status code equal to that given +func (o *InstanceUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the instance update o k response +func (o *InstanceUpdateOK) Code() int { + return 200 +} + +func (o *InstanceUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateOK %s", 200, payload) +} + +func (o *InstanceUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateOK %s", 200, payload) +} + +func (o *InstanceUpdateOK) GetPayload() *models.InstanceV1 { + return o.Payload +} + +func (o *InstanceUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.InstanceV1) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewInstanceUpdateBadRequest creates a InstanceUpdateBadRequest with default headers values +func NewInstanceUpdateBadRequest() *InstanceUpdateBadRequest { + return &InstanceUpdateBadRequest{} +} + +/* +InstanceUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type InstanceUpdateBadRequest struct { +} + +// IsSuccess returns true when this instance update bad request response has a 2xx status code +func (o *InstanceUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update bad request response has a 3xx status code +func (o *InstanceUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update bad request response has a 4xx status code +func (o *InstanceUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update bad request response has a 5xx status code +func (o *InstanceUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update bad request response a status code equal to that given +func (o *InstanceUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the instance update bad request response +func (o *InstanceUpdateBadRequest) Code() int { + return 400 +} + +func (o *InstanceUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateBadRequest", 400) +} + +func (o *InstanceUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateBadRequest", 400) +} + +func (o *InstanceUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateUnauthorized creates a InstanceUpdateUnauthorized with default headers values +func NewInstanceUpdateUnauthorized() *InstanceUpdateUnauthorized { + return &InstanceUpdateUnauthorized{} +} + +/* +InstanceUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type InstanceUpdateUnauthorized struct { +} + +// IsSuccess returns true when this instance update unauthorized response has a 2xx status code +func (o *InstanceUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update unauthorized response has a 3xx status code +func (o *InstanceUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update unauthorized response has a 4xx status code +func (o *InstanceUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update unauthorized response has a 5xx status code +func (o *InstanceUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update unauthorized response a status code equal to that given +func (o *InstanceUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the instance update unauthorized response +func (o *InstanceUpdateUnauthorized) Code() int { + return 401 +} + +func (o *InstanceUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateUnauthorized", 401) +} + +func (o *InstanceUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateUnauthorized", 401) +} + +func (o *InstanceUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateForbidden creates a InstanceUpdateForbidden with default headers values +func NewInstanceUpdateForbidden() *InstanceUpdateForbidden { + return &InstanceUpdateForbidden{} +} + +/* +InstanceUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type InstanceUpdateForbidden struct { +} + +// IsSuccess returns true when this instance update forbidden response has a 2xx status code +func (o *InstanceUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update forbidden response has a 3xx status code +func (o *InstanceUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update forbidden response has a 4xx status code +func (o *InstanceUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update forbidden response has a 5xx status code +func (o *InstanceUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update forbidden response a status code equal to that given +func (o *InstanceUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the instance update forbidden response +func (o *InstanceUpdateForbidden) Code() int { + return 403 +} + +func (o *InstanceUpdateForbidden) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateForbidden", 403) +} + +func (o *InstanceUpdateForbidden) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateForbidden", 403) +} + +func (o *InstanceUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateNotFound creates a InstanceUpdateNotFound with default headers values +func NewInstanceUpdateNotFound() *InstanceUpdateNotFound { + return &InstanceUpdateNotFound{} +} + +/* +InstanceUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type InstanceUpdateNotFound struct { +} + +// IsSuccess returns true when this instance update not found response has a 2xx status code +func (o *InstanceUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update not found response has a 3xx status code +func (o *InstanceUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update not found response has a 4xx status code +func (o *InstanceUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update not found response has a 5xx status code +func (o *InstanceUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update not found response a status code equal to that given +func (o *InstanceUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the instance update not found response +func (o *InstanceUpdateNotFound) Code() int { + return 404 +} + +func (o *InstanceUpdateNotFound) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotFound", 404) +} + +func (o *InstanceUpdateNotFound) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotFound", 404) +} + +func (o *InstanceUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateNotAcceptable creates a InstanceUpdateNotAcceptable with default headers values +func NewInstanceUpdateNotAcceptable() *InstanceUpdateNotAcceptable { + return &InstanceUpdateNotAcceptable{} +} + +/* +InstanceUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type InstanceUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this instance update not acceptable response has a 2xx status code +func (o *InstanceUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update not acceptable response has a 3xx status code +func (o *InstanceUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update not acceptable response has a 4xx status code +func (o *InstanceUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this instance update not acceptable response has a 5xx status code +func (o *InstanceUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this instance update not acceptable response a status code equal to that given +func (o *InstanceUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the instance update not acceptable response +func (o *InstanceUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *InstanceUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotAcceptable", 406) +} + +func (o *InstanceUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateNotAcceptable", 406) +} + +func (o *InstanceUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewInstanceUpdateInternalServerError creates a InstanceUpdateInternalServerError with default headers values +func NewInstanceUpdateInternalServerError() *InstanceUpdateInternalServerError { + return &InstanceUpdateInternalServerError{} +} + +/* +InstanceUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type InstanceUpdateInternalServerError struct { +} + +// IsSuccess returns true when this instance update internal server error response has a 2xx status code +func (o *InstanceUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this instance update internal server error response has a 3xx status code +func (o *InstanceUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this instance update internal server error response has a 4xx status code +func (o *InstanceUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this instance update internal server error response has a 5xx status code +func (o *InstanceUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this instance update internal server error response a status code equal to that given +func (o *InstanceUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the instance update internal server error response +func (o *InstanceUpdateInternalServerError) Code() int { + return 500 +} + +func (o *InstanceUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateInternalServerError", 500) +} + +func (o *InstanceUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/instance][%d] instanceUpdateInternalServerError", 500) +} + +func (o *InstanceUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/instance/rules_parameters.go b/client/instance/rules_parameters.go new file mode 100644 index 0000000..374afc9 --- /dev/null +++ b/client/instance/rules_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// 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" +) + +// NewRulesParams creates a new RulesParams 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 NewRulesParams() *RulesParams { + return &RulesParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRulesParamsWithTimeout creates a new RulesParams object +// with the ability to set a timeout on a request. +func NewRulesParamsWithTimeout(timeout time.Duration) *RulesParams { + return &RulesParams{ + timeout: timeout, + } +} + +// NewRulesParamsWithContext creates a new RulesParams object +// with the ability to set a context for a request. +func NewRulesParamsWithContext(ctx context.Context) *RulesParams { + return &RulesParams{ + Context: ctx, + } +} + +// NewRulesParamsWithHTTPClient creates a new RulesParams object +// with the ability to set a custom HTTPClient for a request. +func NewRulesParamsWithHTTPClient(client *http.Client) *RulesParams { + return &RulesParams{ + HTTPClient: client, + } +} + +/* +RulesParams contains all the parameters to send to the API endpoint + + for the rules operation. + + Typically these are written to a http.Request. +*/ +type RulesParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RulesParams) WithDefaults() *RulesParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the rules params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RulesParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the rules params +func (o *RulesParams) WithTimeout(timeout time.Duration) *RulesParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the rules params +func (o *RulesParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the rules params +func (o *RulesParams) WithContext(ctx context.Context) *RulesParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the rules params +func (o *RulesParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the rules params +func (o *RulesParams) WithHTTPClient(client *http.Client) *RulesParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the rules params +func (o *RulesParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *RulesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/instance/rules_responses.go b/client/instance/rules_responses.go new file mode 100644 index 0000000..9d293de --- /dev/null +++ b/client/instance/rules_responses.go @@ -0,0 +1,352 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package instance + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// RulesReader is a Reader for the Rules structure. +type RulesReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RulesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRulesOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRulesBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRulesNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRulesNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRulesInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/instance/rules] rules", response, response.Code()) + } +} + +// NewRulesOK creates a RulesOK with default headers values +func NewRulesOK() *RulesOK { + return &RulesOK{} +} + +/* +RulesOK describes a response with status code 200, with default header values. + +An array with all the rules for the local instance. +*/ +type RulesOK struct { + Payload []*models.InstanceRule +} + +// IsSuccess returns true when this rules o k response has a 2xx status code +func (o *RulesOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this rules o k response has a 3xx status code +func (o *RulesOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules o k response has a 4xx status code +func (o *RulesOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this rules o k response has a 5xx status code +func (o *RulesOK) IsServerError() bool { + return false +} + +// IsCode returns true when this rules o k response a status code equal to that given +func (o *RulesOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the rules o k response +func (o *RulesOK) Code() int { + return 200 +} + +func (o *RulesOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesOK %s", 200, payload) +} + +func (o *RulesOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesOK %s", 200, payload) +} + +func (o *RulesOK) GetPayload() []*models.InstanceRule { + return o.Payload +} + +func (o *RulesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewRulesBadRequest creates a RulesBadRequest with default headers values +func NewRulesBadRequest() *RulesBadRequest { + return &RulesBadRequest{} +} + +/* +RulesBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RulesBadRequest struct { +} + +// IsSuccess returns true when this rules bad request response has a 2xx status code +func (o *RulesBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules bad request response has a 3xx status code +func (o *RulesBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules bad request response has a 4xx status code +func (o *RulesBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this rules bad request response has a 5xx status code +func (o *RulesBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this rules bad request response a status code equal to that given +func (o *RulesBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the rules bad request response +func (o *RulesBadRequest) Code() int { + return 400 +} + +func (o *RulesBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesBadRequest", 400) +} + +func (o *RulesBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesBadRequest", 400) +} + +func (o *RulesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRulesNotFound creates a RulesNotFound with default headers values +func NewRulesNotFound() *RulesNotFound { + return &RulesNotFound{} +} + +/* +RulesNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RulesNotFound struct { +} + +// IsSuccess returns true when this rules not found response has a 2xx status code +func (o *RulesNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules not found response has a 3xx status code +func (o *RulesNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules not found response has a 4xx status code +func (o *RulesNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this rules not found response has a 5xx status code +func (o *RulesNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this rules not found response a status code equal to that given +func (o *RulesNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the rules not found response +func (o *RulesNotFound) Code() int { + return 404 +} + +func (o *RulesNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotFound", 404) +} + +func (o *RulesNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotFound", 404) +} + +func (o *RulesNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRulesNotAcceptable creates a RulesNotAcceptable with default headers values +func NewRulesNotAcceptable() *RulesNotAcceptable { + return &RulesNotAcceptable{} +} + +/* +RulesNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RulesNotAcceptable struct { +} + +// IsSuccess returns true when this rules not acceptable response has a 2xx status code +func (o *RulesNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules not acceptable response has a 3xx status code +func (o *RulesNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules not acceptable response has a 4xx status code +func (o *RulesNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this rules not acceptable response has a 5xx status code +func (o *RulesNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this rules not acceptable response a status code equal to that given +func (o *RulesNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the rules not acceptable response +func (o *RulesNotAcceptable) Code() int { + return 406 +} + +func (o *RulesNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotAcceptable", 406) +} + +func (o *RulesNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesNotAcceptable", 406) +} + +func (o *RulesNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRulesInternalServerError creates a RulesInternalServerError with default headers values +func NewRulesInternalServerError() *RulesInternalServerError { + return &RulesInternalServerError{} +} + +/* +RulesInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RulesInternalServerError struct { +} + +// IsSuccess returns true when this rules internal server error response has a 2xx status code +func (o *RulesInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this rules internal server error response has a 3xx status code +func (o *RulesInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this rules internal server error response has a 4xx status code +func (o *RulesInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this rules internal server error response has a 5xx status code +func (o *RulesInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this rules internal server error response a status code equal to that given +func (o *RulesInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the rules internal server error response +func (o *RulesInternalServerError) Code() int { + return 500 +} + +func (o *RulesInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesInternalServerError", 500) +} + +func (o *RulesInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/instance/rules][%d] rulesInternalServerError", 500) +} + +func (o *RulesInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/interaction_policies/interaction_policies_client.go b/client/interaction_policies/interaction_policies_client.go new file mode 100644 index 0000000..6fd58d6 --- /dev/null +++ b/client/interaction_policies/interaction_policies_client.go @@ -0,0 +1,196 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new interaction policies API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new interaction policies API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new interaction policies API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for interaction policies API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + PoliciesDefaultsGet(params *PoliciesDefaultsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsGetOK, error) + + PoliciesDefaultsUpdate(params *PoliciesDefaultsUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsUpdateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +PoliciesDefaultsGet gets default interaction policies for new statuses created by you +*/ +func (a *Client) PoliciesDefaultsGet(params *PoliciesDefaultsGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPoliciesDefaultsGetParams() + } + op := &runtime.ClientOperation{ + ID: "policiesDefaultsGet", + Method: "GET", + PathPattern: "/api/v1/interaction_policies/defaults", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PoliciesDefaultsGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PoliciesDefaultsGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for policiesDefaultsGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PoliciesDefaultsUpdate updates default interaction policies per visibility level for new statuses created by you + + If submitting using form data, use the following pattern: + +`VISIBILITY[INTERACTION_TYPE][CONDITION][INDEX]=Value` + +For example: `public[can_reply][always][0]=author` + +Using `curl` this might look something like: + +`curl -F 'public[can_reply][always][0]=author' -F 'public[can_reply][always][1]=followers'` + +The JSON equivalent would be: + +`curl -H 'Content-Type: application/json' -d '{"public":{"can_reply":{"always":["author","followers"]}}}'` + +Any visibility level left unspecified in the request body will be returned to the default. + +Ie., in the example above, "public" would be updated, but "unlisted", "private", and "direct" would be reset to defaults. + +The server will perform some normalization on submitted policies so that you can't submit totally invalid policies. +*/ +func (a *Client) PoliciesDefaultsUpdate(params *PoliciesDefaultsUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PoliciesDefaultsUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPoliciesDefaultsUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "policiesDefaultsUpdate", + Method: "PATCH", + PathPattern: "/api/v1/interaction_policies/defaults", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data", "application/x-www-form-urlencoded", "application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PoliciesDefaultsUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PoliciesDefaultsUpdateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for policiesDefaultsUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/interaction_policies/policies_defaults_get_parameters.go b/client/interaction_policies/policies_defaults_get_parameters.go new file mode 100644 index 0000000..2048c0e --- /dev/null +++ b/client/interaction_policies/policies_defaults_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// 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" +) + +// NewPoliciesDefaultsGetParams creates a new PoliciesDefaultsGetParams 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 NewPoliciesDefaultsGetParams() *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPoliciesDefaultsGetParamsWithTimeout creates a new PoliciesDefaultsGetParams object +// with the ability to set a timeout on a request. +func NewPoliciesDefaultsGetParamsWithTimeout(timeout time.Duration) *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + timeout: timeout, + } +} + +// NewPoliciesDefaultsGetParamsWithContext creates a new PoliciesDefaultsGetParams object +// with the ability to set a context for a request. +func NewPoliciesDefaultsGetParamsWithContext(ctx context.Context) *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + Context: ctx, + } +} + +// NewPoliciesDefaultsGetParamsWithHTTPClient creates a new PoliciesDefaultsGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPoliciesDefaultsGetParamsWithHTTPClient(client *http.Client) *PoliciesDefaultsGetParams { + return &PoliciesDefaultsGetParams{ + HTTPClient: client, + } +} + +/* +PoliciesDefaultsGetParams contains all the parameters to send to the API endpoint + + for the policies defaults get operation. + + Typically these are written to a http.Request. +*/ +type PoliciesDefaultsGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the policies defaults get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsGetParams) WithDefaults() *PoliciesDefaultsGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the policies defaults get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the policies defaults get params +func (o *PoliciesDefaultsGetParams) WithTimeout(timeout time.Duration) *PoliciesDefaultsGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the policies defaults get params +func (o *PoliciesDefaultsGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the policies defaults get params +func (o *PoliciesDefaultsGetParams) WithContext(ctx context.Context) *PoliciesDefaultsGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the policies defaults get params +func (o *PoliciesDefaultsGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the policies defaults get params +func (o *PoliciesDefaultsGetParams) WithHTTPClient(client *http.Client) *PoliciesDefaultsGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the policies defaults get params +func (o *PoliciesDefaultsGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *PoliciesDefaultsGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/interaction_policies/policies_defaults_get_responses.go b/client/interaction_policies/policies_defaults_get_responses.go new file mode 100644 index 0000000..cdc5f74 --- /dev/null +++ b/client/interaction_policies/policies_defaults_get_responses.go @@ -0,0 +1,292 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PoliciesDefaultsGetReader is a Reader for the PoliciesDefaultsGet structure. +type PoliciesDefaultsGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PoliciesDefaultsGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPoliciesDefaultsGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 401: + result := NewPoliciesDefaultsGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPoliciesDefaultsGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPoliciesDefaultsGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/interaction_policies/defaults] policiesDefaultsGet", response, response.Code()) + } +} + +// NewPoliciesDefaultsGetOK creates a PoliciesDefaultsGetOK with default headers values +func NewPoliciesDefaultsGetOK() *PoliciesDefaultsGetOK { + return &PoliciesDefaultsGetOK{} +} + +/* +PoliciesDefaultsGetOK describes a response with status code 200, with default header values. + +A default policies object containing a policy for each status visibility. +*/ +type PoliciesDefaultsGetOK struct { + Payload *models.DefaultPolicies +} + +// IsSuccess returns true when this policies defaults get o k response has a 2xx status code +func (o *PoliciesDefaultsGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this policies defaults get o k response has a 3xx status code +func (o *PoliciesDefaultsGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get o k response has a 4xx status code +func (o *PoliciesDefaultsGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults get o k response has a 5xx status code +func (o *PoliciesDefaultsGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults get o k response a status code equal to that given +func (o *PoliciesDefaultsGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the policies defaults get o k response +func (o *PoliciesDefaultsGetOK) Code() int { + return 200 +} + +func (o *PoliciesDefaultsGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetOK %s", 200, payload) +} + +func (o *PoliciesDefaultsGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetOK %s", 200, payload) +} + +func (o *PoliciesDefaultsGetOK) GetPayload() *models.DefaultPolicies { + return o.Payload +} + +func (o *PoliciesDefaultsGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DefaultPolicies) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPoliciesDefaultsGetUnauthorized creates a PoliciesDefaultsGetUnauthorized with default headers values +func NewPoliciesDefaultsGetUnauthorized() *PoliciesDefaultsGetUnauthorized { + return &PoliciesDefaultsGetUnauthorized{} +} + +/* +PoliciesDefaultsGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PoliciesDefaultsGetUnauthorized struct { +} + +// IsSuccess returns true when this policies defaults get unauthorized response has a 2xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults get unauthorized response has a 3xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get unauthorized response has a 4xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults get unauthorized response has a 5xx status code +func (o *PoliciesDefaultsGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults get unauthorized response a status code equal to that given +func (o *PoliciesDefaultsGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the policies defaults get unauthorized response +func (o *PoliciesDefaultsGetUnauthorized) Code() int { + return 401 +} + +func (o *PoliciesDefaultsGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetUnauthorized", 401) +} + +func (o *PoliciesDefaultsGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetUnauthorized", 401) +} + +func (o *PoliciesDefaultsGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsGetNotAcceptable creates a PoliciesDefaultsGetNotAcceptable with default headers values +func NewPoliciesDefaultsGetNotAcceptable() *PoliciesDefaultsGetNotAcceptable { + return &PoliciesDefaultsGetNotAcceptable{} +} + +/* +PoliciesDefaultsGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PoliciesDefaultsGetNotAcceptable struct { +} + +// IsSuccess returns true when this policies defaults get not acceptable response has a 2xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults get not acceptable response has a 3xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get not acceptable response has a 4xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults get not acceptable response has a 5xx status code +func (o *PoliciesDefaultsGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults get not acceptable response a status code equal to that given +func (o *PoliciesDefaultsGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the policies defaults get not acceptable response +func (o *PoliciesDefaultsGetNotAcceptable) Code() int { + return 406 +} + +func (o *PoliciesDefaultsGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetNotAcceptable", 406) +} + +func (o *PoliciesDefaultsGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetNotAcceptable", 406) +} + +func (o *PoliciesDefaultsGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsGetInternalServerError creates a PoliciesDefaultsGetInternalServerError with default headers values +func NewPoliciesDefaultsGetInternalServerError() *PoliciesDefaultsGetInternalServerError { + return &PoliciesDefaultsGetInternalServerError{} +} + +/* +PoliciesDefaultsGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PoliciesDefaultsGetInternalServerError struct { +} + +// IsSuccess returns true when this policies defaults get internal server error response has a 2xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults get internal server error response has a 3xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults get internal server error response has a 4xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults get internal server error response has a 5xx status code +func (o *PoliciesDefaultsGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this policies defaults get internal server error response a status code equal to that given +func (o *PoliciesDefaultsGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the policies defaults get internal server error response +func (o *PoliciesDefaultsGetInternalServerError) Code() int { + return 500 +} + +func (o *PoliciesDefaultsGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetInternalServerError", 500) +} + +func (o *PoliciesDefaultsGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/interaction_policies/defaults][%d] policiesDefaultsGetInternalServerError", 500) +} + +func (o *PoliciesDefaultsGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/interaction_policies/policies_defaults_update_parameters.go b/client/interaction_policies/policies_defaults_update_parameters.go new file mode 100644 index 0000000..a30d631 --- /dev/null +++ b/client/interaction_policies/policies_defaults_update_parameters.go @@ -0,0 +1,897 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// 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" +) + +// NewPoliciesDefaultsUpdateParams creates a new PoliciesDefaultsUpdateParams 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 NewPoliciesDefaultsUpdateParams() *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPoliciesDefaultsUpdateParamsWithTimeout creates a new PoliciesDefaultsUpdateParams object +// with the ability to set a timeout on a request. +func NewPoliciesDefaultsUpdateParamsWithTimeout(timeout time.Duration) *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + timeout: timeout, + } +} + +// NewPoliciesDefaultsUpdateParamsWithContext creates a new PoliciesDefaultsUpdateParams object +// with the ability to set a context for a request. +func NewPoliciesDefaultsUpdateParamsWithContext(ctx context.Context) *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + Context: ctx, + } +} + +// NewPoliciesDefaultsUpdateParamsWithHTTPClient creates a new PoliciesDefaultsUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewPoliciesDefaultsUpdateParamsWithHTTPClient(client *http.Client) *PoliciesDefaultsUpdateParams { + return &PoliciesDefaultsUpdateParams{ + HTTPClient: client, + } +} + +/* +PoliciesDefaultsUpdateParams contains all the parameters to send to the API endpoint + + for the policies defaults update operation. + + Typically these are written to a http.Request. +*/ +type PoliciesDefaultsUpdateParams struct { + + /* DirectCanFavouriteAlways0. + + Nth entry for direct.can_favourite.always. + */ + DirectCanFavouriteAlways0 *string + + /* DirectCanFavouriteWithApproval0. + + Nth entry for direct.can_favourite.with_approval. + */ + DirectCanFavouriteWithApproval0 *string + + /* DirectCanReblogAlways0. + + Nth entry for direct.can_reblog.always. + */ + DirectCanReblogAlways0 *string + + /* DirectCanReblogWithApproval0. + + Nth entry for direct.can_reblog.with_approval. + */ + DirectCanReblogWithApproval0 *string + + /* DirectCanReplyAlways0. + + Nth entry for direct.can_reply.always. + */ + DirectCanReplyAlways0 *string + + /* DirectCanReplyWithApproval0. + + Nth entry for direct.can_reply.with_approval. + */ + DirectCanReplyWithApproval0 *string + + /* PrivateCanFavouriteAlways0. + + Nth entry for private.can_favourite.always. + */ + PrivateCanFavouriteAlways0 *string + + /* PrivateCanFavouriteWithApproval0. + + Nth entry for private.can_favourite.with_approval. + */ + PrivateCanFavouriteWithApproval0 *string + + /* PrivateCanReblogAlways0. + + Nth entry for private.can_reblog.always. + */ + PrivateCanReblogAlways0 *string + + /* PrivateCanReblogWithApproval0. + + Nth entry for private.can_reblog.with_approval. + */ + PrivateCanReblogWithApproval0 *string + + /* PrivateCanReplyAlways0. + + Nth entry for private.can_reply.always. + */ + PrivateCanReplyAlways0 *string + + /* PrivateCanReplyWithApproval0. + + Nth entry for private.can_reply.with_approval. + */ + PrivateCanReplyWithApproval0 *string + + /* PublicCanFavouriteAlways0. + + Nth entry for public.can_favourite.always. + */ + PublicCanFavouriteAlways0 *string + + /* PublicCanFavouriteWithApproval0. + + Nth entry for public.can_favourite.with_approval. + */ + PublicCanFavouriteWithApproval0 *string + + /* PublicCanReblogAlways0. + + Nth entry for public.can_reblog.always. + */ + PublicCanReblogAlways0 *string + + /* PublicCanReblogWithApproval0. + + Nth entry for public.can_reblog.with_approval. + */ + PublicCanReblogWithApproval0 *string + + /* PublicCanReplyAlways0. + + Nth entry for public.can_reply.always. + */ + PublicCanReplyAlways0 *string + + /* PublicCanReplyWithApproval0. + + Nth entry for public.can_reply.with_approval. + */ + PublicCanReplyWithApproval0 *string + + /* UnlistedCanFavouriteAlways0. + + Nth entry for unlisted.can_favourite.always. + */ + UnlistedCanFavouriteAlways0 *string + + /* UnlistedCanFavouriteWithApproval0. + + Nth entry for unlisted.can_favourite.with_approval. + */ + UnlistedCanFavouriteWithApproval0 *string + + /* UnlistedCanReblogAlways0. + + Nth entry for unlisted.can_reblog.always. + */ + UnlistedCanReblogAlways0 *string + + /* UnlistedCanReblogWithApproval0. + + Nth entry for unlisted.can_reblog.with_approval. + */ + UnlistedCanReblogWithApproval0 *string + + /* UnlistedCanReplyAlways0. + + Nth entry for unlisted.can_reply.always. + */ + UnlistedCanReplyAlways0 *string + + /* UnlistedCanReplyWithApproval0. + + Nth entry for unlisted.can_reply.with_approval. + */ + UnlistedCanReplyWithApproval0 *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the policies defaults update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsUpdateParams) WithDefaults() *PoliciesDefaultsUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the policies defaults update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PoliciesDefaultsUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithTimeout(timeout time.Duration) *PoliciesDefaultsUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithContext(ctx context.Context) *PoliciesDefaultsUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithHTTPClient(client *http.Client) *PoliciesDefaultsUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithDirectCanFavouriteAlways0 adds the directCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanFavouriteAlways0(directCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanFavouriteAlways0(directCanFavouriteAlways0) + return o +} + +// SetDirectCanFavouriteAlways0 adds the directCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanFavouriteAlways0(directCanFavouriteAlways0 *string) { + o.DirectCanFavouriteAlways0 = directCanFavouriteAlways0 +} + +// WithDirectCanFavouriteWithApproval0 adds the directCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanFavouriteWithApproval0(directCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanFavouriteWithApproval0(directCanFavouriteWithApproval0) + return o +} + +// SetDirectCanFavouriteWithApproval0 adds the directCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanFavouriteWithApproval0(directCanFavouriteWithApproval0 *string) { + o.DirectCanFavouriteWithApproval0 = directCanFavouriteWithApproval0 +} + +// WithDirectCanReblogAlways0 adds the directCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReblogAlways0(directCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReblogAlways0(directCanReblogAlways0) + return o +} + +// SetDirectCanReblogAlways0 adds the directCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReblogAlways0(directCanReblogAlways0 *string) { + o.DirectCanReblogAlways0 = directCanReblogAlways0 +} + +// WithDirectCanReblogWithApproval0 adds the directCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReblogWithApproval0(directCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReblogWithApproval0(directCanReblogWithApproval0) + return o +} + +// SetDirectCanReblogWithApproval0 adds the directCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReblogWithApproval0(directCanReblogWithApproval0 *string) { + o.DirectCanReblogWithApproval0 = directCanReblogWithApproval0 +} + +// WithDirectCanReplyAlways0 adds the directCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReplyAlways0(directCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReplyAlways0(directCanReplyAlways0) + return o +} + +// SetDirectCanReplyAlways0 adds the directCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReplyAlways0(directCanReplyAlways0 *string) { + o.DirectCanReplyAlways0 = directCanReplyAlways0 +} + +// WithDirectCanReplyWithApproval0 adds the directCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithDirectCanReplyWithApproval0(directCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetDirectCanReplyWithApproval0(directCanReplyWithApproval0) + return o +} + +// SetDirectCanReplyWithApproval0 adds the directCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetDirectCanReplyWithApproval0(directCanReplyWithApproval0 *string) { + o.DirectCanReplyWithApproval0 = directCanReplyWithApproval0 +} + +// WithPrivateCanFavouriteAlways0 adds the privateCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanFavouriteAlways0(privateCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanFavouriteAlways0(privateCanFavouriteAlways0) + return o +} + +// SetPrivateCanFavouriteAlways0 adds the privateCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanFavouriteAlways0(privateCanFavouriteAlways0 *string) { + o.PrivateCanFavouriteAlways0 = privateCanFavouriteAlways0 +} + +// WithPrivateCanFavouriteWithApproval0 adds the privateCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanFavouriteWithApproval0(privateCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanFavouriteWithApproval0(privateCanFavouriteWithApproval0) + return o +} + +// SetPrivateCanFavouriteWithApproval0 adds the privateCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanFavouriteWithApproval0(privateCanFavouriteWithApproval0 *string) { + o.PrivateCanFavouriteWithApproval0 = privateCanFavouriteWithApproval0 +} + +// WithPrivateCanReblogAlways0 adds the privateCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReblogAlways0(privateCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReblogAlways0(privateCanReblogAlways0) + return o +} + +// SetPrivateCanReblogAlways0 adds the privateCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReblogAlways0(privateCanReblogAlways0 *string) { + o.PrivateCanReblogAlways0 = privateCanReblogAlways0 +} + +// WithPrivateCanReblogWithApproval0 adds the privateCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReblogWithApproval0(privateCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReblogWithApproval0(privateCanReblogWithApproval0) + return o +} + +// SetPrivateCanReblogWithApproval0 adds the privateCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReblogWithApproval0(privateCanReblogWithApproval0 *string) { + o.PrivateCanReblogWithApproval0 = privateCanReblogWithApproval0 +} + +// WithPrivateCanReplyAlways0 adds the privateCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReplyAlways0(privateCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReplyAlways0(privateCanReplyAlways0) + return o +} + +// SetPrivateCanReplyAlways0 adds the privateCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReplyAlways0(privateCanReplyAlways0 *string) { + o.PrivateCanReplyAlways0 = privateCanReplyAlways0 +} + +// WithPrivateCanReplyWithApproval0 adds the privateCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPrivateCanReplyWithApproval0(privateCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPrivateCanReplyWithApproval0(privateCanReplyWithApproval0) + return o +} + +// SetPrivateCanReplyWithApproval0 adds the privateCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPrivateCanReplyWithApproval0(privateCanReplyWithApproval0 *string) { + o.PrivateCanReplyWithApproval0 = privateCanReplyWithApproval0 +} + +// WithPublicCanFavouriteAlways0 adds the publicCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanFavouriteAlways0(publicCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanFavouriteAlways0(publicCanFavouriteAlways0) + return o +} + +// SetPublicCanFavouriteAlways0 adds the publicCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanFavouriteAlways0(publicCanFavouriteAlways0 *string) { + o.PublicCanFavouriteAlways0 = publicCanFavouriteAlways0 +} + +// WithPublicCanFavouriteWithApproval0 adds the publicCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanFavouriteWithApproval0(publicCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanFavouriteWithApproval0(publicCanFavouriteWithApproval0) + return o +} + +// SetPublicCanFavouriteWithApproval0 adds the publicCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanFavouriteWithApproval0(publicCanFavouriteWithApproval0 *string) { + o.PublicCanFavouriteWithApproval0 = publicCanFavouriteWithApproval0 +} + +// WithPublicCanReblogAlways0 adds the publicCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReblogAlways0(publicCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReblogAlways0(publicCanReblogAlways0) + return o +} + +// SetPublicCanReblogAlways0 adds the publicCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReblogAlways0(publicCanReblogAlways0 *string) { + o.PublicCanReblogAlways0 = publicCanReblogAlways0 +} + +// WithPublicCanReblogWithApproval0 adds the publicCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReblogWithApproval0(publicCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReblogWithApproval0(publicCanReblogWithApproval0) + return o +} + +// SetPublicCanReblogWithApproval0 adds the publicCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReblogWithApproval0(publicCanReblogWithApproval0 *string) { + o.PublicCanReblogWithApproval0 = publicCanReblogWithApproval0 +} + +// WithPublicCanReplyAlways0 adds the publicCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReplyAlways0(publicCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReplyAlways0(publicCanReplyAlways0) + return o +} + +// SetPublicCanReplyAlways0 adds the publicCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReplyAlways0(publicCanReplyAlways0 *string) { + o.PublicCanReplyAlways0 = publicCanReplyAlways0 +} + +// WithPublicCanReplyWithApproval0 adds the publicCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithPublicCanReplyWithApproval0(publicCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetPublicCanReplyWithApproval0(publicCanReplyWithApproval0) + return o +} + +// SetPublicCanReplyWithApproval0 adds the publicCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetPublicCanReplyWithApproval0(publicCanReplyWithApproval0 *string) { + o.PublicCanReplyWithApproval0 = publicCanReplyWithApproval0 +} + +// WithUnlistedCanFavouriteAlways0 adds the unlistedCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanFavouriteAlways0(unlistedCanFavouriteAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanFavouriteAlways0(unlistedCanFavouriteAlways0) + return o +} + +// SetUnlistedCanFavouriteAlways0 adds the unlistedCanFavouriteAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanFavouriteAlways0(unlistedCanFavouriteAlways0 *string) { + o.UnlistedCanFavouriteAlways0 = unlistedCanFavouriteAlways0 +} + +// WithUnlistedCanFavouriteWithApproval0 adds the unlistedCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanFavouriteWithApproval0(unlistedCanFavouriteWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanFavouriteWithApproval0(unlistedCanFavouriteWithApproval0) + return o +} + +// SetUnlistedCanFavouriteWithApproval0 adds the unlistedCanFavouriteWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanFavouriteWithApproval0(unlistedCanFavouriteWithApproval0 *string) { + o.UnlistedCanFavouriteWithApproval0 = unlistedCanFavouriteWithApproval0 +} + +// WithUnlistedCanReblogAlways0 adds the unlistedCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReblogAlways0(unlistedCanReblogAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReblogAlways0(unlistedCanReblogAlways0) + return o +} + +// SetUnlistedCanReblogAlways0 adds the unlistedCanReblogAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReblogAlways0(unlistedCanReblogAlways0 *string) { + o.UnlistedCanReblogAlways0 = unlistedCanReblogAlways0 +} + +// WithUnlistedCanReblogWithApproval0 adds the unlistedCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReblogWithApproval0(unlistedCanReblogWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReblogWithApproval0(unlistedCanReblogWithApproval0) + return o +} + +// SetUnlistedCanReblogWithApproval0 adds the unlistedCanReblogWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReblogWithApproval0(unlistedCanReblogWithApproval0 *string) { + o.UnlistedCanReblogWithApproval0 = unlistedCanReblogWithApproval0 +} + +// WithUnlistedCanReplyAlways0 adds the unlistedCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReplyAlways0(unlistedCanReplyAlways0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReplyAlways0(unlistedCanReplyAlways0) + return o +} + +// SetUnlistedCanReplyAlways0 adds the unlistedCanReplyAlways0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReplyAlways0(unlistedCanReplyAlways0 *string) { + o.UnlistedCanReplyAlways0 = unlistedCanReplyAlways0 +} + +// WithUnlistedCanReplyWithApproval0 adds the unlistedCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) WithUnlistedCanReplyWithApproval0(unlistedCanReplyWithApproval0 *string) *PoliciesDefaultsUpdateParams { + o.SetUnlistedCanReplyWithApproval0(unlistedCanReplyWithApproval0) + return o +} + +// SetUnlistedCanReplyWithApproval0 adds the unlistedCanReplyWithApproval0 to the policies defaults update params +func (o *PoliciesDefaultsUpdateParams) SetUnlistedCanReplyWithApproval0(unlistedCanReplyWithApproval0 *string) { + o.UnlistedCanReplyWithApproval0 = unlistedCanReplyWithApproval0 +} + +// WriteToRequest writes these params to a swagger request +func (o *PoliciesDefaultsUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.DirectCanFavouriteAlways0 != nil { + + // form param direct[can_favourite][always][0] + var frDirectCanFavouriteAlways0 string + if o.DirectCanFavouriteAlways0 != nil { + frDirectCanFavouriteAlways0 = *o.DirectCanFavouriteAlways0 + } + fDirectCanFavouriteAlways0 := frDirectCanFavouriteAlways0 + if fDirectCanFavouriteAlways0 != "" { + if err := r.SetFormParam("direct[can_favourite][always][0]", fDirectCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.DirectCanFavouriteWithApproval0 != nil { + + // form param direct[can_favourite][with_approval][0] + var frDirectCanFavouriteWithApproval0 string + if o.DirectCanFavouriteWithApproval0 != nil { + frDirectCanFavouriteWithApproval0 = *o.DirectCanFavouriteWithApproval0 + } + fDirectCanFavouriteWithApproval0 := frDirectCanFavouriteWithApproval0 + if fDirectCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("direct[can_favourite][with_approval][0]", fDirectCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.DirectCanReblogAlways0 != nil { + + // form param direct[can_reblog][always][0] + var frDirectCanReblogAlways0 string + if o.DirectCanReblogAlways0 != nil { + frDirectCanReblogAlways0 = *o.DirectCanReblogAlways0 + } + fDirectCanReblogAlways0 := frDirectCanReblogAlways0 + if fDirectCanReblogAlways0 != "" { + if err := r.SetFormParam("direct[can_reblog][always][0]", fDirectCanReblogAlways0); err != nil { + return err + } + } + } + + if o.DirectCanReblogWithApproval0 != nil { + + // form param direct[can_reblog][with_approval][0] + var frDirectCanReblogWithApproval0 string + if o.DirectCanReblogWithApproval0 != nil { + frDirectCanReblogWithApproval0 = *o.DirectCanReblogWithApproval0 + } + fDirectCanReblogWithApproval0 := frDirectCanReblogWithApproval0 + if fDirectCanReblogWithApproval0 != "" { + if err := r.SetFormParam("direct[can_reblog][with_approval][0]", fDirectCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.DirectCanReplyAlways0 != nil { + + // form param direct[can_reply][always][0] + var frDirectCanReplyAlways0 string + if o.DirectCanReplyAlways0 != nil { + frDirectCanReplyAlways0 = *o.DirectCanReplyAlways0 + } + fDirectCanReplyAlways0 := frDirectCanReplyAlways0 + if fDirectCanReplyAlways0 != "" { + if err := r.SetFormParam("direct[can_reply][always][0]", fDirectCanReplyAlways0); err != nil { + return err + } + } + } + + if o.DirectCanReplyWithApproval0 != nil { + + // form param direct[can_reply][with_approval][0] + var frDirectCanReplyWithApproval0 string + if o.DirectCanReplyWithApproval0 != nil { + frDirectCanReplyWithApproval0 = *o.DirectCanReplyWithApproval0 + } + fDirectCanReplyWithApproval0 := frDirectCanReplyWithApproval0 + if fDirectCanReplyWithApproval0 != "" { + if err := r.SetFormParam("direct[can_reply][with_approval][0]", fDirectCanReplyWithApproval0); err != nil { + return err + } + } + } + + if o.PrivateCanFavouriteAlways0 != nil { + + // form param private[can_favourite][always][0] + var frPrivateCanFavouriteAlways0 string + if o.PrivateCanFavouriteAlways0 != nil { + frPrivateCanFavouriteAlways0 = *o.PrivateCanFavouriteAlways0 + } + fPrivateCanFavouriteAlways0 := frPrivateCanFavouriteAlways0 + if fPrivateCanFavouriteAlways0 != "" { + if err := r.SetFormParam("private[can_favourite][always][0]", fPrivateCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.PrivateCanFavouriteWithApproval0 != nil { + + // form param private[can_favourite][with_approval][0] + var frPrivateCanFavouriteWithApproval0 string + if o.PrivateCanFavouriteWithApproval0 != nil { + frPrivateCanFavouriteWithApproval0 = *o.PrivateCanFavouriteWithApproval0 + } + fPrivateCanFavouriteWithApproval0 := frPrivateCanFavouriteWithApproval0 + if fPrivateCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("private[can_favourite][with_approval][0]", fPrivateCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.PrivateCanReblogAlways0 != nil { + + // form param private[can_reblog][always][0] + var frPrivateCanReblogAlways0 string + if o.PrivateCanReblogAlways0 != nil { + frPrivateCanReblogAlways0 = *o.PrivateCanReblogAlways0 + } + fPrivateCanReblogAlways0 := frPrivateCanReblogAlways0 + if fPrivateCanReblogAlways0 != "" { + if err := r.SetFormParam("private[can_reblog][always][0]", fPrivateCanReblogAlways0); err != nil { + return err + } + } + } + + if o.PrivateCanReblogWithApproval0 != nil { + + // form param private[can_reblog][with_approval][0] + var frPrivateCanReblogWithApproval0 string + if o.PrivateCanReblogWithApproval0 != nil { + frPrivateCanReblogWithApproval0 = *o.PrivateCanReblogWithApproval0 + } + fPrivateCanReblogWithApproval0 := frPrivateCanReblogWithApproval0 + if fPrivateCanReblogWithApproval0 != "" { + if err := r.SetFormParam("private[can_reblog][with_approval][0]", fPrivateCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.PrivateCanReplyAlways0 != nil { + + // form param private[can_reply][always][0] + var frPrivateCanReplyAlways0 string + if o.PrivateCanReplyAlways0 != nil { + frPrivateCanReplyAlways0 = *o.PrivateCanReplyAlways0 + } + fPrivateCanReplyAlways0 := frPrivateCanReplyAlways0 + if fPrivateCanReplyAlways0 != "" { + if err := r.SetFormParam("private[can_reply][always][0]", fPrivateCanReplyAlways0); err != nil { + return err + } + } + } + + if o.PrivateCanReplyWithApproval0 != nil { + + // form param private[can_reply][with_approval][0] + var frPrivateCanReplyWithApproval0 string + if o.PrivateCanReplyWithApproval0 != nil { + frPrivateCanReplyWithApproval0 = *o.PrivateCanReplyWithApproval0 + } + fPrivateCanReplyWithApproval0 := frPrivateCanReplyWithApproval0 + if fPrivateCanReplyWithApproval0 != "" { + if err := r.SetFormParam("private[can_reply][with_approval][0]", fPrivateCanReplyWithApproval0); err != nil { + return err + } + } + } + + if o.PublicCanFavouriteAlways0 != nil { + + // form param public[can_favourite][always][0] + var frPublicCanFavouriteAlways0 string + if o.PublicCanFavouriteAlways0 != nil { + frPublicCanFavouriteAlways0 = *o.PublicCanFavouriteAlways0 + } + fPublicCanFavouriteAlways0 := frPublicCanFavouriteAlways0 + if fPublicCanFavouriteAlways0 != "" { + if err := r.SetFormParam("public[can_favourite][always][0]", fPublicCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.PublicCanFavouriteWithApproval0 != nil { + + // form param public[can_favourite][with_approval][0] + var frPublicCanFavouriteWithApproval0 string + if o.PublicCanFavouriteWithApproval0 != nil { + frPublicCanFavouriteWithApproval0 = *o.PublicCanFavouriteWithApproval0 + } + fPublicCanFavouriteWithApproval0 := frPublicCanFavouriteWithApproval0 + if fPublicCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("public[can_favourite][with_approval][0]", fPublicCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.PublicCanReblogAlways0 != nil { + + // form param public[can_reblog][always][0] + var frPublicCanReblogAlways0 string + if o.PublicCanReblogAlways0 != nil { + frPublicCanReblogAlways0 = *o.PublicCanReblogAlways0 + } + fPublicCanReblogAlways0 := frPublicCanReblogAlways0 + if fPublicCanReblogAlways0 != "" { + if err := r.SetFormParam("public[can_reblog][always][0]", fPublicCanReblogAlways0); err != nil { + return err + } + } + } + + if o.PublicCanReblogWithApproval0 != nil { + + // form param public[can_reblog][with_approval][0] + var frPublicCanReblogWithApproval0 string + if o.PublicCanReblogWithApproval0 != nil { + frPublicCanReblogWithApproval0 = *o.PublicCanReblogWithApproval0 + } + fPublicCanReblogWithApproval0 := frPublicCanReblogWithApproval0 + if fPublicCanReblogWithApproval0 != "" { + if err := r.SetFormParam("public[can_reblog][with_approval][0]", fPublicCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.PublicCanReplyAlways0 != nil { + + // form param public[can_reply][always][0] + var frPublicCanReplyAlways0 string + if o.PublicCanReplyAlways0 != nil { + frPublicCanReplyAlways0 = *o.PublicCanReplyAlways0 + } + fPublicCanReplyAlways0 := frPublicCanReplyAlways0 + if fPublicCanReplyAlways0 != "" { + if err := r.SetFormParam("public[can_reply][always][0]", fPublicCanReplyAlways0); err != nil { + return err + } + } + } + + if o.PublicCanReplyWithApproval0 != nil { + + // form param public[can_reply][with_approval][0] + var frPublicCanReplyWithApproval0 string + if o.PublicCanReplyWithApproval0 != nil { + frPublicCanReplyWithApproval0 = *o.PublicCanReplyWithApproval0 + } + fPublicCanReplyWithApproval0 := frPublicCanReplyWithApproval0 + if fPublicCanReplyWithApproval0 != "" { + if err := r.SetFormParam("public[can_reply][with_approval][0]", fPublicCanReplyWithApproval0); err != nil { + return err + } + } + } + + if o.UnlistedCanFavouriteAlways0 != nil { + + // form param unlisted[can_favourite][always][0] + var frUnlistedCanFavouriteAlways0 string + if o.UnlistedCanFavouriteAlways0 != nil { + frUnlistedCanFavouriteAlways0 = *o.UnlistedCanFavouriteAlways0 + } + fUnlistedCanFavouriteAlways0 := frUnlistedCanFavouriteAlways0 + if fUnlistedCanFavouriteAlways0 != "" { + if err := r.SetFormParam("unlisted[can_favourite][always][0]", fUnlistedCanFavouriteAlways0); err != nil { + return err + } + } + } + + if o.UnlistedCanFavouriteWithApproval0 != nil { + + // form param unlisted[can_favourite][with_approval][0] + var frUnlistedCanFavouriteWithApproval0 string + if o.UnlistedCanFavouriteWithApproval0 != nil { + frUnlistedCanFavouriteWithApproval0 = *o.UnlistedCanFavouriteWithApproval0 + } + fUnlistedCanFavouriteWithApproval0 := frUnlistedCanFavouriteWithApproval0 + if fUnlistedCanFavouriteWithApproval0 != "" { + if err := r.SetFormParam("unlisted[can_favourite][with_approval][0]", fUnlistedCanFavouriteWithApproval0); err != nil { + return err + } + } + } + + if o.UnlistedCanReblogAlways0 != nil { + + // form param unlisted[can_reblog][always][0] + var frUnlistedCanReblogAlways0 string + if o.UnlistedCanReblogAlways0 != nil { + frUnlistedCanReblogAlways0 = *o.UnlistedCanReblogAlways0 + } + fUnlistedCanReblogAlways0 := frUnlistedCanReblogAlways0 + if fUnlistedCanReblogAlways0 != "" { + if err := r.SetFormParam("unlisted[can_reblog][always][0]", fUnlistedCanReblogAlways0); err != nil { + return err + } + } + } + + if o.UnlistedCanReblogWithApproval0 != nil { + + // form param unlisted[can_reblog][with_approval][0] + var frUnlistedCanReblogWithApproval0 string + if o.UnlistedCanReblogWithApproval0 != nil { + frUnlistedCanReblogWithApproval0 = *o.UnlistedCanReblogWithApproval0 + } + fUnlistedCanReblogWithApproval0 := frUnlistedCanReblogWithApproval0 + if fUnlistedCanReblogWithApproval0 != "" { + if err := r.SetFormParam("unlisted[can_reblog][with_approval][0]", fUnlistedCanReblogWithApproval0); err != nil { + return err + } + } + } + + if o.UnlistedCanReplyAlways0 != nil { + + // form param unlisted[can_reply][always][0] + var frUnlistedCanReplyAlways0 string + if o.UnlistedCanReplyAlways0 != nil { + frUnlistedCanReplyAlways0 = *o.UnlistedCanReplyAlways0 + } + fUnlistedCanReplyAlways0 := frUnlistedCanReplyAlways0 + if fUnlistedCanReplyAlways0 != "" { + if err := r.SetFormParam("unlisted[can_reply][always][0]", fUnlistedCanReplyAlways0); err != nil { + return err + } + } + } + + if o.UnlistedCanReplyWithApproval0 != nil { + + // form param unlisted[can_reply][with_approval][0] + var frUnlistedCanReplyWithApproval0 string + if o.UnlistedCanReplyWithApproval0 != nil { + frUnlistedCanReplyWithApproval0 = *o.UnlistedCanReplyWithApproval0 + } + fUnlistedCanReplyWithApproval0 := frUnlistedCanReplyWithApproval0 + if fUnlistedCanReplyWithApproval0 != "" { + if err := r.SetFormParam("unlisted[can_reply][with_approval][0]", fUnlistedCanReplyWithApproval0); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/interaction_policies/policies_defaults_update_responses.go b/client/interaction_policies/policies_defaults_update_responses.go new file mode 100644 index 0000000..82f0d01 --- /dev/null +++ b/client/interaction_policies/policies_defaults_update_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package interaction_policies + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PoliciesDefaultsUpdateReader is a Reader for the PoliciesDefaultsUpdate structure. +type PoliciesDefaultsUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PoliciesDefaultsUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPoliciesDefaultsUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPoliciesDefaultsUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPoliciesDefaultsUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPoliciesDefaultsUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPoliciesDefaultsUpdateUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPoliciesDefaultsUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PATCH /api/v1/interaction_policies/defaults] policiesDefaultsUpdate", response, response.Code()) + } +} + +// NewPoliciesDefaultsUpdateOK creates a PoliciesDefaultsUpdateOK with default headers values +func NewPoliciesDefaultsUpdateOK() *PoliciesDefaultsUpdateOK { + return &PoliciesDefaultsUpdateOK{} +} + +/* +PoliciesDefaultsUpdateOK describes a response with status code 200, with default header values. + +Updated default policies object containing a policy for each status visibility. +*/ +type PoliciesDefaultsUpdateOK struct { + Payload *models.DefaultPolicies +} + +// IsSuccess returns true when this policies defaults update o k response has a 2xx status code +func (o *PoliciesDefaultsUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this policies defaults update o k response has a 3xx status code +func (o *PoliciesDefaultsUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update o k response has a 4xx status code +func (o *PoliciesDefaultsUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults update o k response has a 5xx status code +func (o *PoliciesDefaultsUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update o k response a status code equal to that given +func (o *PoliciesDefaultsUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the policies defaults update o k response +func (o *PoliciesDefaultsUpdateOK) Code() int { + return 200 +} + +func (o *PoliciesDefaultsUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateOK %s", 200, payload) +} + +func (o *PoliciesDefaultsUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateOK %s", 200, payload) +} + +func (o *PoliciesDefaultsUpdateOK) GetPayload() *models.DefaultPolicies { + return o.Payload +} + +func (o *PoliciesDefaultsUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.DefaultPolicies) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPoliciesDefaultsUpdateBadRequest creates a PoliciesDefaultsUpdateBadRequest with default headers values +func NewPoliciesDefaultsUpdateBadRequest() *PoliciesDefaultsUpdateBadRequest { + return &PoliciesDefaultsUpdateBadRequest{} +} + +/* +PoliciesDefaultsUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PoliciesDefaultsUpdateBadRequest struct { +} + +// IsSuccess returns true when this policies defaults update bad request response has a 2xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update bad request response has a 3xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update bad request response has a 4xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update bad request response has a 5xx status code +func (o *PoliciesDefaultsUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update bad request response a status code equal to that given +func (o *PoliciesDefaultsUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the policies defaults update bad request response +func (o *PoliciesDefaultsUpdateBadRequest) Code() int { + return 400 +} + +func (o *PoliciesDefaultsUpdateBadRequest) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateBadRequest", 400) +} + +func (o *PoliciesDefaultsUpdateBadRequest) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateBadRequest", 400) +} + +func (o *PoliciesDefaultsUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateUnauthorized creates a PoliciesDefaultsUpdateUnauthorized with default headers values +func NewPoliciesDefaultsUpdateUnauthorized() *PoliciesDefaultsUpdateUnauthorized { + return &PoliciesDefaultsUpdateUnauthorized{} +} + +/* +PoliciesDefaultsUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PoliciesDefaultsUpdateUnauthorized struct { +} + +// IsSuccess returns true when this policies defaults update unauthorized response has a 2xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update unauthorized response has a 3xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update unauthorized response has a 4xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update unauthorized response has a 5xx status code +func (o *PoliciesDefaultsUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update unauthorized response a status code equal to that given +func (o *PoliciesDefaultsUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the policies defaults update unauthorized response +func (o *PoliciesDefaultsUpdateUnauthorized) Code() int { + return 401 +} + +func (o *PoliciesDefaultsUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnauthorized", 401) +} + +func (o *PoliciesDefaultsUpdateUnauthorized) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnauthorized", 401) +} + +func (o *PoliciesDefaultsUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateNotAcceptable creates a PoliciesDefaultsUpdateNotAcceptable with default headers values +func NewPoliciesDefaultsUpdateNotAcceptable() *PoliciesDefaultsUpdateNotAcceptable { + return &PoliciesDefaultsUpdateNotAcceptable{} +} + +/* +PoliciesDefaultsUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PoliciesDefaultsUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this policies defaults update not acceptable response has a 2xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update not acceptable response has a 3xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update not acceptable response has a 4xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update not acceptable response has a 5xx status code +func (o *PoliciesDefaultsUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update not acceptable response a status code equal to that given +func (o *PoliciesDefaultsUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the policies defaults update not acceptable response +func (o *PoliciesDefaultsUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *PoliciesDefaultsUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateNotAcceptable", 406) +} + +func (o *PoliciesDefaultsUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateNotAcceptable", 406) +} + +func (o *PoliciesDefaultsUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateUnprocessableEntity creates a PoliciesDefaultsUpdateUnprocessableEntity with default headers values +func NewPoliciesDefaultsUpdateUnprocessableEntity() *PoliciesDefaultsUpdateUnprocessableEntity { + return &PoliciesDefaultsUpdateUnprocessableEntity{} +} + +/* +PoliciesDefaultsUpdateUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable +*/ +type PoliciesDefaultsUpdateUnprocessableEntity struct { +} + +// IsSuccess returns true when this policies defaults update unprocessable entity response has a 2xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update unprocessable entity response has a 3xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update unprocessable entity response has a 4xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this policies defaults update unprocessable entity response has a 5xx status code +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this policies defaults update unprocessable entity response a status code equal to that given +func (o *PoliciesDefaultsUpdateUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the policies defaults update unprocessable entity response +func (o *PoliciesDefaultsUpdateUnprocessableEntity) Code() int { + return 422 +} + +func (o *PoliciesDefaultsUpdateUnprocessableEntity) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnprocessableEntity", 422) +} + +func (o *PoliciesDefaultsUpdateUnprocessableEntity) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateUnprocessableEntity", 422) +} + +func (o *PoliciesDefaultsUpdateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPoliciesDefaultsUpdateInternalServerError creates a PoliciesDefaultsUpdateInternalServerError with default headers values +func NewPoliciesDefaultsUpdateInternalServerError() *PoliciesDefaultsUpdateInternalServerError { + return &PoliciesDefaultsUpdateInternalServerError{} +} + +/* +PoliciesDefaultsUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PoliciesDefaultsUpdateInternalServerError struct { +} + +// IsSuccess returns true when this policies defaults update internal server error response has a 2xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this policies defaults update internal server error response has a 3xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this policies defaults update internal server error response has a 4xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this policies defaults update internal server error response has a 5xx status code +func (o *PoliciesDefaultsUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this policies defaults update internal server error response a status code equal to that given +func (o *PoliciesDefaultsUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the policies defaults update internal server error response +func (o *PoliciesDefaultsUpdateInternalServerError) Code() int { + return 500 +} + +func (o *PoliciesDefaultsUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateInternalServerError", 500) +} + +func (o *PoliciesDefaultsUpdateInternalServerError) String() string { + return fmt.Sprintf("[PATCH /api/v1/interaction_policies/defaults][%d] policiesDefaultsUpdateInternalServerError", 500) +} + +func (o *PoliciesDefaultsUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/add_list_accounts_parameters.go b/client/lists/add_list_accounts_parameters.go new file mode 100644 index 0000000..e9e6b8a --- /dev/null +++ b/client/lists/add_list_accounts_parameters.go @@ -0,0 +1,197 @@ +// 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" + "github.com/go-openapi/swag" +) + +// NewAddListAccountsParams creates a new AddListAccountsParams 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 NewAddListAccountsParams() *AddListAccountsParams { + return &AddListAccountsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewAddListAccountsParamsWithTimeout creates a new AddListAccountsParams object +// with the ability to set a timeout on a request. +func NewAddListAccountsParamsWithTimeout(timeout time.Duration) *AddListAccountsParams { + return &AddListAccountsParams{ + timeout: timeout, + } +} + +// NewAddListAccountsParamsWithContext creates a new AddListAccountsParams object +// with the ability to set a context for a request. +func NewAddListAccountsParamsWithContext(ctx context.Context) *AddListAccountsParams { + return &AddListAccountsParams{ + Context: ctx, + } +} + +// NewAddListAccountsParamsWithHTTPClient creates a new AddListAccountsParams object +// with the ability to set a custom HTTPClient for a request. +func NewAddListAccountsParamsWithHTTPClient(client *http.Client) *AddListAccountsParams { + return &AddListAccountsParams{ + HTTPClient: client, + } +} + +/* +AddListAccountsParams contains all the parameters to send to the API endpoint + + for the add list accounts operation. + + Typically these are written to a http.Request. +*/ +type AddListAccountsParams struct { + + /* AccountIds. + + Array of accountIDs to modify. Each accountID must correspond to an account that the requesting account follows. + */ + AccountIds []string + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the add list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AddListAccountsParams) WithDefaults() *AddListAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the add list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *AddListAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the add list accounts params +func (o *AddListAccountsParams) WithTimeout(timeout time.Duration) *AddListAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the add list accounts params +func (o *AddListAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the add list accounts params +func (o *AddListAccountsParams) WithContext(ctx context.Context) *AddListAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the add list accounts params +func (o *AddListAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the add list accounts params +func (o *AddListAccountsParams) WithHTTPClient(client *http.Client) *AddListAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the add list accounts params +func (o *AddListAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountIds adds the accountIds to the add list accounts params +func (o *AddListAccountsParams) WithAccountIds(accountIds []string) *AddListAccountsParams { + o.SetAccountIds(accountIds) + return o +} + +// SetAccountIds adds the accountIds to the add list accounts params +func (o *AddListAccountsParams) SetAccountIds(accountIds []string) { + o.AccountIds = accountIds +} + +// WithID adds the id to the add list accounts params +func (o *AddListAccountsParams) WithID(id string) *AddListAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the add list accounts params +func (o *AddListAccountsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *AddListAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountIds != nil { + + // binding items for account_ids[] + joinedAccountIds := o.bindParamAccountIds(reg) + + // form array param account_ids[] + if err := r.SetFormParam("account_ids[]", joinedAccountIds...); 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 +} + +// bindParamAddListAccounts binds the parameter account_ids[] +func (o *AddListAccountsParams) bindParamAccountIds(formats strfmt.Registry) []string { + accountIdsIR := o.AccountIds + + var accountIdsIC []string + for _, accountIdsIIR := range accountIdsIR { // explode []string + + accountIdsIIV := accountIdsIIR // string as string + accountIdsIC = append(accountIdsIC, accountIdsIIV) + } + + // items.CollectionFormat: "multi" + accountIdsIS := swag.JoinByFormat(accountIdsIC, "multi") + + return accountIdsIS +} diff --git a/client/lists/add_list_accounts_responses.go b/client/lists/add_list_accounts_responses.go new file mode 100644 index 0000000..e05e60f --- /dev/null +++ b/client/lists/add_list_accounts_responses.go @@ -0,0 +1,398 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// AddListAccountsReader is a Reader for the AddListAccounts structure. +type AddListAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *AddListAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewAddListAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewAddListAccountsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewAddListAccountsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewAddListAccountsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewAddListAccountsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewAddListAccountsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/lists/{id}/accounts] addListAccounts", response, response.Code()) + } +} + +// NewAddListAccountsOK creates a AddListAccountsOK with default headers values +func NewAddListAccountsOK() *AddListAccountsOK { + return &AddListAccountsOK{} +} + +/* +AddListAccountsOK describes a response with status code 200, with default header values. + +list accounts updated +*/ +type AddListAccountsOK struct { +} + +// IsSuccess returns true when this add list accounts o k response has a 2xx status code +func (o *AddListAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this add list accounts o k response has a 3xx status code +func (o *AddListAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts o k response has a 4xx status code +func (o *AddListAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this add list accounts o k response has a 5xx status code +func (o *AddListAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts o k response a status code equal to that given +func (o *AddListAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the add list accounts o k response +func (o *AddListAccountsOK) Code() int { + return 200 +} + +func (o *AddListAccountsOK) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsOK", 200) +} + +func (o *AddListAccountsOK) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsOK", 200) +} + +func (o *AddListAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsBadRequest creates a AddListAccountsBadRequest with default headers values +func NewAddListAccountsBadRequest() *AddListAccountsBadRequest { + return &AddListAccountsBadRequest{} +} + +/* +AddListAccountsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type AddListAccountsBadRequest struct { +} + +// IsSuccess returns true when this add list accounts bad request response has a 2xx status code +func (o *AddListAccountsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts bad request response has a 3xx status code +func (o *AddListAccountsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts bad request response has a 4xx status code +func (o *AddListAccountsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts bad request response has a 5xx status code +func (o *AddListAccountsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts bad request response a status code equal to that given +func (o *AddListAccountsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the add list accounts bad request response +func (o *AddListAccountsBadRequest) Code() int { + return 400 +} + +func (o *AddListAccountsBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsBadRequest", 400) +} + +func (o *AddListAccountsBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsBadRequest", 400) +} + +func (o *AddListAccountsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsUnauthorized creates a AddListAccountsUnauthorized with default headers values +func NewAddListAccountsUnauthorized() *AddListAccountsUnauthorized { + return &AddListAccountsUnauthorized{} +} + +/* +AddListAccountsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type AddListAccountsUnauthorized struct { +} + +// IsSuccess returns true when this add list accounts unauthorized response has a 2xx status code +func (o *AddListAccountsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts unauthorized response has a 3xx status code +func (o *AddListAccountsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts unauthorized response has a 4xx status code +func (o *AddListAccountsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts unauthorized response has a 5xx status code +func (o *AddListAccountsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts unauthorized response a status code equal to that given +func (o *AddListAccountsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the add list accounts unauthorized response +func (o *AddListAccountsUnauthorized) Code() int { + return 401 +} + +func (o *AddListAccountsUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsUnauthorized", 401) +} + +func (o *AddListAccountsUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsUnauthorized", 401) +} + +func (o *AddListAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsNotFound creates a AddListAccountsNotFound with default headers values +func NewAddListAccountsNotFound() *AddListAccountsNotFound { + return &AddListAccountsNotFound{} +} + +/* +AddListAccountsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type AddListAccountsNotFound struct { +} + +// IsSuccess returns true when this add list accounts not found response has a 2xx status code +func (o *AddListAccountsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts not found response has a 3xx status code +func (o *AddListAccountsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts not found response has a 4xx status code +func (o *AddListAccountsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts not found response has a 5xx status code +func (o *AddListAccountsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts not found response a status code equal to that given +func (o *AddListAccountsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the add list accounts not found response +func (o *AddListAccountsNotFound) Code() int { + return 404 +} + +func (o *AddListAccountsNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotFound", 404) +} + +func (o *AddListAccountsNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotFound", 404) +} + +func (o *AddListAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsNotAcceptable creates a AddListAccountsNotAcceptable with default headers values +func NewAddListAccountsNotAcceptable() *AddListAccountsNotAcceptable { + return &AddListAccountsNotAcceptable{} +} + +/* +AddListAccountsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type AddListAccountsNotAcceptable struct { +} + +// IsSuccess returns true when this add list accounts not acceptable response has a 2xx status code +func (o *AddListAccountsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts not acceptable response has a 3xx status code +func (o *AddListAccountsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts not acceptable response has a 4xx status code +func (o *AddListAccountsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this add list accounts not acceptable response has a 5xx status code +func (o *AddListAccountsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this add list accounts not acceptable response a status code equal to that given +func (o *AddListAccountsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the add list accounts not acceptable response +func (o *AddListAccountsNotAcceptable) Code() int { + return 406 +} + +func (o *AddListAccountsNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotAcceptable", 406) +} + +func (o *AddListAccountsNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsNotAcceptable", 406) +} + +func (o *AddListAccountsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewAddListAccountsInternalServerError creates a AddListAccountsInternalServerError with default headers values +func NewAddListAccountsInternalServerError() *AddListAccountsInternalServerError { + return &AddListAccountsInternalServerError{} +} + +/* +AddListAccountsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type AddListAccountsInternalServerError struct { +} + +// IsSuccess returns true when this add list accounts internal server error response has a 2xx status code +func (o *AddListAccountsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this add list accounts internal server error response has a 3xx status code +func (o *AddListAccountsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this add list accounts internal server error response has a 4xx status code +func (o *AddListAccountsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this add list accounts internal server error response has a 5xx status code +func (o *AddListAccountsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this add list accounts internal server error response a status code equal to that given +func (o *AddListAccountsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the add list accounts internal server error response +func (o *AddListAccountsInternalServerError) Code() int { + return 500 +} + +func (o *AddListAccountsInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsInternalServerError", 500) +} + +func (o *AddListAccountsInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/lists/{id}/accounts][%d] addListAccountsInternalServerError", 500) +} + +func (o *AddListAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/list_accounts_parameters.go b/client/lists/list_accounts_parameters.go new file mode 100644 index 0000000..06944e4 --- /dev/null +++ b/client/lists/list_accounts_parameters.go @@ -0,0 +1,301 @@ +// 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" + "github.com/go-openapi/swag" +) + +// NewListAccountsParams creates a new ListAccountsParams 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 NewListAccountsParams() *ListAccountsParams { + return &ListAccountsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListAccountsParamsWithTimeout creates a new ListAccountsParams object +// with the ability to set a timeout on a request. +func NewListAccountsParamsWithTimeout(timeout time.Duration) *ListAccountsParams { + return &ListAccountsParams{ + timeout: timeout, + } +} + +// NewListAccountsParamsWithContext creates a new ListAccountsParams object +// with the ability to set a context for a request. +func NewListAccountsParamsWithContext(ctx context.Context) *ListAccountsParams { + return &ListAccountsParams{ + Context: ctx, + } +} + +// NewListAccountsParamsWithHTTPClient creates a new ListAccountsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListAccountsParamsWithHTTPClient(client *http.Client) *ListAccountsParams { + return &ListAccountsParams{ + HTTPClient: client, + } +} + +/* +ListAccountsParams contains all the parameters to send to the API endpoint + + for the list accounts operation. + + Typically these are written to a http.Request. +*/ +type ListAccountsParams struct { + + /* ID. + + ID of the list + */ + ID string + + /* Limit. + + Number of accounts to return. If set to 0 explicitly, all accounts in the list will be returned, and pagination headers will not be used. This is a workaround for Mastodon API peculiarities: https://docs.joinmastodon.org/methods/lists/#query-parameters. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only list entries *OLDER* than the given max ID. The account from the list entry with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only list entries *IMMEDIATELY NEWER* than the given min ID. The account from the list entry with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only list entries *NEWER* than the given since ID. The account from the list entry 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 list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListAccountsParams) WithDefaults() *ListAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListAccountsParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := ListAccountsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the list accounts params +func (o *ListAccountsParams) WithTimeout(timeout time.Duration) *ListAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list accounts params +func (o *ListAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list accounts params +func (o *ListAccountsParams) WithContext(ctx context.Context) *ListAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list accounts params +func (o *ListAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list accounts params +func (o *ListAccountsParams) WithHTTPClient(client *http.Client) *ListAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list accounts params +func (o *ListAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list accounts params +func (o *ListAccountsParams) WithID(id string) *ListAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list accounts params +func (o *ListAccountsParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the list accounts params +func (o *ListAccountsParams) WithLimit(limit *int64) *ListAccountsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the list accounts params +func (o *ListAccountsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the list accounts params +func (o *ListAccountsParams) WithMaxID(maxID *string) *ListAccountsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the list accounts params +func (o *ListAccountsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the list accounts params +func (o *ListAccountsParams) WithMinID(minID *string) *ListAccountsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the list accounts params +func (o *ListAccountsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the list accounts params +func (o *ListAccountsParams) WithSinceID(sinceID *string) *ListAccountsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the list accounts params +func (o *ListAccountsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + 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.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 +} diff --git a/client/lists/list_accounts_responses.go b/client/lists/list_accounts_responses.go new file mode 100644 index 0000000..ae65986 --- /dev/null +++ b/client/lists/list_accounts_responses.go @@ -0,0 +1,426 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListAccountsReader is a Reader for the ListAccounts structure. +type ListAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListAccountsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListAccountsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListAccountsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListAccountsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListAccountsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/lists/{id}/accounts] listAccounts", response, response.Code()) + } +} + +// NewListAccountsOK creates a ListAccountsOK with default headers values +func NewListAccountsOK() *ListAccountsOK { + return &ListAccountsOK{} +} + +/* +ListAccountsOK describes a response with status code 200, with default header values. + +Array of accounts. +*/ +type ListAccountsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Account +} + +// IsSuccess returns true when this list accounts o k response has a 2xx status code +func (o *ListAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list accounts o k response has a 3xx status code +func (o *ListAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts o k response has a 4xx status code +func (o *ListAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list accounts o k response has a 5xx status code +func (o *ListAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts o k response a status code equal to that given +func (o *ListAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list accounts o k response +func (o *ListAccountsOK) Code() int { + return 200 +} + +func (o *ListAccountsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsOK %s", 200, payload) +} + +func (o *ListAccountsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsOK %s", 200, payload) +} + +func (o *ListAccountsOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *ListAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListAccountsBadRequest creates a ListAccountsBadRequest with default headers values +func NewListAccountsBadRequest() *ListAccountsBadRequest { + return &ListAccountsBadRequest{} +} + +/* +ListAccountsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListAccountsBadRequest struct { +} + +// IsSuccess returns true when this list accounts bad request response has a 2xx status code +func (o *ListAccountsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts bad request response has a 3xx status code +func (o *ListAccountsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts bad request response has a 4xx status code +func (o *ListAccountsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts bad request response has a 5xx status code +func (o *ListAccountsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts bad request response a status code equal to that given +func (o *ListAccountsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list accounts bad request response +func (o *ListAccountsBadRequest) Code() int { + return 400 +} + +func (o *ListAccountsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsBadRequest", 400) +} + +func (o *ListAccountsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsBadRequest", 400) +} + +func (o *ListAccountsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsUnauthorized creates a ListAccountsUnauthorized with default headers values +func NewListAccountsUnauthorized() *ListAccountsUnauthorized { + return &ListAccountsUnauthorized{} +} + +/* +ListAccountsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListAccountsUnauthorized struct { +} + +// IsSuccess returns true when this list accounts unauthorized response has a 2xx status code +func (o *ListAccountsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts unauthorized response has a 3xx status code +func (o *ListAccountsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts unauthorized response has a 4xx status code +func (o *ListAccountsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts unauthorized response has a 5xx status code +func (o *ListAccountsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts unauthorized response a status code equal to that given +func (o *ListAccountsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list accounts unauthorized response +func (o *ListAccountsUnauthorized) Code() int { + return 401 +} + +func (o *ListAccountsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsUnauthorized", 401) +} + +func (o *ListAccountsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsUnauthorized", 401) +} + +func (o *ListAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsNotFound creates a ListAccountsNotFound with default headers values +func NewListAccountsNotFound() *ListAccountsNotFound { + return &ListAccountsNotFound{} +} + +/* +ListAccountsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListAccountsNotFound struct { +} + +// IsSuccess returns true when this list accounts not found response has a 2xx status code +func (o *ListAccountsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts not found response has a 3xx status code +func (o *ListAccountsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts not found response has a 4xx status code +func (o *ListAccountsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts not found response has a 5xx status code +func (o *ListAccountsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts not found response a status code equal to that given +func (o *ListAccountsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list accounts not found response +func (o *ListAccountsNotFound) Code() int { + return 404 +} + +func (o *ListAccountsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotFound", 404) +} + +func (o *ListAccountsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotFound", 404) +} + +func (o *ListAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsNotAcceptable creates a ListAccountsNotAcceptable with default headers values +func NewListAccountsNotAcceptable() *ListAccountsNotAcceptable { + return &ListAccountsNotAcceptable{} +} + +/* +ListAccountsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListAccountsNotAcceptable struct { +} + +// IsSuccess returns true when this list accounts not acceptable response has a 2xx status code +func (o *ListAccountsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts not acceptable response has a 3xx status code +func (o *ListAccountsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts not acceptable response has a 4xx status code +func (o *ListAccountsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list accounts not acceptable response has a 5xx status code +func (o *ListAccountsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list accounts not acceptable response a status code equal to that given +func (o *ListAccountsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list accounts not acceptable response +func (o *ListAccountsNotAcceptable) Code() int { + return 406 +} + +func (o *ListAccountsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotAcceptable", 406) +} + +func (o *ListAccountsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsNotAcceptable", 406) +} + +func (o *ListAccountsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListAccountsInternalServerError creates a ListAccountsInternalServerError with default headers values +func NewListAccountsInternalServerError() *ListAccountsInternalServerError { + return &ListAccountsInternalServerError{} +} + +/* +ListAccountsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListAccountsInternalServerError struct { +} + +// IsSuccess returns true when this list accounts internal server error response has a 2xx status code +func (o *ListAccountsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list accounts internal server error response has a 3xx status code +func (o *ListAccountsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list accounts internal server error response has a 4xx status code +func (o *ListAccountsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list accounts internal server error response has a 5xx status code +func (o *ListAccountsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list accounts internal server error response a status code equal to that given +func (o *ListAccountsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list accounts internal server error response +func (o *ListAccountsInternalServerError) Code() int { + return 500 +} + +func (o *ListAccountsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsInternalServerError", 500) +} + +func (o *ListAccountsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}/accounts][%d] listAccountsInternalServerError", 500) +} + +func (o *ListAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/list_create_parameters.go b/client/lists/list_create_parameters.go new file mode 100644 index 0000000..e79592d --- /dev/null +++ b/client/lists/list_create_parameters.go @@ -0,0 +1,205 @@ +// 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 +} diff --git a/client/lists/list_create_responses.go b/client/lists/list_create_responses.go new file mode 100644 index 0000000..b938343 --- /dev/null +++ b/client/lists/list_create_responses.go @@ -0,0 +1,478 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListCreateReader is a Reader for the ListCreate structure. +type ListCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewListCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/lists] listCreate", response, response.Code()) + } +} + +// NewListCreateOK creates a ListCreateOK with default headers values +func NewListCreateOK() *ListCreateOK { + return &ListCreateOK{} +} + +/* +ListCreateOK describes a response with status code 200, with default header values. + +The newly created list. +*/ +type ListCreateOK struct { + Payload *models.List +} + +// IsSuccess returns true when this list create o k response has a 2xx status code +func (o *ListCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list create o k response has a 3xx status code +func (o *ListCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create o k response has a 4xx status code +func (o *ListCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list create o k response has a 5xx status code +func (o *ListCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list create o k response a status code equal to that given +func (o *ListCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list create o k response +func (o *ListCreateOK) Code() int { + return 200 +} + +func (o *ListCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateOK %s", 200, payload) +} + +func (o *ListCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateOK %s", 200, payload) +} + +func (o *ListCreateOK) GetPayload() *models.List { + return o.Payload +} + +func (o *ListCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.List) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListCreateBadRequest creates a ListCreateBadRequest with default headers values +func NewListCreateBadRequest() *ListCreateBadRequest { + return &ListCreateBadRequest{} +} + +/* +ListCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListCreateBadRequest struct { +} + +// IsSuccess returns true when this list create bad request response has a 2xx status code +func (o *ListCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create bad request response has a 3xx status code +func (o *ListCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create bad request response has a 4xx status code +func (o *ListCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create bad request response has a 5xx status code +func (o *ListCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list create bad request response a status code equal to that given +func (o *ListCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list create bad request response +func (o *ListCreateBadRequest) Code() int { + return 400 +} + +func (o *ListCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateBadRequest", 400) +} + +func (o *ListCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateBadRequest", 400) +} + +func (o *ListCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateUnauthorized creates a ListCreateUnauthorized with default headers values +func NewListCreateUnauthorized() *ListCreateUnauthorized { + return &ListCreateUnauthorized{} +} + +/* +ListCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListCreateUnauthorized struct { +} + +// IsSuccess returns true when this list create unauthorized response has a 2xx status code +func (o *ListCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create unauthorized response has a 3xx status code +func (o *ListCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create unauthorized response has a 4xx status code +func (o *ListCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create unauthorized response has a 5xx status code +func (o *ListCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list create unauthorized response a status code equal to that given +func (o *ListCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list create unauthorized response +func (o *ListCreateUnauthorized) Code() int { + return 401 +} + +func (o *ListCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateUnauthorized", 401) +} + +func (o *ListCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateUnauthorized", 401) +} + +func (o *ListCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateForbidden creates a ListCreateForbidden with default headers values +func NewListCreateForbidden() *ListCreateForbidden { + return &ListCreateForbidden{} +} + +/* +ListCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type ListCreateForbidden struct { +} + +// IsSuccess returns true when this list create forbidden response has a 2xx status code +func (o *ListCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create forbidden response has a 3xx status code +func (o *ListCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create forbidden response has a 4xx status code +func (o *ListCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create forbidden response has a 5xx status code +func (o *ListCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this list create forbidden response a status code equal to that given +func (o *ListCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the list create forbidden response +func (o *ListCreateForbidden) Code() int { + return 403 +} + +func (o *ListCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateForbidden", 403) +} + +func (o *ListCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateForbidden", 403) +} + +func (o *ListCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateNotFound creates a ListCreateNotFound with default headers values +func NewListCreateNotFound() *ListCreateNotFound { + return &ListCreateNotFound{} +} + +/* +ListCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListCreateNotFound struct { +} + +// IsSuccess returns true when this list create not found response has a 2xx status code +func (o *ListCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create not found response has a 3xx status code +func (o *ListCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create not found response has a 4xx status code +func (o *ListCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create not found response has a 5xx status code +func (o *ListCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list create not found response a status code equal to that given +func (o *ListCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list create not found response +func (o *ListCreateNotFound) Code() int { + return 404 +} + +func (o *ListCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotFound", 404) +} + +func (o *ListCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotFound", 404) +} + +func (o *ListCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateNotAcceptable creates a ListCreateNotAcceptable with default headers values +func NewListCreateNotAcceptable() *ListCreateNotAcceptable { + return &ListCreateNotAcceptable{} +} + +/* +ListCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListCreateNotAcceptable struct { +} + +// IsSuccess returns true when this list create not acceptable response has a 2xx status code +func (o *ListCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create not acceptable response has a 3xx status code +func (o *ListCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create not acceptable response has a 4xx status code +func (o *ListCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list create not acceptable response has a 5xx status code +func (o *ListCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list create not acceptable response a status code equal to that given +func (o *ListCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list create not acceptable response +func (o *ListCreateNotAcceptable) Code() int { + return 406 +} + +func (o *ListCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotAcceptable", 406) +} + +func (o *ListCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateNotAcceptable", 406) +} + +func (o *ListCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListCreateInternalServerError creates a ListCreateInternalServerError with default headers values +func NewListCreateInternalServerError() *ListCreateInternalServerError { + return &ListCreateInternalServerError{} +} + +/* +ListCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListCreateInternalServerError struct { +} + +// IsSuccess returns true when this list create internal server error response has a 2xx status code +func (o *ListCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list create internal server error response has a 3xx status code +func (o *ListCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list create internal server error response has a 4xx status code +func (o *ListCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list create internal server error response has a 5xx status code +func (o *ListCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list create internal server error response a status code equal to that given +func (o *ListCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list create internal server error response +func (o *ListCreateInternalServerError) Code() int { + return 500 +} + +func (o *ListCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateInternalServerError", 500) +} + +func (o *ListCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/lists][%d] listCreateInternalServerError", 500) +} + +func (o *ListCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/list_delete_parameters.go b/client/lists/list_delete_parameters.go new file mode 100644 index 0000000..04d1c11 --- /dev/null +++ b/client/lists/list_delete_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewListDeleteParams creates a new ListDeleteParams 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 NewListDeleteParams() *ListDeleteParams { + return &ListDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListDeleteParamsWithTimeout creates a new ListDeleteParams object +// with the ability to set a timeout on a request. +func NewListDeleteParamsWithTimeout(timeout time.Duration) *ListDeleteParams { + return &ListDeleteParams{ + timeout: timeout, + } +} + +// NewListDeleteParamsWithContext creates a new ListDeleteParams object +// with the ability to set a context for a request. +func NewListDeleteParamsWithContext(ctx context.Context) *ListDeleteParams { + return &ListDeleteParams{ + Context: ctx, + } +} + +// NewListDeleteParamsWithHTTPClient creates a new ListDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewListDeleteParamsWithHTTPClient(client *http.Client) *ListDeleteParams { + return &ListDeleteParams{ + HTTPClient: client, + } +} + +/* +ListDeleteParams contains all the parameters to send to the API endpoint + + for the list delete operation. + + Typically these are written to a http.Request. +*/ +type ListDeleteParams struct { + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListDeleteParams) WithDefaults() *ListDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list delete params +func (o *ListDeleteParams) WithTimeout(timeout time.Duration) *ListDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list delete params +func (o *ListDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list delete params +func (o *ListDeleteParams) WithContext(ctx context.Context) *ListDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list delete params +func (o *ListDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list delete params +func (o *ListDeleteParams) WithHTTPClient(client *http.Client) *ListDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list delete params +func (o *ListDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list delete params +func (o *ListDeleteParams) WithID(id string) *ListDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list delete params +func (o *ListDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ListDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/lists/list_delete_responses.go b/client/lists/list_delete_responses.go new file mode 100644 index 0000000..6cc5d14 --- /dev/null +++ b/client/lists/list_delete_responses.go @@ -0,0 +1,398 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// ListDeleteReader is a Reader for the ListDelete structure. +type ListDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/lists/{id}] listDelete", response, response.Code()) + } +} + +// NewListDeleteOK creates a ListDeleteOK with default headers values +func NewListDeleteOK() *ListDeleteOK { + return &ListDeleteOK{} +} + +/* +ListDeleteOK describes a response with status code 200, with default header values. + +list deleted +*/ +type ListDeleteOK struct { +} + +// IsSuccess returns true when this list delete o k response has a 2xx status code +func (o *ListDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list delete o k response has a 3xx status code +func (o *ListDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete o k response has a 4xx status code +func (o *ListDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list delete o k response has a 5xx status code +func (o *ListDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete o k response a status code equal to that given +func (o *ListDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list delete o k response +func (o *ListDeleteOK) Code() int { + return 200 +} + +func (o *ListDeleteOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteOK", 200) +} + +func (o *ListDeleteOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteOK", 200) +} + +func (o *ListDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteBadRequest creates a ListDeleteBadRequest with default headers values +func NewListDeleteBadRequest() *ListDeleteBadRequest { + return &ListDeleteBadRequest{} +} + +/* +ListDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListDeleteBadRequest struct { +} + +// IsSuccess returns true when this list delete bad request response has a 2xx status code +func (o *ListDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete bad request response has a 3xx status code +func (o *ListDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete bad request response has a 4xx status code +func (o *ListDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete bad request response has a 5xx status code +func (o *ListDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete bad request response a status code equal to that given +func (o *ListDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list delete bad request response +func (o *ListDeleteBadRequest) Code() int { + return 400 +} + +func (o *ListDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteBadRequest", 400) +} + +func (o *ListDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteBadRequest", 400) +} + +func (o *ListDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteUnauthorized creates a ListDeleteUnauthorized with default headers values +func NewListDeleteUnauthorized() *ListDeleteUnauthorized { + return &ListDeleteUnauthorized{} +} + +/* +ListDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListDeleteUnauthorized struct { +} + +// IsSuccess returns true when this list delete unauthorized response has a 2xx status code +func (o *ListDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete unauthorized response has a 3xx status code +func (o *ListDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete unauthorized response has a 4xx status code +func (o *ListDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete unauthorized response has a 5xx status code +func (o *ListDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete unauthorized response a status code equal to that given +func (o *ListDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list delete unauthorized response +func (o *ListDeleteUnauthorized) Code() int { + return 401 +} + +func (o *ListDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteUnauthorized", 401) +} + +func (o *ListDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteUnauthorized", 401) +} + +func (o *ListDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteNotFound creates a ListDeleteNotFound with default headers values +func NewListDeleteNotFound() *ListDeleteNotFound { + return &ListDeleteNotFound{} +} + +/* +ListDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListDeleteNotFound struct { +} + +// IsSuccess returns true when this list delete not found response has a 2xx status code +func (o *ListDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete not found response has a 3xx status code +func (o *ListDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete not found response has a 4xx status code +func (o *ListDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete not found response has a 5xx status code +func (o *ListDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete not found response a status code equal to that given +func (o *ListDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list delete not found response +func (o *ListDeleteNotFound) Code() int { + return 404 +} + +func (o *ListDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotFound", 404) +} + +func (o *ListDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotFound", 404) +} + +func (o *ListDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteNotAcceptable creates a ListDeleteNotAcceptable with default headers values +func NewListDeleteNotAcceptable() *ListDeleteNotAcceptable { + return &ListDeleteNotAcceptable{} +} + +/* +ListDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this list delete not acceptable response has a 2xx status code +func (o *ListDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete not acceptable response has a 3xx status code +func (o *ListDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete not acceptable response has a 4xx status code +func (o *ListDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list delete not acceptable response has a 5xx status code +func (o *ListDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list delete not acceptable response a status code equal to that given +func (o *ListDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list delete not acceptable response +func (o *ListDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *ListDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotAcceptable", 406) +} + +func (o *ListDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteNotAcceptable", 406) +} + +func (o *ListDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListDeleteInternalServerError creates a ListDeleteInternalServerError with default headers values +func NewListDeleteInternalServerError() *ListDeleteInternalServerError { + return &ListDeleteInternalServerError{} +} + +/* +ListDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListDeleteInternalServerError struct { +} + +// IsSuccess returns true when this list delete internal server error response has a 2xx status code +func (o *ListDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list delete internal server error response has a 3xx status code +func (o *ListDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list delete internal server error response has a 4xx status code +func (o *ListDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list delete internal server error response has a 5xx status code +func (o *ListDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list delete internal server error response a status code equal to that given +func (o *ListDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list delete internal server error response +func (o *ListDeleteInternalServerError) Code() int { + return 500 +} + +func (o *ListDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteInternalServerError", 500) +} + +func (o *ListDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}][%d] listDeleteInternalServerError", 500) +} + +func (o *ListDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/list_parameters.go b/client/lists/list_parameters.go new file mode 100644 index 0000000..213bc3b --- /dev/null +++ b/client/lists/list_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewListParams creates a new ListParams 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 NewListParams() *ListParams { + return &ListParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListParamsWithTimeout creates a new ListParams object +// with the ability to set a timeout on a request. +func NewListParamsWithTimeout(timeout time.Duration) *ListParams { + return &ListParams{ + timeout: timeout, + } +} + +// NewListParamsWithContext creates a new ListParams object +// with the ability to set a context for a request. +func NewListParamsWithContext(ctx context.Context) *ListParams { + return &ListParams{ + Context: ctx, + } +} + +// NewListParamsWithHTTPClient creates a new ListParams object +// with the ability to set a custom HTTPClient for a request. +func NewListParamsWithHTTPClient(client *http.Client) *ListParams { + return &ListParams{ + HTTPClient: client, + } +} + +/* +ListParams contains all the parameters to send to the API endpoint + + for the list operation. + + Typically these are written to a http.Request. +*/ +type ListParams struct { + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListParams) WithDefaults() *ListParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list params +func (o *ListParams) WithTimeout(timeout time.Duration) *ListParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list params +func (o *ListParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list params +func (o *ListParams) WithContext(ctx context.Context) *ListParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list params +func (o *ListParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list params +func (o *ListParams) WithHTTPClient(client *http.Client) *ListParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list params +func (o *ListParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list params +func (o *ListParams) WithID(id string) *ListParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list params +func (o *ListParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ListParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/lists/list_responses.go b/client/lists/list_responses.go new file mode 100644 index 0000000..17040c8 --- /dev/null +++ b/client/lists/list_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListReader is a Reader for the List structure. +type ListReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/lists/{id}] list", response, response.Code()) + } +} + +// NewListOK creates a ListOK with default headers values +func NewListOK() *ListOK { + return &ListOK{} +} + +/* +ListOK describes a response with status code 200, with default header values. + +Requested list. +*/ +type ListOK struct { + Payload *models.List +} + +// IsSuccess returns true when this list o k response has a 2xx status code +func (o *ListOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list o k response has a 3xx status code +func (o *ListOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list o k response has a 4xx status code +func (o *ListOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list o k response has a 5xx status code +func (o *ListOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list o k response a status code equal to that given +func (o *ListOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list o k response +func (o *ListOK) Code() int { + return 200 +} + +func (o *ListOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listOK %s", 200, payload) +} + +func (o *ListOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listOK %s", 200, payload) +} + +func (o *ListOK) GetPayload() *models.List { + return o.Payload +} + +func (o *ListOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.List) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListBadRequest creates a ListBadRequest with default headers values +func NewListBadRequest() *ListBadRequest { + return &ListBadRequest{} +} + +/* +ListBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListBadRequest struct { +} + +// IsSuccess returns true when this list bad request response has a 2xx status code +func (o *ListBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list bad request response has a 3xx status code +func (o *ListBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list bad request response has a 4xx status code +func (o *ListBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list bad request response has a 5xx status code +func (o *ListBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list bad request response a status code equal to that given +func (o *ListBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list bad request response +func (o *ListBadRequest) Code() int { + return 400 +} + +func (o *ListBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listBadRequest", 400) +} + +func (o *ListBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listBadRequest", 400) +} + +func (o *ListBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUnauthorized creates a ListUnauthorized with default headers values +func NewListUnauthorized() *ListUnauthorized { + return &ListUnauthorized{} +} + +/* +ListUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListUnauthorized struct { +} + +// IsSuccess returns true when this list unauthorized response has a 2xx status code +func (o *ListUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list unauthorized response has a 3xx status code +func (o *ListUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list unauthorized response has a 4xx status code +func (o *ListUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list unauthorized response has a 5xx status code +func (o *ListUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list unauthorized response a status code equal to that given +func (o *ListUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list unauthorized response +func (o *ListUnauthorized) Code() int { + return 401 +} + +func (o *ListUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listUnauthorized", 401) +} + +func (o *ListUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listUnauthorized", 401) +} + +func (o *ListUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListNotFound creates a ListNotFound with default headers values +func NewListNotFound() *ListNotFound { + return &ListNotFound{} +} + +/* +ListNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListNotFound struct { +} + +// IsSuccess returns true when this list not found response has a 2xx status code +func (o *ListNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list not found response has a 3xx status code +func (o *ListNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list not found response has a 4xx status code +func (o *ListNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list not found response has a 5xx status code +func (o *ListNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list not found response a status code equal to that given +func (o *ListNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list not found response +func (o *ListNotFound) Code() int { + return 404 +} + +func (o *ListNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotFound", 404) +} + +func (o *ListNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotFound", 404) +} + +func (o *ListNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListNotAcceptable creates a ListNotAcceptable with default headers values +func NewListNotAcceptable() *ListNotAcceptable { + return &ListNotAcceptable{} +} + +/* +ListNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListNotAcceptable struct { +} + +// IsSuccess returns true when this list not acceptable response has a 2xx status code +func (o *ListNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list not acceptable response has a 3xx status code +func (o *ListNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list not acceptable response has a 4xx status code +func (o *ListNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list not acceptable response has a 5xx status code +func (o *ListNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list not acceptable response a status code equal to that given +func (o *ListNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list not acceptable response +func (o *ListNotAcceptable) Code() int { + return 406 +} + +func (o *ListNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotAcceptable", 406) +} + +func (o *ListNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listNotAcceptable", 406) +} + +func (o *ListNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListInternalServerError creates a ListInternalServerError with default headers values +func NewListInternalServerError() *ListInternalServerError { + return &ListInternalServerError{} +} + +/* +ListInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListInternalServerError struct { +} + +// IsSuccess returns true when this list internal server error response has a 2xx status code +func (o *ListInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list internal server error response has a 3xx status code +func (o *ListInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list internal server error response has a 4xx status code +func (o *ListInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list internal server error response has a 5xx status code +func (o *ListInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list internal server error response a status code equal to that given +func (o *ListInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list internal server error response +func (o *ListInternalServerError) Code() int { + return 500 +} + +func (o *ListInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listInternalServerError", 500) +} + +func (o *ListInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/lists/{id}][%d] listInternalServerError", 500) +} + +func (o *ListInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/list_update_parameters.go b/client/lists/list_update_parameters.go new file mode 100644 index 0000000..7302251 --- /dev/null +++ b/client/lists/list_update_parameters.go @@ -0,0 +1,220 @@ +// 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" +) + +// NewListUpdateParams creates a new ListUpdateParams 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 NewListUpdateParams() *ListUpdateParams { + return &ListUpdateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListUpdateParamsWithTimeout creates a new ListUpdateParams object +// with the ability to set a timeout on a request. +func NewListUpdateParamsWithTimeout(timeout time.Duration) *ListUpdateParams { + return &ListUpdateParams{ + timeout: timeout, + } +} + +// NewListUpdateParamsWithContext creates a new ListUpdateParams object +// with the ability to set a context for a request. +func NewListUpdateParamsWithContext(ctx context.Context) *ListUpdateParams { + return &ListUpdateParams{ + Context: ctx, + } +} + +// NewListUpdateParamsWithHTTPClient creates a new ListUpdateParams object +// with the ability to set a custom HTTPClient for a request. +func NewListUpdateParamsWithHTTPClient(client *http.Client) *ListUpdateParams { + return &ListUpdateParams{ + HTTPClient: client, + } +} + +/* +ListUpdateParams contains all the parameters to send to the API endpoint + + for the list update operation. + + Typically these are written to a http.Request. +*/ +type ListUpdateParams struct { + + /* ID. + + ID of the list + */ + ID string + + /* 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 + */ + 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 update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListUpdateParams) WithDefaults() *ListUpdateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list update params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListUpdateParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the list update params +func (o *ListUpdateParams) WithTimeout(timeout time.Duration) *ListUpdateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list update params +func (o *ListUpdateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list update params +func (o *ListUpdateParams) WithContext(ctx context.Context) *ListUpdateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list update params +func (o *ListUpdateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list update params +func (o *ListUpdateParams) WithHTTPClient(client *http.Client) *ListUpdateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list update params +func (o *ListUpdateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list update params +func (o *ListUpdateParams) WithID(id string) *ListUpdateParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list update params +func (o *ListUpdateParams) SetID(id string) { + o.ID = id +} + +// WithRepliesPolicy adds the repliesPolicy to the list update params +func (o *ListUpdateParams) WithRepliesPolicy(repliesPolicy *string) *ListUpdateParams { + o.SetRepliesPolicy(repliesPolicy) + return o +} + +// SetRepliesPolicy adds the repliesPolicy to the list update params +func (o *ListUpdateParams) SetRepliesPolicy(repliesPolicy *string) { + o.RepliesPolicy = repliesPolicy +} + +// WithTitle adds the title to the list update params +func (o *ListUpdateParams) WithTitle(title *string) *ListUpdateParams { + o.SetTitle(title) + return o +} + +// SetTitle adds the title to the list update params +func (o *ListUpdateParams) SetTitle(title *string) { + o.Title = title +} + +// WriteToRequest writes these params to a swagger request +func (o *ListUpdateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + 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 + } + } + } + + if o.Title != nil { + + // form param title + var frTitle string + if o.Title != nil { + 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 +} diff --git a/client/lists/list_update_responses.go b/client/lists/list_update_responses.go new file mode 100644 index 0000000..e40bcd4 --- /dev/null +++ b/client/lists/list_update_responses.go @@ -0,0 +1,478 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListUpdateReader is a Reader for the ListUpdate structure. +type ListUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewListUpdateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v1/lists/{id}] listUpdate", response, response.Code()) + } +} + +// NewListUpdateOK creates a ListUpdateOK with default headers values +func NewListUpdateOK() *ListUpdateOK { + return &ListUpdateOK{} +} + +/* +ListUpdateOK describes a response with status code 200, with default header values. + +The newly updated list. +*/ +type ListUpdateOK struct { + Payload *models.List +} + +// IsSuccess returns true when this list update o k response has a 2xx status code +func (o *ListUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list update o k response has a 3xx status code +func (o *ListUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update o k response has a 4xx status code +func (o *ListUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list update o k response has a 5xx status code +func (o *ListUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list update o k response a status code equal to that given +func (o *ListUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list update o k response +func (o *ListUpdateOK) Code() int { + return 200 +} + +func (o *ListUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateOK %s", 200, payload) +} + +func (o *ListUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateOK %s", 200, payload) +} + +func (o *ListUpdateOK) GetPayload() *models.List { + return o.Payload +} + +func (o *ListUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.List) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListUpdateBadRequest creates a ListUpdateBadRequest with default headers values +func NewListUpdateBadRequest() *ListUpdateBadRequest { + return &ListUpdateBadRequest{} +} + +/* +ListUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListUpdateBadRequest struct { +} + +// IsSuccess returns true when this list update bad request response has a 2xx status code +func (o *ListUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update bad request response has a 3xx status code +func (o *ListUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update bad request response has a 4xx status code +func (o *ListUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update bad request response has a 5xx status code +func (o *ListUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list update bad request response a status code equal to that given +func (o *ListUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list update bad request response +func (o *ListUpdateBadRequest) Code() int { + return 400 +} + +func (o *ListUpdateBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateBadRequest", 400) +} + +func (o *ListUpdateBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateBadRequest", 400) +} + +func (o *ListUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateUnauthorized creates a ListUpdateUnauthorized with default headers values +func NewListUpdateUnauthorized() *ListUpdateUnauthorized { + return &ListUpdateUnauthorized{} +} + +/* +ListUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListUpdateUnauthorized struct { +} + +// IsSuccess returns true when this list update unauthorized response has a 2xx status code +func (o *ListUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update unauthorized response has a 3xx status code +func (o *ListUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update unauthorized response has a 4xx status code +func (o *ListUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update unauthorized response has a 5xx status code +func (o *ListUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list update unauthorized response a status code equal to that given +func (o *ListUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list update unauthorized response +func (o *ListUpdateUnauthorized) Code() int { + return 401 +} + +func (o *ListUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateUnauthorized", 401) +} + +func (o *ListUpdateUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateUnauthorized", 401) +} + +func (o *ListUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateForbidden creates a ListUpdateForbidden with default headers values +func NewListUpdateForbidden() *ListUpdateForbidden { + return &ListUpdateForbidden{} +} + +/* +ListUpdateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type ListUpdateForbidden struct { +} + +// IsSuccess returns true when this list update forbidden response has a 2xx status code +func (o *ListUpdateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update forbidden response has a 3xx status code +func (o *ListUpdateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update forbidden response has a 4xx status code +func (o *ListUpdateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update forbidden response has a 5xx status code +func (o *ListUpdateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this list update forbidden response a status code equal to that given +func (o *ListUpdateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the list update forbidden response +func (o *ListUpdateForbidden) Code() int { + return 403 +} + +func (o *ListUpdateForbidden) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateForbidden", 403) +} + +func (o *ListUpdateForbidden) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateForbidden", 403) +} + +func (o *ListUpdateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateNotFound creates a ListUpdateNotFound with default headers values +func NewListUpdateNotFound() *ListUpdateNotFound { + return &ListUpdateNotFound{} +} + +/* +ListUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListUpdateNotFound struct { +} + +// IsSuccess returns true when this list update not found response has a 2xx status code +func (o *ListUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update not found response has a 3xx status code +func (o *ListUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update not found response has a 4xx status code +func (o *ListUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update not found response has a 5xx status code +func (o *ListUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this list update not found response a status code equal to that given +func (o *ListUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the list update not found response +func (o *ListUpdateNotFound) Code() int { + return 404 +} + +func (o *ListUpdateNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotFound", 404) +} + +func (o *ListUpdateNotFound) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotFound", 404) +} + +func (o *ListUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateNotAcceptable creates a ListUpdateNotAcceptable with default headers values +func NewListUpdateNotAcceptable() *ListUpdateNotAcceptable { + return &ListUpdateNotAcceptable{} +} + +/* +ListUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this list update not acceptable response has a 2xx status code +func (o *ListUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update not acceptable response has a 3xx status code +func (o *ListUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update not acceptable response has a 4xx status code +func (o *ListUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this list update not acceptable response has a 5xx status code +func (o *ListUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this list update not acceptable response a status code equal to that given +func (o *ListUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the list update not acceptable response +func (o *ListUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *ListUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotAcceptable", 406) +} + +func (o *ListUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateNotAcceptable", 406) +} + +func (o *ListUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListUpdateInternalServerError creates a ListUpdateInternalServerError with default headers values +func NewListUpdateInternalServerError() *ListUpdateInternalServerError { + return &ListUpdateInternalServerError{} +} + +/* +ListUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListUpdateInternalServerError struct { +} + +// IsSuccess returns true when this list update internal server error response has a 2xx status code +func (o *ListUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list update internal server error response has a 3xx status code +func (o *ListUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list update internal server error response has a 4xx status code +func (o *ListUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this list update internal server error response has a 5xx status code +func (o *ListUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this list update internal server error response a status code equal to that given +func (o *ListUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the list update internal server error response +func (o *ListUpdateInternalServerError) Code() int { + return 500 +} + +func (o *ListUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateInternalServerError", 500) +} + +func (o *ListUpdateInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v1/lists/{id}][%d] listUpdateInternalServerError", 500) +} + +func (o *ListUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/lists_client.go b/client/lists/lists_client.go new file mode 100644 index 0000000..f4d930b --- /dev/null +++ b/client/lists/lists_client.go @@ -0,0 +1,430 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new lists API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new lists API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new lists API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for lists API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + AddListAccounts(params *AddListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddListAccountsOK, error) + + List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error) + + ListAccounts(params *ListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAccountsOK, error) + + ListCreate(params *ListCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCreateOK, error) + + ListDelete(params *ListDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListDeleteOK, error) + + ListUpdate(params *ListUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUpdateOK, error) + + Lists(params *ListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListsOK, error) + + RemoveListAccounts(params *RemoveListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoveListAccountsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +AddListAccounts adds one or more accounts to the given list +*/ +func (a *Client) AddListAccounts(params *AddListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*AddListAccountsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewAddListAccountsParams() + } + op := &runtime.ClientOperation{ + ID: "addListAccounts", + Method: "POST", + PathPattern: "/api/v1/lists/{id}/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &AddListAccountsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*AddListAccountsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for addListAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +List gets a single list with the given ID +*/ +func (a *Client) List(params *ListParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListParams() + } + op := &runtime.ClientOperation{ + ID: "list", + Method: "GET", + PathPattern: "/api/v1/lists/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for list: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ListAccounts pages through accounts in this list + + The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) ListAccounts(params *ListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListAccountsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListAccountsParams() + } + op := &runtime.ClientOperation{ + ID: "listAccounts", + Method: "GET", + PathPattern: "/api/v1/lists/{id}/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListAccountsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListAccountsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for listAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListCreate creates a new list +*/ +func (a *Client) ListCreate(params *ListCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListCreateParams() + } + op := &runtime.ClientOperation{ + ID: "listCreate", + Method: "POST", + PathPattern: "/api/v1/lists", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for listCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListDelete deletes a single list with the given ID +*/ +func (a *Client) ListDelete(params *ListDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "listDelete", + Method: "DELETE", + PathPattern: "/api/v1/lists/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for listDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ListUpdate updates an existing list +*/ +func (a *Client) ListUpdate(params *ListUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "listUpdate", + Method: "PUT", + PathPattern: "/api/v1/lists/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListUpdateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for listUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +Lists gets all lists for owned by authorized user +*/ +func (a *Client) Lists(params *ListsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListsParams() + } + op := &runtime.ClientOperation{ + ID: "lists", + Method: "GET", + PathPattern: "/api/v1/lists", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for lists: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +RemoveListAccounts removes one or more accounts from the given list +*/ +func (a *Client) RemoveListAccounts(params *RemoveListAccountsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*RemoveListAccountsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewRemoveListAccountsParams() + } + op := &runtime.ClientOperation{ + ID: "removeListAccounts", + Method: "DELETE", + PathPattern: "/api/v1/lists/{id}/accounts", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &RemoveListAccountsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*RemoveListAccountsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for removeListAccounts: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/lists/lists_parameters.go b/client/lists/lists_parameters.go new file mode 100644 index 0000000..829d8f8 --- /dev/null +++ b/client/lists/lists_parameters.go @@ -0,0 +1,128 @@ +// 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" +) + +// NewListsParams creates a new ListsParams 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 NewListsParams() *ListsParams { + return &ListsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListsParamsWithTimeout creates a new ListsParams object +// with the ability to set a timeout on a request. +func NewListsParamsWithTimeout(timeout time.Duration) *ListsParams { + return &ListsParams{ + timeout: timeout, + } +} + +// NewListsParamsWithContext creates a new ListsParams object +// with the ability to set a context for a request. +func NewListsParamsWithContext(ctx context.Context) *ListsParams { + return &ListsParams{ + Context: ctx, + } +} + +// NewListsParamsWithHTTPClient creates a new ListsParams object +// with the ability to set a custom HTTPClient for a request. +func NewListsParamsWithHTTPClient(client *http.Client) *ListsParams { + return &ListsParams{ + HTTPClient: client, + } +} + +/* +ListsParams contains all the parameters to send to the API endpoint + + for the lists operation. + + Typically these are written to a http.Request. +*/ +type ListsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListsParams) WithDefaults() *ListsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the lists params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the lists params +func (o *ListsParams) WithTimeout(timeout time.Duration) *ListsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the lists params +func (o *ListsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the lists params +func (o *ListsParams) WithContext(ctx context.Context) *ListsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the lists params +func (o *ListsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the lists params +func (o *ListsParams) WithHTTPClient(client *http.Client) *ListsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the lists params +func (o *ListsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ListsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/lists/lists_responses.go b/client/lists/lists_responses.go new file mode 100644 index 0000000..dd5327f --- /dev/null +++ b/client/lists/lists_responses.go @@ -0,0 +1,414 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListsReader is a Reader for the Lists structure. +type ListsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewListsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewListsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewListsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/lists] lists", response, response.Code()) + } +} + +// NewListsOK creates a ListsOK with default headers values +func NewListsOK() *ListsOK { + return &ListsOK{} +} + +/* +ListsOK describes a response with status code 200, with default header values. + +Array of all lists owned by the requesting user. +*/ +type ListsOK struct { + Payload []*models.List +} + +// IsSuccess returns true when this lists o k response has a 2xx status code +func (o *ListsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this lists o k response has a 3xx status code +func (o *ListsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists o k response has a 4xx status code +func (o *ListsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this lists o k response has a 5xx status code +func (o *ListsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this lists o k response a status code equal to that given +func (o *ListsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the lists o k response +func (o *ListsOK) Code() int { + return 200 +} + +func (o *ListsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists][%d] listsOK %s", 200, payload) +} + +func (o *ListsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/lists][%d] listsOK %s", 200, payload) +} + +func (o *ListsOK) GetPayload() []*models.List { + return o.Payload +} + +func (o *ListsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListsBadRequest creates a ListsBadRequest with default headers values +func NewListsBadRequest() *ListsBadRequest { + return &ListsBadRequest{} +} + +/* +ListsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListsBadRequest struct { +} + +// IsSuccess returns true when this lists bad request response has a 2xx status code +func (o *ListsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists bad request response has a 3xx status code +func (o *ListsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists bad request response has a 4xx status code +func (o *ListsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists bad request response has a 5xx status code +func (o *ListsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this lists bad request response a status code equal to that given +func (o *ListsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the lists bad request response +func (o *ListsBadRequest) Code() int { + return 400 +} + +func (o *ListsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsBadRequest", 400) +} + +func (o *ListsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsBadRequest", 400) +} + +func (o *ListsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsUnauthorized creates a ListsUnauthorized with default headers values +func NewListsUnauthorized() *ListsUnauthorized { + return &ListsUnauthorized{} +} + +/* +ListsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListsUnauthorized struct { +} + +// IsSuccess returns true when this lists unauthorized response has a 2xx status code +func (o *ListsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists unauthorized response has a 3xx status code +func (o *ListsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists unauthorized response has a 4xx status code +func (o *ListsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists unauthorized response has a 5xx status code +func (o *ListsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this lists unauthorized response a status code equal to that given +func (o *ListsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the lists unauthorized response +func (o *ListsUnauthorized) Code() int { + return 401 +} + +func (o *ListsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsUnauthorized", 401) +} + +func (o *ListsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsUnauthorized", 401) +} + +func (o *ListsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsNotFound creates a ListsNotFound with default headers values +func NewListsNotFound() *ListsNotFound { + return &ListsNotFound{} +} + +/* +ListsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ListsNotFound struct { +} + +// IsSuccess returns true when this lists not found response has a 2xx status code +func (o *ListsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists not found response has a 3xx status code +func (o *ListsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists not found response has a 4xx status code +func (o *ListsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists not found response has a 5xx status code +func (o *ListsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this lists not found response a status code equal to that given +func (o *ListsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the lists not found response +func (o *ListsNotFound) Code() int { + return 404 +} + +func (o *ListsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotFound", 404) +} + +func (o *ListsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotFound", 404) +} + +func (o *ListsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsNotAcceptable creates a ListsNotAcceptable with default headers values +func NewListsNotAcceptable() *ListsNotAcceptable { + return &ListsNotAcceptable{} +} + +/* +ListsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ListsNotAcceptable struct { +} + +// IsSuccess returns true when this lists not acceptable response has a 2xx status code +func (o *ListsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists not acceptable response has a 3xx status code +func (o *ListsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists not acceptable response has a 4xx status code +func (o *ListsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this lists not acceptable response has a 5xx status code +func (o *ListsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this lists not acceptable response a status code equal to that given +func (o *ListsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the lists not acceptable response +func (o *ListsNotAcceptable) Code() int { + return 406 +} + +func (o *ListsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotAcceptable", 406) +} + +func (o *ListsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsNotAcceptable", 406) +} + +func (o *ListsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListsInternalServerError creates a ListsInternalServerError with default headers values +func NewListsInternalServerError() *ListsInternalServerError { + return &ListsInternalServerError{} +} + +/* +ListsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ListsInternalServerError struct { +} + +// IsSuccess returns true when this lists internal server error response has a 2xx status code +func (o *ListsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this lists internal server error response has a 3xx status code +func (o *ListsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this lists internal server error response has a 4xx status code +func (o *ListsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this lists internal server error response has a 5xx status code +func (o *ListsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this lists internal server error response a status code equal to that given +func (o *ListsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the lists internal server error response +func (o *ListsInternalServerError) Code() int { + return 500 +} + +func (o *ListsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsInternalServerError", 500) +} + +func (o *ListsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/lists][%d] listsInternalServerError", 500) +} + +func (o *ListsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/lists/remove_list_accounts_parameters.go b/client/lists/remove_list_accounts_parameters.go new file mode 100644 index 0000000..f8527f0 --- /dev/null +++ b/client/lists/remove_list_accounts_parameters.go @@ -0,0 +1,197 @@ +// 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" + "github.com/go-openapi/swag" +) + +// NewRemoveListAccountsParams creates a new RemoveListAccountsParams 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 NewRemoveListAccountsParams() *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewRemoveListAccountsParamsWithTimeout creates a new RemoveListAccountsParams object +// with the ability to set a timeout on a request. +func NewRemoveListAccountsParamsWithTimeout(timeout time.Duration) *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + timeout: timeout, + } +} + +// NewRemoveListAccountsParamsWithContext creates a new RemoveListAccountsParams object +// with the ability to set a context for a request. +func NewRemoveListAccountsParamsWithContext(ctx context.Context) *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + Context: ctx, + } +} + +// NewRemoveListAccountsParamsWithHTTPClient creates a new RemoveListAccountsParams object +// with the ability to set a custom HTTPClient for a request. +func NewRemoveListAccountsParamsWithHTTPClient(client *http.Client) *RemoveListAccountsParams { + return &RemoveListAccountsParams{ + HTTPClient: client, + } +} + +/* +RemoveListAccountsParams contains all the parameters to send to the API endpoint + + for the remove list accounts operation. + + Typically these are written to a http.Request. +*/ +type RemoveListAccountsParams struct { + + /* AccountIds. + + Array of accountIDs to modify. Each accountID must correspond to an account that the requesting account follows. + */ + AccountIds []string + + /* ID. + + ID of the list + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the remove list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RemoveListAccountsParams) WithDefaults() *RemoveListAccountsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the remove list accounts params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *RemoveListAccountsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the remove list accounts params +func (o *RemoveListAccountsParams) WithTimeout(timeout time.Duration) *RemoveListAccountsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the remove list accounts params +func (o *RemoveListAccountsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the remove list accounts params +func (o *RemoveListAccountsParams) WithContext(ctx context.Context) *RemoveListAccountsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the remove list accounts params +func (o *RemoveListAccountsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the remove list accounts params +func (o *RemoveListAccountsParams) WithHTTPClient(client *http.Client) *RemoveListAccountsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the remove list accounts params +func (o *RemoveListAccountsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountIds adds the accountIds to the remove list accounts params +func (o *RemoveListAccountsParams) WithAccountIds(accountIds []string) *RemoveListAccountsParams { + o.SetAccountIds(accountIds) + return o +} + +// SetAccountIds adds the accountIds to the remove list accounts params +func (o *RemoveListAccountsParams) SetAccountIds(accountIds []string) { + o.AccountIds = accountIds +} + +// WithID adds the id to the remove list accounts params +func (o *RemoveListAccountsParams) WithID(id string) *RemoveListAccountsParams { + o.SetID(id) + return o +} + +// SetID adds the id to the remove list accounts params +func (o *RemoveListAccountsParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *RemoveListAccountsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountIds != nil { + + // binding items for account_ids[] + joinedAccountIds := o.bindParamAccountIds(reg) + + // form array param account_ids[] + if err := r.SetFormParam("account_ids[]", joinedAccountIds...); 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 +} + +// bindParamRemoveListAccounts binds the parameter account_ids[] +func (o *RemoveListAccountsParams) bindParamAccountIds(formats strfmt.Registry) []string { + accountIdsIR := o.AccountIds + + var accountIdsIC []string + for _, accountIdsIIR := range accountIdsIR { // explode []string + + accountIdsIIV := accountIdsIIR // string as string + accountIdsIC = append(accountIdsIC, accountIdsIIV) + } + + // items.CollectionFormat: "multi" + accountIdsIS := swag.JoinByFormat(accountIdsIC, "multi") + + return accountIdsIS +} diff --git a/client/lists/remove_list_accounts_responses.go b/client/lists/remove_list_accounts_responses.go new file mode 100644 index 0000000..53926ed --- /dev/null +++ b/client/lists/remove_list_accounts_responses.go @@ -0,0 +1,398 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// RemoveListAccountsReader is a Reader for the RemoveListAccounts structure. +type RemoveListAccountsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *RemoveListAccountsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewRemoveListAccountsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewRemoveListAccountsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewRemoveListAccountsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewRemoveListAccountsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewRemoveListAccountsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewRemoveListAccountsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/lists/{id}/accounts] removeListAccounts", response, response.Code()) + } +} + +// NewRemoveListAccountsOK creates a RemoveListAccountsOK with default headers values +func NewRemoveListAccountsOK() *RemoveListAccountsOK { + return &RemoveListAccountsOK{} +} + +/* +RemoveListAccountsOK describes a response with status code 200, with default header values. + +list accounts updated +*/ +type RemoveListAccountsOK struct { +} + +// IsSuccess returns true when this remove list accounts o k response has a 2xx status code +func (o *RemoveListAccountsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this remove list accounts o k response has a 3xx status code +func (o *RemoveListAccountsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts o k response has a 4xx status code +func (o *RemoveListAccountsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this remove list accounts o k response has a 5xx status code +func (o *RemoveListAccountsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts o k response a status code equal to that given +func (o *RemoveListAccountsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the remove list accounts o k response +func (o *RemoveListAccountsOK) Code() int { + return 200 +} + +func (o *RemoveListAccountsOK) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsOK", 200) +} + +func (o *RemoveListAccountsOK) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsOK", 200) +} + +func (o *RemoveListAccountsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsBadRequest creates a RemoveListAccountsBadRequest with default headers values +func NewRemoveListAccountsBadRequest() *RemoveListAccountsBadRequest { + return &RemoveListAccountsBadRequest{} +} + +/* +RemoveListAccountsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type RemoveListAccountsBadRequest struct { +} + +// IsSuccess returns true when this remove list accounts bad request response has a 2xx status code +func (o *RemoveListAccountsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts bad request response has a 3xx status code +func (o *RemoveListAccountsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts bad request response has a 4xx status code +func (o *RemoveListAccountsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts bad request response has a 5xx status code +func (o *RemoveListAccountsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts bad request response a status code equal to that given +func (o *RemoveListAccountsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the remove list accounts bad request response +func (o *RemoveListAccountsBadRequest) Code() int { + return 400 +} + +func (o *RemoveListAccountsBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsBadRequest", 400) +} + +func (o *RemoveListAccountsBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsBadRequest", 400) +} + +func (o *RemoveListAccountsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsUnauthorized creates a RemoveListAccountsUnauthorized with default headers values +func NewRemoveListAccountsUnauthorized() *RemoveListAccountsUnauthorized { + return &RemoveListAccountsUnauthorized{} +} + +/* +RemoveListAccountsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type RemoveListAccountsUnauthorized struct { +} + +// IsSuccess returns true when this remove list accounts unauthorized response has a 2xx status code +func (o *RemoveListAccountsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts unauthorized response has a 3xx status code +func (o *RemoveListAccountsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts unauthorized response has a 4xx status code +func (o *RemoveListAccountsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts unauthorized response has a 5xx status code +func (o *RemoveListAccountsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts unauthorized response a status code equal to that given +func (o *RemoveListAccountsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the remove list accounts unauthorized response +func (o *RemoveListAccountsUnauthorized) Code() int { + return 401 +} + +func (o *RemoveListAccountsUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsUnauthorized", 401) +} + +func (o *RemoveListAccountsUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsUnauthorized", 401) +} + +func (o *RemoveListAccountsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsNotFound creates a RemoveListAccountsNotFound with default headers values +func NewRemoveListAccountsNotFound() *RemoveListAccountsNotFound { + return &RemoveListAccountsNotFound{} +} + +/* +RemoveListAccountsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type RemoveListAccountsNotFound struct { +} + +// IsSuccess returns true when this remove list accounts not found response has a 2xx status code +func (o *RemoveListAccountsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts not found response has a 3xx status code +func (o *RemoveListAccountsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts not found response has a 4xx status code +func (o *RemoveListAccountsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts not found response has a 5xx status code +func (o *RemoveListAccountsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts not found response a status code equal to that given +func (o *RemoveListAccountsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the remove list accounts not found response +func (o *RemoveListAccountsNotFound) Code() int { + return 404 +} + +func (o *RemoveListAccountsNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotFound", 404) +} + +func (o *RemoveListAccountsNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotFound", 404) +} + +func (o *RemoveListAccountsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsNotAcceptable creates a RemoveListAccountsNotAcceptable with default headers values +func NewRemoveListAccountsNotAcceptable() *RemoveListAccountsNotAcceptable { + return &RemoveListAccountsNotAcceptable{} +} + +/* +RemoveListAccountsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type RemoveListAccountsNotAcceptable struct { +} + +// IsSuccess returns true when this remove list accounts not acceptable response has a 2xx status code +func (o *RemoveListAccountsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts not acceptable response has a 3xx status code +func (o *RemoveListAccountsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts not acceptable response has a 4xx status code +func (o *RemoveListAccountsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this remove list accounts not acceptable response has a 5xx status code +func (o *RemoveListAccountsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this remove list accounts not acceptable response a status code equal to that given +func (o *RemoveListAccountsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the remove list accounts not acceptable response +func (o *RemoveListAccountsNotAcceptable) Code() int { + return 406 +} + +func (o *RemoveListAccountsNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotAcceptable", 406) +} + +func (o *RemoveListAccountsNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsNotAcceptable", 406) +} + +func (o *RemoveListAccountsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewRemoveListAccountsInternalServerError creates a RemoveListAccountsInternalServerError with default headers values +func NewRemoveListAccountsInternalServerError() *RemoveListAccountsInternalServerError { + return &RemoveListAccountsInternalServerError{} +} + +/* +RemoveListAccountsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type RemoveListAccountsInternalServerError struct { +} + +// IsSuccess returns true when this remove list accounts internal server error response has a 2xx status code +func (o *RemoveListAccountsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this remove list accounts internal server error response has a 3xx status code +func (o *RemoveListAccountsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this remove list accounts internal server error response has a 4xx status code +func (o *RemoveListAccountsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this remove list accounts internal server error response has a 5xx status code +func (o *RemoveListAccountsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this remove list accounts internal server error response a status code equal to that given +func (o *RemoveListAccountsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the remove list accounts internal server error response +func (o *RemoveListAccountsInternalServerError) Code() int { + return 500 +} + +func (o *RemoveListAccountsInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsInternalServerError", 500) +} + +func (o *RemoveListAccountsInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/lists/{id}/accounts][%d] removeListAccountsInternalServerError", 500) +} + +func (o *RemoveListAccountsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/markers/markers_client.go b/client/markers/markers_client.go new file mode 100644 index 0000000..f0a8636 --- /dev/null +++ b/client/markers/markers_client.go @@ -0,0 +1,171 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new markers API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new markers API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new markers API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for markers API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + MarkersGet(params *MarkersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersGetOK, error) + + MarkersPost(params *MarkersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersPostOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +MarkersGet Get timeline markers by name +*/ +func (a *Client) MarkersGet(params *MarkersGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMarkersGetParams() + } + op := &runtime.ClientOperation{ + ID: "markersGet", + Method: "GET", + PathPattern: "/api/v1/markers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MarkersGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MarkersGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for markersGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +MarkersPost Update timeline markers by name +*/ +func (a *Client) MarkersPost(params *MarkersPostParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MarkersPostOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMarkersPostParams() + } + op := &runtime.ClientOperation{ + ID: "markersPost", + Method: "POST", + PathPattern: "/api/v1/markers", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MarkersPostReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MarkersPostOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for markersPost: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/markers/markers_get_parameters.go b/client/markers/markers_get_parameters.go new file mode 100644 index 0000000..b3b3b31 --- /dev/null +++ b/client/markers/markers_get_parameters.go @@ -0,0 +1,175 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// 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" +) + +// NewMarkersGetParams creates a new MarkersGetParams 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 NewMarkersGetParams() *MarkersGetParams { + return &MarkersGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMarkersGetParamsWithTimeout creates a new MarkersGetParams object +// with the ability to set a timeout on a request. +func NewMarkersGetParamsWithTimeout(timeout time.Duration) *MarkersGetParams { + return &MarkersGetParams{ + timeout: timeout, + } +} + +// NewMarkersGetParamsWithContext creates a new MarkersGetParams object +// with the ability to set a context for a request. +func NewMarkersGetParamsWithContext(ctx context.Context) *MarkersGetParams { + return &MarkersGetParams{ + Context: ctx, + } +} + +// NewMarkersGetParamsWithHTTPClient creates a new MarkersGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewMarkersGetParamsWithHTTPClient(client *http.Client) *MarkersGetParams { + return &MarkersGetParams{ + HTTPClient: client, + } +} + +/* +MarkersGetParams contains all the parameters to send to the API endpoint + + for the markers get operation. + + Typically these are written to a http.Request. +*/ +type MarkersGetParams struct { + + /* Timeline. + + Timelines to retrieve. + */ + Timeline []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the markers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersGetParams) WithDefaults() *MarkersGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the markers get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the markers get params +func (o *MarkersGetParams) WithTimeout(timeout time.Duration) *MarkersGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the markers get params +func (o *MarkersGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the markers get params +func (o *MarkersGetParams) WithContext(ctx context.Context) *MarkersGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the markers get params +func (o *MarkersGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the markers get params +func (o *MarkersGetParams) WithHTTPClient(client *http.Client) *MarkersGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the markers get params +func (o *MarkersGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithTimeline adds the timeline to the markers get params +func (o *MarkersGetParams) WithTimeline(timeline []string) *MarkersGetParams { + o.SetTimeline(timeline) + return o +} + +// SetTimeline adds the timeline to the markers get params +func (o *MarkersGetParams) SetTimeline(timeline []string) { + o.Timeline = timeline +} + +// WriteToRequest writes these params to a swagger request +func (o *MarkersGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Timeline != nil { + + // binding items for timeline + joinedTimeline := o.bindParamTimeline(reg) + + // query array param timeline + if err := r.SetQueryParam("timeline", joinedTimeline...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamMarkersGet binds the parameter timeline +func (o *MarkersGetParams) bindParamTimeline(formats strfmt.Registry) []string { + timelineIR := o.Timeline + + var timelineIC []string + for _, timelineIIR := range timelineIR { // explode []string + + timelineIIV := timelineIIR // string as string + timelineIC = append(timelineIC, timelineIIV) + } + + // items.CollectionFormat: "" + timelineIS := swag.JoinByFormat(timelineIC, "") + + return timelineIS +} diff --git a/client/markers/markers_get_responses.go b/client/markers/markers_get_responses.go new file mode 100644 index 0000000..7f88c80 --- /dev/null +++ b/client/markers/markers_get_responses.go @@ -0,0 +1,292 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MarkersGetReader is a Reader for the MarkersGet structure. +type MarkersGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MarkersGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMarkersGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMarkersGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMarkersGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMarkersGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/markers] markersGet", response, response.Code()) + } +} + +// NewMarkersGetOK creates a MarkersGetOK with default headers values +func NewMarkersGetOK() *MarkersGetOK { + return &MarkersGetOK{} +} + +/* +MarkersGetOK describes a response with status code 200, with default header values. + +Requested markers +*/ +type MarkersGetOK struct { + Payload *models.Marker +} + +// IsSuccess returns true when this markers get o k response has a 2xx status code +func (o *MarkersGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this markers get o k response has a 3xx status code +func (o *MarkersGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get o k response has a 4xx status code +func (o *MarkersGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers get o k response has a 5xx status code +func (o *MarkersGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this markers get o k response a status code equal to that given +func (o *MarkersGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the markers get o k response +func (o *MarkersGetOK) Code() int { + return 200 +} + +func (o *MarkersGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetOK %s", 200, payload) +} + +func (o *MarkersGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetOK %s", 200, payload) +} + +func (o *MarkersGetOK) GetPayload() *models.Marker { + return o.Payload +} + +func (o *MarkersGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Marker) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMarkersGetBadRequest creates a MarkersGetBadRequest with default headers values +func NewMarkersGetBadRequest() *MarkersGetBadRequest { + return &MarkersGetBadRequest{} +} + +/* +MarkersGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MarkersGetBadRequest struct { +} + +// IsSuccess returns true when this markers get bad request response has a 2xx status code +func (o *MarkersGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers get bad request response has a 3xx status code +func (o *MarkersGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get bad request response has a 4xx status code +func (o *MarkersGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers get bad request response has a 5xx status code +func (o *MarkersGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this markers get bad request response a status code equal to that given +func (o *MarkersGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the markers get bad request response +func (o *MarkersGetBadRequest) Code() int { + return 400 +} + +func (o *MarkersGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetBadRequest", 400) +} + +func (o *MarkersGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetBadRequest", 400) +} + +func (o *MarkersGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersGetUnauthorized creates a MarkersGetUnauthorized with default headers values +func NewMarkersGetUnauthorized() *MarkersGetUnauthorized { + return &MarkersGetUnauthorized{} +} + +/* +MarkersGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MarkersGetUnauthorized struct { +} + +// IsSuccess returns true when this markers get unauthorized response has a 2xx status code +func (o *MarkersGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers get unauthorized response has a 3xx status code +func (o *MarkersGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get unauthorized response has a 4xx status code +func (o *MarkersGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers get unauthorized response has a 5xx status code +func (o *MarkersGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this markers get unauthorized response a status code equal to that given +func (o *MarkersGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the markers get unauthorized response +func (o *MarkersGetUnauthorized) Code() int { + return 401 +} + +func (o *MarkersGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetUnauthorized", 401) +} + +func (o *MarkersGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetUnauthorized", 401) +} + +func (o *MarkersGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersGetInternalServerError creates a MarkersGetInternalServerError with default headers values +func NewMarkersGetInternalServerError() *MarkersGetInternalServerError { + return &MarkersGetInternalServerError{} +} + +/* +MarkersGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MarkersGetInternalServerError struct { +} + +// IsSuccess returns true when this markers get internal server error response has a 2xx status code +func (o *MarkersGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers get internal server error response has a 3xx status code +func (o *MarkersGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers get internal server error response has a 4xx status code +func (o *MarkersGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers get internal server error response has a 5xx status code +func (o *MarkersGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this markers get internal server error response a status code equal to that given +func (o *MarkersGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the markers get internal server error response +func (o *MarkersGetInternalServerError) Code() int { + return 500 +} + +func (o *MarkersGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetInternalServerError", 500) +} + +func (o *MarkersGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/markers][%d] markersGetInternalServerError", 500) +} + +func (o *MarkersGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/markers/markers_post_parameters.go b/client/markers/markers_post_parameters.go new file mode 100644 index 0000000..0c32120 --- /dev/null +++ b/client/markers/markers_post_parameters.go @@ -0,0 +1,193 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// 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" +) + +// NewMarkersPostParams creates a new MarkersPostParams 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 NewMarkersPostParams() *MarkersPostParams { + return &MarkersPostParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMarkersPostParamsWithTimeout creates a new MarkersPostParams object +// with the ability to set a timeout on a request. +func NewMarkersPostParamsWithTimeout(timeout time.Duration) *MarkersPostParams { + return &MarkersPostParams{ + timeout: timeout, + } +} + +// NewMarkersPostParamsWithContext creates a new MarkersPostParams object +// with the ability to set a context for a request. +func NewMarkersPostParamsWithContext(ctx context.Context) *MarkersPostParams { + return &MarkersPostParams{ + Context: ctx, + } +} + +// NewMarkersPostParamsWithHTTPClient creates a new MarkersPostParams object +// with the ability to set a custom HTTPClient for a request. +func NewMarkersPostParamsWithHTTPClient(client *http.Client) *MarkersPostParams { + return &MarkersPostParams{ + HTTPClient: client, + } +} + +/* +MarkersPostParams contains all the parameters to send to the API endpoint + + for the markers post operation. + + Typically these are written to a http.Request. +*/ +type MarkersPostParams struct { + + /* HomeLastReadID. + + Last status ID read on the home timeline. + */ + HomeLastReadID *string + + /* NotificationsLastReadID. + + Last notification ID read on the notifications timeline. + */ + NotificationsLastReadID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the markers post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersPostParams) WithDefaults() *MarkersPostParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the markers post params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MarkersPostParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the markers post params +func (o *MarkersPostParams) WithTimeout(timeout time.Duration) *MarkersPostParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the markers post params +func (o *MarkersPostParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the markers post params +func (o *MarkersPostParams) WithContext(ctx context.Context) *MarkersPostParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the markers post params +func (o *MarkersPostParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the markers post params +func (o *MarkersPostParams) WithHTTPClient(client *http.Client) *MarkersPostParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the markers post params +func (o *MarkersPostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithHomeLastReadID adds the homeLastReadID to the markers post params +func (o *MarkersPostParams) WithHomeLastReadID(homeLastReadID *string) *MarkersPostParams { + o.SetHomeLastReadID(homeLastReadID) + return o +} + +// SetHomeLastReadID adds the homeLastReadId to the markers post params +func (o *MarkersPostParams) SetHomeLastReadID(homeLastReadID *string) { + o.HomeLastReadID = homeLastReadID +} + +// WithNotificationsLastReadID adds the notificationsLastReadID to the markers post params +func (o *MarkersPostParams) WithNotificationsLastReadID(notificationsLastReadID *string) *MarkersPostParams { + o.SetNotificationsLastReadID(notificationsLastReadID) + return o +} + +// SetNotificationsLastReadID adds the notificationsLastReadId to the markers post params +func (o *MarkersPostParams) SetNotificationsLastReadID(notificationsLastReadID *string) { + o.NotificationsLastReadID = notificationsLastReadID +} + +// WriteToRequest writes these params to a swagger request +func (o *MarkersPostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.HomeLastReadID != nil { + + // form param home[last_read_id] + var frHomeLastReadID string + if o.HomeLastReadID != nil { + frHomeLastReadID = *o.HomeLastReadID + } + fHomeLastReadID := frHomeLastReadID + if fHomeLastReadID != "" { + if err := r.SetFormParam("home[last_read_id]", fHomeLastReadID); err != nil { + return err + } + } + } + + if o.NotificationsLastReadID != nil { + + // form param notifications[last_read_id] + var frNotificationsLastReadID string + if o.NotificationsLastReadID != nil { + frNotificationsLastReadID = *o.NotificationsLastReadID + } + fNotificationsLastReadID := frNotificationsLastReadID + if fNotificationsLastReadID != "" { + if err := r.SetFormParam("notifications[last_read_id]", fNotificationsLastReadID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/markers/markers_post_responses.go b/client/markers/markers_post_responses.go new file mode 100644 index 0000000..c385bb2 --- /dev/null +++ b/client/markers/markers_post_responses.go @@ -0,0 +1,354 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package markers + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MarkersPostReader is a Reader for the MarkersPost structure. +type MarkersPostReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MarkersPostReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMarkersPostOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMarkersPostBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMarkersPostUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewMarkersPostConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMarkersPostInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/markers] markersPost", response, response.Code()) + } +} + +// NewMarkersPostOK creates a MarkersPostOK with default headers values +func NewMarkersPostOK() *MarkersPostOK { + return &MarkersPostOK{} +} + +/* +MarkersPostOK describes a response with status code 200, with default header values. + +Requested markers +*/ +type MarkersPostOK struct { + Payload *models.Marker +} + +// IsSuccess returns true when this markers post o k response has a 2xx status code +func (o *MarkersPostOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this markers post o k response has a 3xx status code +func (o *MarkersPostOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post o k response has a 4xx status code +func (o *MarkersPostOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers post o k response has a 5xx status code +func (o *MarkersPostOK) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post o k response a status code equal to that given +func (o *MarkersPostOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the markers post o k response +func (o *MarkersPostOK) Code() int { + return 200 +} + +func (o *MarkersPostOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostOK %s", 200, payload) +} + +func (o *MarkersPostOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostOK %s", 200, payload) +} + +func (o *MarkersPostOK) GetPayload() *models.Marker { + return o.Payload +} + +func (o *MarkersPostOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Marker) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMarkersPostBadRequest creates a MarkersPostBadRequest with default headers values +func NewMarkersPostBadRequest() *MarkersPostBadRequest { + return &MarkersPostBadRequest{} +} + +/* +MarkersPostBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MarkersPostBadRequest struct { +} + +// IsSuccess returns true when this markers post bad request response has a 2xx status code +func (o *MarkersPostBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post bad request response has a 3xx status code +func (o *MarkersPostBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post bad request response has a 4xx status code +func (o *MarkersPostBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers post bad request response has a 5xx status code +func (o *MarkersPostBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post bad request response a status code equal to that given +func (o *MarkersPostBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the markers post bad request response +func (o *MarkersPostBadRequest) Code() int { + return 400 +} + +func (o *MarkersPostBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostBadRequest", 400) +} + +func (o *MarkersPostBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostBadRequest", 400) +} + +func (o *MarkersPostBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersPostUnauthorized creates a MarkersPostUnauthorized with default headers values +func NewMarkersPostUnauthorized() *MarkersPostUnauthorized { + return &MarkersPostUnauthorized{} +} + +/* +MarkersPostUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MarkersPostUnauthorized struct { +} + +// IsSuccess returns true when this markers post unauthorized response has a 2xx status code +func (o *MarkersPostUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post unauthorized response has a 3xx status code +func (o *MarkersPostUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post unauthorized response has a 4xx status code +func (o *MarkersPostUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers post unauthorized response has a 5xx status code +func (o *MarkersPostUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post unauthorized response a status code equal to that given +func (o *MarkersPostUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the markers post unauthorized response +func (o *MarkersPostUnauthorized) Code() int { + return 401 +} + +func (o *MarkersPostUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostUnauthorized", 401) +} + +func (o *MarkersPostUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostUnauthorized", 401) +} + +func (o *MarkersPostUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersPostConflict creates a MarkersPostConflict with default headers values +func NewMarkersPostConflict() *MarkersPostConflict { + return &MarkersPostConflict{} +} + +/* +MarkersPostConflict describes a response with status code 409, with default header values. + +conflict (when two clients try to update the same timeline at the same time) +*/ +type MarkersPostConflict struct { +} + +// IsSuccess returns true when this markers post conflict response has a 2xx status code +func (o *MarkersPostConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post conflict response has a 3xx status code +func (o *MarkersPostConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post conflict response has a 4xx status code +func (o *MarkersPostConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this markers post conflict response has a 5xx status code +func (o *MarkersPostConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this markers post conflict response a status code equal to that given +func (o *MarkersPostConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the markers post conflict response +func (o *MarkersPostConflict) Code() int { + return 409 +} + +func (o *MarkersPostConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostConflict", 409) +} + +func (o *MarkersPostConflict) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostConflict", 409) +} + +func (o *MarkersPostConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMarkersPostInternalServerError creates a MarkersPostInternalServerError with default headers values +func NewMarkersPostInternalServerError() *MarkersPostInternalServerError { + return &MarkersPostInternalServerError{} +} + +/* +MarkersPostInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MarkersPostInternalServerError struct { +} + +// IsSuccess returns true when this markers post internal server error response has a 2xx status code +func (o *MarkersPostInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this markers post internal server error response has a 3xx status code +func (o *MarkersPostInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this markers post internal server error response has a 4xx status code +func (o *MarkersPostInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this markers post internal server error response has a 5xx status code +func (o *MarkersPostInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this markers post internal server error response a status code equal to that given +func (o *MarkersPostInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the markers post internal server error response +func (o *MarkersPostInternalServerError) Code() int { + return 500 +} + +func (o *MarkersPostInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostInternalServerError", 500) +} + +func (o *MarkersPostInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/markers][%d] markersPostInternalServerError", 500) +} + +func (o *MarkersPostInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/media/media_client.go b/client/media/media_client.go new file mode 100644 index 0000000..511994e --- /dev/null +++ b/client/media/media_client.go @@ -0,0 +1,227 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new media API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new media API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new media API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for media API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// WithContentTypeMultipartFormData sets the Content-Type header to "multipart/form-data". +func WithContentTypeMultipartFormData(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"multipart/form-data"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + MediaCreate(params *MediaCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCreateOK, error) + + MediaGet(params *MediaGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaGetOK, error) + + MediaUpdate(params *MediaUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaUpdateOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +MediaCreate uploads a new media attachment +*/ +func (a *Client) MediaCreate(params *MediaCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaCreateParams() + } + op := &runtime.ClientOperation{ + ID: "mediaCreate", + Method: "POST", + PathPattern: "/api/{api_version}/media", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"multipart/form-data"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MediaCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for mediaCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +MediaGet gets a media attachment that you own +*/ +func (a *Client) MediaGet(params *MediaGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaGetParams() + } + op := &runtime.ClientOperation{ + ID: "mediaGet", + Method: "GET", + PathPattern: "/api/v1/media/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MediaGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for mediaGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + MediaUpdate updates a media attachment + + You must own the media attachment, and the attachment must not yet be attached to a status. + +The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) MediaUpdate(params *MediaUpdateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MediaUpdateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMediaUpdateParams() + } + op := &runtime.ClientOperation{ + ID: "mediaUpdate", + Method: "PUT", + PathPattern: "/api/v1/media/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MediaUpdateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MediaUpdateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for mediaUpdate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/media/media_create_parameters.go b/client/media/media_create_parameters.go new file mode 100644 index 0000000..ba66245 --- /dev/null +++ b/client/media/media_create_parameters.go @@ -0,0 +1,249 @@ +// 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" +) + +// NewMediaCreateParams creates a new MediaCreateParams 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 NewMediaCreateParams() *MediaCreateParams { + return &MediaCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaCreateParamsWithTimeout creates a new MediaCreateParams object +// with the ability to set a timeout on a request. +func NewMediaCreateParamsWithTimeout(timeout time.Duration) *MediaCreateParams { + return &MediaCreateParams{ + timeout: timeout, + } +} + +// NewMediaCreateParamsWithContext creates a new MediaCreateParams object +// with the ability to set a context for a request. +func NewMediaCreateParamsWithContext(ctx context.Context) *MediaCreateParams { + return &MediaCreateParams{ + Context: ctx, + } +} + +// NewMediaCreateParamsWithHTTPClient creates a new MediaCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaCreateParamsWithHTTPClient(client *http.Client) *MediaCreateParams { + return &MediaCreateParams{ + HTTPClient: client, + } +} + +/* +MediaCreateParams contains all the parameters to send to the API endpoint + + for the media create operation. + + Typically these are written to a http.Request. +*/ +type MediaCreateParams struct { + + /* APIVersion. + + Version of the API to use. Must be either `v1` or `v2`. + */ + APIVersion string + + /* 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 + + /* File. + + The media attachment to upload. + */ + File runtime.NamedReadCloser + + /* 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 + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCreateParams) WithDefaults() *MediaCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaCreateParams) SetDefaults() { + var ( + focusDefault = string("0,0") + ) + + val := MediaCreateParams{ + Focus: &focusDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the media create params +func (o *MediaCreateParams) WithTimeout(timeout time.Duration) *MediaCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media create params +func (o *MediaCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media create params +func (o *MediaCreateParams) WithContext(ctx context.Context) *MediaCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media create params +func (o *MediaCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media create params +func (o *MediaCreateParams) WithHTTPClient(client *http.Client) *MediaCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media create params +func (o *MediaCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAPIVersion adds the aPIVersion to the media create params +func (o *MediaCreateParams) WithAPIVersion(aPIVersion string) *MediaCreateParams { + o.SetAPIVersion(aPIVersion) + return o +} + +// SetAPIVersion adds the apiVersion to the media create params +func (o *MediaCreateParams) SetAPIVersion(aPIVersion string) { + o.APIVersion = aPIVersion +} + +// WithDescription adds the description to the media create params +func (o *MediaCreateParams) WithDescription(description *string) *MediaCreateParams { + o.SetDescription(description) + return o +} + +// SetDescription adds the description to the media create params +func (o *MediaCreateParams) SetDescription(description *string) { + o.Description = description +} + +// WithFile adds the file to the media create params +func (o *MediaCreateParams) WithFile(file runtime.NamedReadCloser) *MediaCreateParams { + o.SetFile(file) + return o +} + +// SetFile adds the file to the media create params +func (o *MediaCreateParams) SetFile(file runtime.NamedReadCloser) { + o.File = file +} + +// WithFocus adds the focus to the media create params +func (o *MediaCreateParams) WithFocus(focus *string) *MediaCreateParams { + o.SetFocus(focus) + return o +} + +// SetFocus adds the focus to the media create params +func (o *MediaCreateParams) SetFocus(focus *string) { + o.Focus = focus +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param api_version + if err := r.SetPathParam("api_version", o.APIVersion); err != nil { + return err + } + + if o.Description != nil { + + // form param description + var frDescription string + if o.Description != nil { + frDescription = *o.Description + } + fDescription := frDescription + if fDescription != "" { + if err := r.SetFormParam("description", fDescription); err != nil { + return err + } + } + } + // form file param file + if err := r.SetFileParam("file", o.File); err != nil { + return err + } + + if o.Focus != nil { + + // form param focus + var frFocus string + if o.Focus != nil { + frFocus = *o.Focus + } + fFocus := frFocus + if fFocus != "" { + if err := r.SetFormParam("focus", fFocus); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/media/media_create_responses.go b/client/media/media_create_responses.go new file mode 100644 index 0000000..5ffbeeb --- /dev/null +++ b/client/media/media_create_responses.go @@ -0,0 +1,354 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MediaCreateReader is a Reader for the MediaCreate structure. +type MediaCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewMediaCreateUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/{api_version}/media] mediaCreate", response, response.Code()) + } +} + +// NewMediaCreateOK creates a MediaCreateOK with default headers values +func NewMediaCreateOK() *MediaCreateOK { + return &MediaCreateOK{} +} + +/* +MediaCreateOK describes a response with status code 200, with default header values. + +The newly-created media attachment. +*/ +type MediaCreateOK struct { + Payload *models.Attachment +} + +// IsSuccess returns true when this media create o k response has a 2xx status code +func (o *MediaCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media create o k response has a 3xx status code +func (o *MediaCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create o k response has a 4xx status code +func (o *MediaCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media create o k response has a 5xx status code +func (o *MediaCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media create o k response a status code equal to that given +func (o *MediaCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media create o k response +func (o *MediaCreateOK) Code() int { + return 200 +} + +func (o *MediaCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateOK %s", 200, payload) +} + +func (o *MediaCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateOK %s", 200, payload) +} + +func (o *MediaCreateOK) GetPayload() *models.Attachment { + return o.Payload +} + +func (o *MediaCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Attachment) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMediaCreateBadRequest creates a MediaCreateBadRequest with default headers values +func NewMediaCreateBadRequest() *MediaCreateBadRequest { + return &MediaCreateBadRequest{} +} + +/* +MediaCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaCreateBadRequest struct { +} + +// IsSuccess returns true when this media create bad request response has a 2xx status code +func (o *MediaCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create bad request response has a 3xx status code +func (o *MediaCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create bad request response has a 4xx status code +func (o *MediaCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media create bad request response has a 5xx status code +func (o *MediaCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media create bad request response a status code equal to that given +func (o *MediaCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media create bad request response +func (o *MediaCreateBadRequest) Code() int { + return 400 +} + +func (o *MediaCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateBadRequest", 400) +} + +func (o *MediaCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateBadRequest", 400) +} + +func (o *MediaCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCreateUnauthorized creates a MediaCreateUnauthorized with default headers values +func NewMediaCreateUnauthorized() *MediaCreateUnauthorized { + return &MediaCreateUnauthorized{} +} + +/* +MediaCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaCreateUnauthorized struct { +} + +// IsSuccess returns true when this media create unauthorized response has a 2xx status code +func (o *MediaCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create unauthorized response has a 3xx status code +func (o *MediaCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create unauthorized response has a 4xx status code +func (o *MediaCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media create unauthorized response has a 5xx status code +func (o *MediaCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media create unauthorized response a status code equal to that given +func (o *MediaCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media create unauthorized response +func (o *MediaCreateUnauthorized) Code() int { + return 401 +} + +func (o *MediaCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnauthorized", 401) +} + +func (o *MediaCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnauthorized", 401) +} + +func (o *MediaCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCreateUnprocessableEntity creates a MediaCreateUnprocessableEntity with default headers values +func NewMediaCreateUnprocessableEntity() *MediaCreateUnprocessableEntity { + return &MediaCreateUnprocessableEntity{} +} + +/* +MediaCreateUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable +*/ +type MediaCreateUnprocessableEntity struct { +} + +// IsSuccess returns true when this media create unprocessable entity response has a 2xx status code +func (o *MediaCreateUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create unprocessable entity response has a 3xx status code +func (o *MediaCreateUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create unprocessable entity response has a 4xx status code +func (o *MediaCreateUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this media create unprocessable entity response has a 5xx status code +func (o *MediaCreateUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this media create unprocessable entity response a status code equal to that given +func (o *MediaCreateUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the media create unprocessable entity response +func (o *MediaCreateUnprocessableEntity) Code() int { + return 422 +} + +func (o *MediaCreateUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnprocessableEntity", 422) +} + +func (o *MediaCreateUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateUnprocessableEntity", 422) +} + +func (o *MediaCreateUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaCreateInternalServerError creates a MediaCreateInternalServerError with default headers values +func NewMediaCreateInternalServerError() *MediaCreateInternalServerError { + return &MediaCreateInternalServerError{} +} + +/* +MediaCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaCreateInternalServerError struct { +} + +// IsSuccess returns true when this media create internal server error response has a 2xx status code +func (o *MediaCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media create internal server error response has a 3xx status code +func (o *MediaCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media create internal server error response has a 4xx status code +func (o *MediaCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media create internal server error response has a 5xx status code +func (o *MediaCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media create internal server error response a status code equal to that given +func (o *MediaCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media create internal server error response +func (o *MediaCreateInternalServerError) Code() int { + return 500 +} + +func (o *MediaCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateInternalServerError", 500) +} + +func (o *MediaCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/{api_version}/media][%d] mediaCreateInternalServerError", 500) +} + +func (o *MediaCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/media/media_get_parameters.go b/client/media/media_get_parameters.go new file mode 100644 index 0000000..f0d80a5 --- /dev/null +++ b/client/media/media_get_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewMediaGetParams creates a new MediaGetParams 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 NewMediaGetParams() *MediaGetParams { + return &MediaGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMediaGetParamsWithTimeout creates a new MediaGetParams object +// with the ability to set a timeout on a request. +func NewMediaGetParamsWithTimeout(timeout time.Duration) *MediaGetParams { + return &MediaGetParams{ + timeout: timeout, + } +} + +// NewMediaGetParamsWithContext creates a new MediaGetParams object +// with the ability to set a context for a request. +func NewMediaGetParamsWithContext(ctx context.Context) *MediaGetParams { + return &MediaGetParams{ + Context: ctx, + } +} + +// NewMediaGetParamsWithHTTPClient creates a new MediaGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewMediaGetParamsWithHTTPClient(client *http.Client) *MediaGetParams { + return &MediaGetParams{ + HTTPClient: client, + } +} + +/* +MediaGetParams contains all the parameters to send to the API endpoint + + for the media get operation. + + Typically these are written to a http.Request. +*/ +type MediaGetParams struct { + + /* ID. + + id of the attachment + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the media get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaGetParams) WithDefaults() *MediaGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the media get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MediaGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the media get params +func (o *MediaGetParams) WithTimeout(timeout time.Duration) *MediaGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the media get params +func (o *MediaGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the media get params +func (o *MediaGetParams) WithContext(ctx context.Context) *MediaGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the media get params +func (o *MediaGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the media get params +func (o *MediaGetParams) WithHTTPClient(client *http.Client) *MediaGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the media get params +func (o *MediaGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the media get params +func (o *MediaGetParams) WithID(id string) *MediaGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the media get params +func (o *MediaGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *MediaGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/media/media_get_responses.go b/client/media/media_get_responses.go new file mode 100644 index 0000000..748f9a6 --- /dev/null +++ b/client/media/media_get_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MediaGetReader is a Reader for the MediaGet structure. +type MediaGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/media/{id}] mediaGet", response, response.Code()) + } +} + +// NewMediaGetOK creates a MediaGetOK with default headers values +func NewMediaGetOK() *MediaGetOK { + return &MediaGetOK{} +} + +/* +MediaGetOK describes a response with status code 200, with default header values. + +The requested media attachment. +*/ +type MediaGetOK struct { + Payload *models.Attachment +} + +// IsSuccess returns true when this media get o k response has a 2xx status code +func (o *MediaGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media get o k response has a 3xx status code +func (o *MediaGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get o k response has a 4xx status code +func (o *MediaGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media get o k response has a 5xx status code +func (o *MediaGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media get o k response a status code equal to that given +func (o *MediaGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media get o k response +func (o *MediaGetOK) Code() int { + return 200 +} + +func (o *MediaGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetOK %s", 200, payload) +} + +func (o *MediaGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetOK %s", 200, payload) +} + +func (o *MediaGetOK) GetPayload() *models.Attachment { + return o.Payload +} + +func (o *MediaGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Attachment) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMediaGetBadRequest creates a MediaGetBadRequest with default headers values +func NewMediaGetBadRequest() *MediaGetBadRequest { + return &MediaGetBadRequest{} +} + +/* +MediaGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaGetBadRequest struct { +} + +// IsSuccess returns true when this media get bad request response has a 2xx status code +func (o *MediaGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get bad request response has a 3xx status code +func (o *MediaGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get bad request response has a 4xx status code +func (o *MediaGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get bad request response has a 5xx status code +func (o *MediaGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media get bad request response a status code equal to that given +func (o *MediaGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media get bad request response +func (o *MediaGetBadRequest) Code() int { + return 400 +} + +func (o *MediaGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetBadRequest", 400) +} + +func (o *MediaGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetBadRequest", 400) +} + +func (o *MediaGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetUnauthorized creates a MediaGetUnauthorized with default headers values +func NewMediaGetUnauthorized() *MediaGetUnauthorized { + return &MediaGetUnauthorized{} +} + +/* +MediaGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaGetUnauthorized struct { +} + +// IsSuccess returns true when this media get unauthorized response has a 2xx status code +func (o *MediaGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get unauthorized response has a 3xx status code +func (o *MediaGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get unauthorized response has a 4xx status code +func (o *MediaGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get unauthorized response has a 5xx status code +func (o *MediaGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media get unauthorized response a status code equal to that given +func (o *MediaGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media get unauthorized response +func (o *MediaGetUnauthorized) Code() int { + return 401 +} + +func (o *MediaGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetUnauthorized", 401) +} + +func (o *MediaGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetUnauthorized", 401) +} + +func (o *MediaGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetNotFound creates a MediaGetNotFound with default headers values +func NewMediaGetNotFound() *MediaGetNotFound { + return &MediaGetNotFound{} +} + +/* +MediaGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaGetNotFound struct { +} + +// IsSuccess returns true when this media get not found response has a 2xx status code +func (o *MediaGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get not found response has a 3xx status code +func (o *MediaGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get not found response has a 4xx status code +func (o *MediaGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get not found response has a 5xx status code +func (o *MediaGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media get not found response a status code equal to that given +func (o *MediaGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media get not found response +func (o *MediaGetNotFound) Code() int { + return 404 +} + +func (o *MediaGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotFound", 404) +} + +func (o *MediaGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotFound", 404) +} + +func (o *MediaGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetNotAcceptable creates a MediaGetNotAcceptable with default headers values +func NewMediaGetNotAcceptable() *MediaGetNotAcceptable { + return &MediaGetNotAcceptable{} +} + +/* +MediaGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaGetNotAcceptable struct { +} + +// IsSuccess returns true when this media get not acceptable response has a 2xx status code +func (o *MediaGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get not acceptable response has a 3xx status code +func (o *MediaGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get not acceptable response has a 4xx status code +func (o *MediaGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media get not acceptable response has a 5xx status code +func (o *MediaGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media get not acceptable response a status code equal to that given +func (o *MediaGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media get not acceptable response +func (o *MediaGetNotAcceptable) Code() int { + return 406 +} + +func (o *MediaGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotAcceptable", 406) +} + +func (o *MediaGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetNotAcceptable", 406) +} + +func (o *MediaGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaGetInternalServerError creates a MediaGetInternalServerError with default headers values +func NewMediaGetInternalServerError() *MediaGetInternalServerError { + return &MediaGetInternalServerError{} +} + +/* +MediaGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaGetInternalServerError struct { +} + +// IsSuccess returns true when this media get internal server error response has a 2xx status code +func (o *MediaGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media get internal server error response has a 3xx status code +func (o *MediaGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media get internal server error response has a 4xx status code +func (o *MediaGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media get internal server error response has a 5xx status code +func (o *MediaGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media get internal server error response a status code equal to that given +func (o *MediaGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media get internal server error response +func (o *MediaGetInternalServerError) Code() int { + return 500 +} + +func (o *MediaGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetInternalServerError", 500) +} + +func (o *MediaGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/media/{id}][%d] mediaGetInternalServerError", 500) +} + +func (o *MediaGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/media/media_update_parameters.go b/client/media/media_update_parameters.go new file mode 100644 index 0000000..f0ccacf --- /dev/null +++ b/client/media/media_update_parameters.go @@ -0,0 +1,212 @@ +// 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 +} diff --git a/client/media/media_update_responses.go b/client/media/media_update_responses.go new file mode 100644 index 0000000..d91412b --- /dev/null +++ b/client/media/media_update_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MediaUpdateReader is a Reader for the MediaUpdate structure. +type MediaUpdateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MediaUpdateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMediaUpdateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMediaUpdateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMediaUpdateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMediaUpdateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMediaUpdateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMediaUpdateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[PUT /api/v1/media/{id}] mediaUpdate", response, response.Code()) + } +} + +// NewMediaUpdateOK creates a MediaUpdateOK with default headers values +func NewMediaUpdateOK() *MediaUpdateOK { + return &MediaUpdateOK{} +} + +/* +MediaUpdateOK describes a response with status code 200, with default header values. + +The newly-updated media attachment. +*/ +type MediaUpdateOK struct { + Payload *models.Attachment +} + +// IsSuccess returns true when this media update o k response has a 2xx status code +func (o *MediaUpdateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this media update o k response has a 3xx status code +func (o *MediaUpdateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update o k response has a 4xx status code +func (o *MediaUpdateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this media update o k response has a 5xx status code +func (o *MediaUpdateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this media update o k response a status code equal to that given +func (o *MediaUpdateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the media update o k response +func (o *MediaUpdateOK) Code() int { + return 200 +} + +func (o *MediaUpdateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateOK %s", 200, payload) +} + +func (o *MediaUpdateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateOK %s", 200, payload) +} + +func (o *MediaUpdateOK) GetPayload() *models.Attachment { + return o.Payload +} + +func (o *MediaUpdateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Attachment) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMediaUpdateBadRequest creates a MediaUpdateBadRequest with default headers values +func NewMediaUpdateBadRequest() *MediaUpdateBadRequest { + return &MediaUpdateBadRequest{} +} + +/* +MediaUpdateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MediaUpdateBadRequest struct { +} + +// IsSuccess returns true when this media update bad request response has a 2xx status code +func (o *MediaUpdateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update bad request response has a 3xx status code +func (o *MediaUpdateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update bad request response has a 4xx status code +func (o *MediaUpdateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update bad request response has a 5xx status code +func (o *MediaUpdateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this media update bad request response a status code equal to that given +func (o *MediaUpdateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the media update bad request response +func (o *MediaUpdateBadRequest) Code() int { + return 400 +} + +func (o *MediaUpdateBadRequest) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateBadRequest", 400) +} + +func (o *MediaUpdateBadRequest) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateBadRequest", 400) +} + +func (o *MediaUpdateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateUnauthorized creates a MediaUpdateUnauthorized with default headers values +func NewMediaUpdateUnauthorized() *MediaUpdateUnauthorized { + return &MediaUpdateUnauthorized{} +} + +/* +MediaUpdateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MediaUpdateUnauthorized struct { +} + +// IsSuccess returns true when this media update unauthorized response has a 2xx status code +func (o *MediaUpdateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update unauthorized response has a 3xx status code +func (o *MediaUpdateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update unauthorized response has a 4xx status code +func (o *MediaUpdateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update unauthorized response has a 5xx status code +func (o *MediaUpdateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this media update unauthorized response a status code equal to that given +func (o *MediaUpdateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the media update unauthorized response +func (o *MediaUpdateUnauthorized) Code() int { + return 401 +} + +func (o *MediaUpdateUnauthorized) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateUnauthorized", 401) +} + +func (o *MediaUpdateUnauthorized) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateUnauthorized", 401) +} + +func (o *MediaUpdateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateNotFound creates a MediaUpdateNotFound with default headers values +func NewMediaUpdateNotFound() *MediaUpdateNotFound { + return &MediaUpdateNotFound{} +} + +/* +MediaUpdateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MediaUpdateNotFound struct { +} + +// IsSuccess returns true when this media update not found response has a 2xx status code +func (o *MediaUpdateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update not found response has a 3xx status code +func (o *MediaUpdateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update not found response has a 4xx status code +func (o *MediaUpdateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update not found response has a 5xx status code +func (o *MediaUpdateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this media update not found response a status code equal to that given +func (o *MediaUpdateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the media update not found response +func (o *MediaUpdateNotFound) Code() int { + return 404 +} + +func (o *MediaUpdateNotFound) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotFound", 404) +} + +func (o *MediaUpdateNotFound) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotFound", 404) +} + +func (o *MediaUpdateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateNotAcceptable creates a MediaUpdateNotAcceptable with default headers values +func NewMediaUpdateNotAcceptable() *MediaUpdateNotAcceptable { + return &MediaUpdateNotAcceptable{} +} + +/* +MediaUpdateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MediaUpdateNotAcceptable struct { +} + +// IsSuccess returns true when this media update not acceptable response has a 2xx status code +func (o *MediaUpdateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update not acceptable response has a 3xx status code +func (o *MediaUpdateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update not acceptable response has a 4xx status code +func (o *MediaUpdateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this media update not acceptable response has a 5xx status code +func (o *MediaUpdateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this media update not acceptable response a status code equal to that given +func (o *MediaUpdateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the media update not acceptable response +func (o *MediaUpdateNotAcceptable) Code() int { + return 406 +} + +func (o *MediaUpdateNotAcceptable) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotAcceptable", 406) +} + +func (o *MediaUpdateNotAcceptable) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateNotAcceptable", 406) +} + +func (o *MediaUpdateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMediaUpdateInternalServerError creates a MediaUpdateInternalServerError with default headers values +func NewMediaUpdateInternalServerError() *MediaUpdateInternalServerError { + return &MediaUpdateInternalServerError{} +} + +/* +MediaUpdateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MediaUpdateInternalServerError struct { +} + +// IsSuccess returns true when this media update internal server error response has a 2xx status code +func (o *MediaUpdateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this media update internal server error response has a 3xx status code +func (o *MediaUpdateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this media update internal server error response has a 4xx status code +func (o *MediaUpdateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this media update internal server error response has a 5xx status code +func (o *MediaUpdateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this media update internal server error response a status code equal to that given +func (o *MediaUpdateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the media update internal server error response +func (o *MediaUpdateInternalServerError) Code() int { + return 500 +} + +func (o *MediaUpdateInternalServerError) Error() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateInternalServerError", 500) +} + +func (o *MediaUpdateInternalServerError) String() string { + return fmt.Sprintf("[PUT /api/v1/media/{id}][%d] mediaUpdateInternalServerError", 500) +} + +func (o *MediaUpdateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/mutes/mutes_client.go b/client/mutes/mutes_client.go new file mode 100644 index 0000000..0ccb0c8 --- /dev/null +++ b/client/mutes/mutes_client.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mutes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new mutes API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new mutes API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new mutes API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for mutes API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + MutesGet(params *MutesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MutesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + MutesGet gets an array of accounts that requesting account has muted + + The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) MutesGet(params *MutesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*MutesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewMutesGetParams() + } + op := &runtime.ClientOperation{ + ID: "mutesGet", + Method: "GET", + PathPattern: "/api/v1/mutes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &MutesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*MutesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for mutesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/mutes/mutes_get_parameters.go b/client/mutes/mutes_get_parameters.go new file mode 100644 index 0000000..1128c8b --- /dev/null +++ b/client/mutes/mutes_get_parameters.go @@ -0,0 +1,279 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mutes + +// 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" +) + +// NewMutesGetParams creates a new MutesGetParams 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 NewMutesGetParams() *MutesGetParams { + return &MutesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewMutesGetParamsWithTimeout creates a new MutesGetParams object +// with the ability to set a timeout on a request. +func NewMutesGetParamsWithTimeout(timeout time.Duration) *MutesGetParams { + return &MutesGetParams{ + timeout: timeout, + } +} + +// NewMutesGetParamsWithContext creates a new MutesGetParams object +// with the ability to set a context for a request. +func NewMutesGetParamsWithContext(ctx context.Context) *MutesGetParams { + return &MutesGetParams{ + Context: ctx, + } +} + +// NewMutesGetParamsWithHTTPClient creates a new MutesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewMutesGetParamsWithHTTPClient(client *http.Client) *MutesGetParams { + return &MutesGetParams{ + HTTPClient: client, + } +} + +/* +MutesGetParams contains all the parameters to send to the API endpoint + + for the mutes get operation. + + Typically these are written to a http.Request. +*/ +type MutesGetParams struct { + + /* Limit. + + Number of muted accounts to return. + + Default: 40 + */ + Limit *int64 + + /* MaxID. + + Return only muted accounts *OLDER* than the given max ID. The muted account with the specified ID will not be included in the response. NOTE: the ID is of the internal mute, NOT any of the returned accounts. + */ + MaxID *string + + /* MinID. + + Return only muted accounts *IMMEDIATELY NEWER* than the given min ID. The muted account with the specified ID will not be included in the response. NOTE: the ID is of the internal mute, NOT any of the returned accounts. + */ + MinID *string + + /* SinceID. + + Return only muted accounts *NEWER* than the given since ID. The muted account with the specified ID will not be included in the response. NOTE: the ID is of the internal mute, NOT any of the returned accounts. + */ + SinceID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the mutes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MutesGetParams) WithDefaults() *MutesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the mutes get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *MutesGetParams) SetDefaults() { + var ( + limitDefault = int64(40) + ) + + val := MutesGetParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the mutes get params +func (o *MutesGetParams) WithTimeout(timeout time.Duration) *MutesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the mutes get params +func (o *MutesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the mutes get params +func (o *MutesGetParams) WithContext(ctx context.Context) *MutesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the mutes get params +func (o *MutesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the mutes get params +func (o *MutesGetParams) WithHTTPClient(client *http.Client) *MutesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the mutes get params +func (o *MutesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the mutes get params +func (o *MutesGetParams) WithLimit(limit *int64) *MutesGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the mutes get params +func (o *MutesGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the mutes get params +func (o *MutesGetParams) WithMaxID(maxID *string) *MutesGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the mutes get params +func (o *MutesGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the mutes get params +func (o *MutesGetParams) WithMinID(minID *string) *MutesGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the mutes get params +func (o *MutesGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the mutes get params +func (o *MutesGetParams) WithSinceID(sinceID *string) *MutesGetParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the mutes get params +func (o *MutesGetParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *MutesGetParams) 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.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 +} diff --git a/client/mutes/mutes_get_responses.go b/client/mutes/mutes_get_responses.go new file mode 100644 index 0000000..6bda06a --- /dev/null +++ b/client/mutes/mutes_get_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package mutes + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// MutesGetReader is a Reader for the MutesGet structure. +type MutesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *MutesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewMutesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewMutesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewMutesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewMutesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewMutesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewMutesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/mutes] mutesGet", response, response.Code()) + } +} + +// NewMutesGetOK creates a MutesGetOK with default headers values +func NewMutesGetOK() *MutesGetOK { + return &MutesGetOK{} +} + +/* +MutesGetOK describes a response with status code 200, with default header values. + +List of muted accounts, including when their mutes expire (if applicable). +*/ +type MutesGetOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.MutedAccount +} + +// IsSuccess returns true when this mutes get o k response has a 2xx status code +func (o *MutesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this mutes get o k response has a 3xx status code +func (o *MutesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get o k response has a 4xx status code +func (o *MutesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this mutes get o k response has a 5xx status code +func (o *MutesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get o k response a status code equal to that given +func (o *MutesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the mutes get o k response +func (o *MutesGetOK) Code() int { + return 200 +} + +func (o *MutesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetOK %s", 200, payload) +} + +func (o *MutesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetOK %s", 200, payload) +} + +func (o *MutesGetOK) GetPayload() []*models.MutedAccount { + return o.Payload +} + +func (o *MutesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewMutesGetBadRequest creates a MutesGetBadRequest with default headers values +func NewMutesGetBadRequest() *MutesGetBadRequest { + return &MutesGetBadRequest{} +} + +/* +MutesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type MutesGetBadRequest struct { +} + +// IsSuccess returns true when this mutes get bad request response has a 2xx status code +func (o *MutesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get bad request response has a 3xx status code +func (o *MutesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get bad request response has a 4xx status code +func (o *MutesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get bad request response has a 5xx status code +func (o *MutesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get bad request response a status code equal to that given +func (o *MutesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the mutes get bad request response +func (o *MutesGetBadRequest) Code() int { + return 400 +} + +func (o *MutesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetBadRequest", 400) +} + +func (o *MutesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetBadRequest", 400) +} + +func (o *MutesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetUnauthorized creates a MutesGetUnauthorized with default headers values +func NewMutesGetUnauthorized() *MutesGetUnauthorized { + return &MutesGetUnauthorized{} +} + +/* +MutesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type MutesGetUnauthorized struct { +} + +// IsSuccess returns true when this mutes get unauthorized response has a 2xx status code +func (o *MutesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get unauthorized response has a 3xx status code +func (o *MutesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get unauthorized response has a 4xx status code +func (o *MutesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get unauthorized response has a 5xx status code +func (o *MutesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get unauthorized response a status code equal to that given +func (o *MutesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the mutes get unauthorized response +func (o *MutesGetUnauthorized) Code() int { + return 401 +} + +func (o *MutesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetUnauthorized", 401) +} + +func (o *MutesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetUnauthorized", 401) +} + +func (o *MutesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetNotFound creates a MutesGetNotFound with default headers values +func NewMutesGetNotFound() *MutesGetNotFound { + return &MutesGetNotFound{} +} + +/* +MutesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type MutesGetNotFound struct { +} + +// IsSuccess returns true when this mutes get not found response has a 2xx status code +func (o *MutesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get not found response has a 3xx status code +func (o *MutesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get not found response has a 4xx status code +func (o *MutesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get not found response has a 5xx status code +func (o *MutesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get not found response a status code equal to that given +func (o *MutesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the mutes get not found response +func (o *MutesGetNotFound) Code() int { + return 404 +} + +func (o *MutesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotFound", 404) +} + +func (o *MutesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotFound", 404) +} + +func (o *MutesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetNotAcceptable creates a MutesGetNotAcceptable with default headers values +func NewMutesGetNotAcceptable() *MutesGetNotAcceptable { + return &MutesGetNotAcceptable{} +} + +/* +MutesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type MutesGetNotAcceptable struct { +} + +// IsSuccess returns true when this mutes get not acceptable response has a 2xx status code +func (o *MutesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get not acceptable response has a 3xx status code +func (o *MutesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get not acceptable response has a 4xx status code +func (o *MutesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this mutes get not acceptable response has a 5xx status code +func (o *MutesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this mutes get not acceptable response a status code equal to that given +func (o *MutesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the mutes get not acceptable response +func (o *MutesGetNotAcceptable) Code() int { + return 406 +} + +func (o *MutesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotAcceptable", 406) +} + +func (o *MutesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetNotAcceptable", 406) +} + +func (o *MutesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewMutesGetInternalServerError creates a MutesGetInternalServerError with default headers values +func NewMutesGetInternalServerError() *MutesGetInternalServerError { + return &MutesGetInternalServerError{} +} + +/* +MutesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type MutesGetInternalServerError struct { +} + +// IsSuccess returns true when this mutes get internal server error response has a 2xx status code +func (o *MutesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this mutes get internal server error response has a 3xx status code +func (o *MutesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this mutes get internal server error response has a 4xx status code +func (o *MutesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this mutes get internal server error response has a 5xx status code +func (o *MutesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this mutes get internal server error response a status code equal to that given +func (o *MutesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the mutes get internal server error response +func (o *MutesGetInternalServerError) Code() int { + return 500 +} + +func (o *MutesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetInternalServerError", 500) +} + +func (o *MutesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/mutes][%d] mutesGetInternalServerError", 500) +} + +func (o *MutesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/nodeinfo/node_info_get_parameters.go b/client/nodeinfo/node_info_get_parameters.go new file mode 100644 index 0000000..7a346d8 --- /dev/null +++ b/client/nodeinfo/node_info_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nodeinfo + +// 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" +) + +// NewNodeInfoGetParams creates a new NodeInfoGetParams 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 NewNodeInfoGetParams() *NodeInfoGetParams { + return &NodeInfoGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNodeInfoGetParamsWithTimeout creates a new NodeInfoGetParams object +// with the ability to set a timeout on a request. +func NewNodeInfoGetParamsWithTimeout(timeout time.Duration) *NodeInfoGetParams { + return &NodeInfoGetParams{ + timeout: timeout, + } +} + +// NewNodeInfoGetParamsWithContext creates a new NodeInfoGetParams object +// with the ability to set a context for a request. +func NewNodeInfoGetParamsWithContext(ctx context.Context) *NodeInfoGetParams { + return &NodeInfoGetParams{ + Context: ctx, + } +} + +// NewNodeInfoGetParamsWithHTTPClient creates a new NodeInfoGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewNodeInfoGetParamsWithHTTPClient(client *http.Client) *NodeInfoGetParams { + return &NodeInfoGetParams{ + HTTPClient: client, + } +} + +/* +NodeInfoGetParams contains all the parameters to send to the API endpoint + + for the node info get operation. + + Typically these are written to a http.Request. +*/ +type NodeInfoGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the node info get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoGetParams) WithDefaults() *NodeInfoGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the node info get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the node info get params +func (o *NodeInfoGetParams) WithTimeout(timeout time.Duration) *NodeInfoGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the node info get params +func (o *NodeInfoGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the node info get params +func (o *NodeInfoGetParams) WithContext(ctx context.Context) *NodeInfoGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the node info get params +func (o *NodeInfoGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the node info get params +func (o *NodeInfoGetParams) WithHTTPClient(client *http.Client) *NodeInfoGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the node info get params +func (o *NodeInfoGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *NodeInfoGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/nodeinfo/node_info_get_responses.go b/client/nodeinfo/node_info_get_responses.go new file mode 100644 index 0000000..93604ea --- /dev/null +++ b/client/nodeinfo/node_info_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nodeinfo + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NodeInfoGetReader is a Reader for the NodeInfoGet structure. +type NodeInfoGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NodeInfoGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNodeInfoGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /nodeinfo/2.0] nodeInfoGet", response, response.Code()) + } +} + +// NewNodeInfoGetOK creates a NodeInfoGetOK with default headers values +func NewNodeInfoGetOK() *NodeInfoGetOK { + return &NodeInfoGetOK{} +} + +/* +NodeInfoGetOK describes a response with status code 200, with default header values. + +NodeInfoGetOK node info get o k +*/ +type NodeInfoGetOK struct { + Payload *models.Nodeinfo +} + +// IsSuccess returns true when this node info get o k response has a 2xx status code +func (o *NodeInfoGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this node info get o k response has a 3xx status code +func (o *NodeInfoGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this node info get o k response has a 4xx status code +func (o *NodeInfoGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this node info get o k response has a 5xx status code +func (o *NodeInfoGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this node info get o k response a status code equal to that given +func (o *NodeInfoGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the node info get o k response +func (o *NodeInfoGetOK) Code() int { + return 200 +} + +func (o *NodeInfoGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /nodeinfo/2.0][%d] nodeInfoGetOK %s", 200, payload) +} + +func (o *NodeInfoGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /nodeinfo/2.0][%d] nodeInfoGetOK %s", 200, payload) +} + +func (o *NodeInfoGetOK) GetPayload() *models.Nodeinfo { + return o.Payload +} + +func (o *NodeInfoGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Nodeinfo) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/nodeinfo/nodeinfo_client.go b/client/nodeinfo/nodeinfo_client.go new file mode 100644 index 0000000..19ab6a5 --- /dev/null +++ b/client/nodeinfo/nodeinfo_client.go @@ -0,0 +1,131 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nodeinfo + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new nodeinfo API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new nodeinfo API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new nodeinfo API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for nodeinfo API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// WithAcceptApplicationJSONProfileHTTPNodeinfoDiasporaSoftwareNsSchema20 sets the Accept header to "application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.0#\"". +func WithAcceptApplicationJSONProfileHTTPNodeinfoDiasporaSoftwareNsSchema20(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.0#\""} +} + +// ClientService is the interface for Client methods +type ClientService interface { + NodeInfoGet(params *NodeInfoGetParams, opts ...ClientOption) (*NodeInfoGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +NodeInfoGet returns a compliant nodeinfo response to node info queries + +See: https://nodeinfo.diaspora.software/schema.html +*/ +func (a *Client) NodeInfoGet(params *NodeInfoGetParams, opts ...ClientOption) (*NodeInfoGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNodeInfoGetParams() + } + op := &runtime.ClientOperation{ + ID: "nodeInfoGet", + Method: "GET", + PathPattern: "/nodeinfo/2.0", + ProducesMediaTypes: []string{"application/json; profile=\"http://nodeinfo.diaspora.software/ns/schema/2.0#\""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NodeInfoGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*NodeInfoGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for nodeInfoGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/notifications/clear_notifications_parameters.go b/client/notifications/clear_notifications_parameters.go new file mode 100644 index 0000000..682e23e --- /dev/null +++ b/client/notifications/clear_notifications_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" +) + +// NewClearNotificationsParams creates a new ClearNotificationsParams 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 NewClearNotificationsParams() *ClearNotificationsParams { + return &ClearNotificationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewClearNotificationsParamsWithTimeout creates a new ClearNotificationsParams object +// with the ability to set a timeout on a request. +func NewClearNotificationsParamsWithTimeout(timeout time.Duration) *ClearNotificationsParams { + return &ClearNotificationsParams{ + timeout: timeout, + } +} + +// NewClearNotificationsParamsWithContext creates a new ClearNotificationsParams object +// with the ability to set a context for a request. +func NewClearNotificationsParamsWithContext(ctx context.Context) *ClearNotificationsParams { + return &ClearNotificationsParams{ + Context: ctx, + } +} + +// NewClearNotificationsParamsWithHTTPClient creates a new ClearNotificationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewClearNotificationsParamsWithHTTPClient(client *http.Client) *ClearNotificationsParams { + return &ClearNotificationsParams{ + HTTPClient: client, + } +} + +/* +ClearNotificationsParams contains all the parameters to send to the API endpoint + + for the clear notifications operation. + + Typically these are written to a http.Request. +*/ +type ClearNotificationsParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the clear notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClearNotificationsParams) WithDefaults() *ClearNotificationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the clear notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ClearNotificationsParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the clear notifications params +func (o *ClearNotificationsParams) WithTimeout(timeout time.Duration) *ClearNotificationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the clear notifications params +func (o *ClearNotificationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the clear notifications params +func (o *ClearNotificationsParams) WithContext(ctx context.Context) *ClearNotificationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the clear notifications params +func (o *ClearNotificationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the clear notifications params +func (o *ClearNotificationsParams) WithHTTPClient(client *http.Client) *ClearNotificationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the clear notifications params +func (o *ClearNotificationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *ClearNotificationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/notifications/clear_notifications_responses.go b/client/notifications/clear_notifications_responses.go new file mode 100644 index 0000000..3bc8a00 --- /dev/null +++ b/client/notifications/clear_notifications_responses.go @@ -0,0 +1,412 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// ClearNotificationsReader is a Reader for the ClearNotifications structure. +type ClearNotificationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ClearNotificationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewClearNotificationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewClearNotificationsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewClearNotificationsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewClearNotificationsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewClearNotificationsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewClearNotificationsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/notifications/clear] clearNotifications", response, response.Code()) + } +} + +// NewClearNotificationsOK creates a ClearNotificationsOK with default headers values +func NewClearNotificationsOK() *ClearNotificationsOK { + return &ClearNotificationsOK{} +} + +/* +ClearNotificationsOK describes a response with status code 200, with default header values. + +ClearNotificationsOK clear notifications o k +*/ +type ClearNotificationsOK struct { + Payload interface{} +} + +// IsSuccess returns true when this clear notifications o k response has a 2xx status code +func (o *ClearNotificationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this clear notifications o k response has a 3xx status code +func (o *ClearNotificationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications o k response has a 4xx status code +func (o *ClearNotificationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this clear notifications o k response has a 5xx status code +func (o *ClearNotificationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications o k response a status code equal to that given +func (o *ClearNotificationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the clear notifications o k response +func (o *ClearNotificationsOK) Code() int { + return 200 +} + +func (o *ClearNotificationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsOK %s", 200, payload) +} + +func (o *ClearNotificationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsOK %s", 200, payload) +} + +func (o *ClearNotificationsOK) GetPayload() interface{} { + return o.Payload +} + +func (o *ClearNotificationsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewClearNotificationsBadRequest creates a ClearNotificationsBadRequest with default headers values +func NewClearNotificationsBadRequest() *ClearNotificationsBadRequest { + return &ClearNotificationsBadRequest{} +} + +/* +ClearNotificationsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ClearNotificationsBadRequest struct { +} + +// IsSuccess returns true when this clear notifications bad request response has a 2xx status code +func (o *ClearNotificationsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications bad request response has a 3xx status code +func (o *ClearNotificationsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications bad request response has a 4xx status code +func (o *ClearNotificationsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications bad request response has a 5xx status code +func (o *ClearNotificationsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications bad request response a status code equal to that given +func (o *ClearNotificationsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the clear notifications bad request response +func (o *ClearNotificationsBadRequest) Code() int { + return 400 +} + +func (o *ClearNotificationsBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsBadRequest", 400) +} + +func (o *ClearNotificationsBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsBadRequest", 400) +} + +func (o *ClearNotificationsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsUnauthorized creates a ClearNotificationsUnauthorized with default headers values +func NewClearNotificationsUnauthorized() *ClearNotificationsUnauthorized { + return &ClearNotificationsUnauthorized{} +} + +/* +ClearNotificationsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ClearNotificationsUnauthorized struct { +} + +// IsSuccess returns true when this clear notifications unauthorized response has a 2xx status code +func (o *ClearNotificationsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications unauthorized response has a 3xx status code +func (o *ClearNotificationsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications unauthorized response has a 4xx status code +func (o *ClearNotificationsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications unauthorized response has a 5xx status code +func (o *ClearNotificationsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications unauthorized response a status code equal to that given +func (o *ClearNotificationsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the clear notifications unauthorized response +func (o *ClearNotificationsUnauthorized) Code() int { + return 401 +} + +func (o *ClearNotificationsUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsUnauthorized", 401) +} + +func (o *ClearNotificationsUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsUnauthorized", 401) +} + +func (o *ClearNotificationsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsNotFound creates a ClearNotificationsNotFound with default headers values +func NewClearNotificationsNotFound() *ClearNotificationsNotFound { + return &ClearNotificationsNotFound{} +} + +/* +ClearNotificationsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ClearNotificationsNotFound struct { +} + +// IsSuccess returns true when this clear notifications not found response has a 2xx status code +func (o *ClearNotificationsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications not found response has a 3xx status code +func (o *ClearNotificationsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications not found response has a 4xx status code +func (o *ClearNotificationsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications not found response has a 5xx status code +func (o *ClearNotificationsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications not found response a status code equal to that given +func (o *ClearNotificationsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the clear notifications not found response +func (o *ClearNotificationsNotFound) Code() int { + return 404 +} + +func (o *ClearNotificationsNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotFound", 404) +} + +func (o *ClearNotificationsNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotFound", 404) +} + +func (o *ClearNotificationsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsNotAcceptable creates a ClearNotificationsNotAcceptable with default headers values +func NewClearNotificationsNotAcceptable() *ClearNotificationsNotAcceptable { + return &ClearNotificationsNotAcceptable{} +} + +/* +ClearNotificationsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ClearNotificationsNotAcceptable struct { +} + +// IsSuccess returns true when this clear notifications not acceptable response has a 2xx status code +func (o *ClearNotificationsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications not acceptable response has a 3xx status code +func (o *ClearNotificationsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications not acceptable response has a 4xx status code +func (o *ClearNotificationsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this clear notifications not acceptable response has a 5xx status code +func (o *ClearNotificationsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this clear notifications not acceptable response a status code equal to that given +func (o *ClearNotificationsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the clear notifications not acceptable response +func (o *ClearNotificationsNotAcceptable) Code() int { + return 406 +} + +func (o *ClearNotificationsNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotAcceptable", 406) +} + +func (o *ClearNotificationsNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsNotAcceptable", 406) +} + +func (o *ClearNotificationsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewClearNotificationsInternalServerError creates a ClearNotificationsInternalServerError with default headers values +func NewClearNotificationsInternalServerError() *ClearNotificationsInternalServerError { + return &ClearNotificationsInternalServerError{} +} + +/* +ClearNotificationsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ClearNotificationsInternalServerError struct { +} + +// IsSuccess returns true when this clear notifications internal server error response has a 2xx status code +func (o *ClearNotificationsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this clear notifications internal server error response has a 3xx status code +func (o *ClearNotificationsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this clear notifications internal server error response has a 4xx status code +func (o *ClearNotificationsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this clear notifications internal server error response has a 5xx status code +func (o *ClearNotificationsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this clear notifications internal server error response a status code equal to that given +func (o *ClearNotificationsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the clear notifications internal server error response +func (o *ClearNotificationsInternalServerError) Code() int { + return 500 +} + +func (o *ClearNotificationsInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsInternalServerError", 500) +} + +func (o *ClearNotificationsInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/notifications/clear][%d] clearNotificationsInternalServerError", 500) +} + +func (o *ClearNotificationsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/notifications/notification_parameters.go b/client/notifications/notification_parameters.go new file mode 100644 index 0000000..11a983c --- /dev/null +++ b/client/notifications/notification_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" +) + +// NewNotificationParams creates a new NotificationParams 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 NewNotificationParams() *NotificationParams { + return &NotificationParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNotificationParamsWithTimeout creates a new NotificationParams object +// with the ability to set a timeout on a request. +func NewNotificationParamsWithTimeout(timeout time.Duration) *NotificationParams { + return &NotificationParams{ + timeout: timeout, + } +} + +// NewNotificationParamsWithContext creates a new NotificationParams object +// with the ability to set a context for a request. +func NewNotificationParamsWithContext(ctx context.Context) *NotificationParams { + return &NotificationParams{ + Context: ctx, + } +} + +// NewNotificationParamsWithHTTPClient creates a new NotificationParams object +// with the ability to set a custom HTTPClient for a request. +func NewNotificationParamsWithHTTPClient(client *http.Client) *NotificationParams { + return &NotificationParams{ + HTTPClient: client, + } +} + +/* +NotificationParams contains all the parameters to send to the API endpoint + + for the notification operation. + + Typically these are written to a http.Request. +*/ +type NotificationParams struct { + + /* ID. + + The ID of the notification. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the notification params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationParams) WithDefaults() *NotificationParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the notification params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the notification params +func (o *NotificationParams) WithTimeout(timeout time.Duration) *NotificationParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the notification params +func (o *NotificationParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the notification params +func (o *NotificationParams) WithContext(ctx context.Context) *NotificationParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the notification params +func (o *NotificationParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the notification params +func (o *NotificationParams) WithHTTPClient(client *http.Client) *NotificationParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the notification params +func (o *NotificationParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the notification params +func (o *NotificationParams) WithID(id string) *NotificationParams { + o.SetID(id) + return o +} + +// SetID adds the id to the notification params +func (o *NotificationParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *NotificationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/notifications/notification_responses.go b/client/notifications/notification_responses.go new file mode 100644 index 0000000..c4b8fe8 --- /dev/null +++ b/client/notifications/notification_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NotificationReader is a Reader for the Notification structure. +type NotificationReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NotificationReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNotificationOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewNotificationBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewNotificationUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewNotificationNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewNotificationNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewNotificationInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/notification/{id}] notification", response, response.Code()) + } +} + +// NewNotificationOK creates a NotificationOK with default headers values +func NewNotificationOK() *NotificationOK { + return &NotificationOK{} +} + +/* +NotificationOK describes a response with status code 200, with default header values. + +Requested notification. +*/ +type NotificationOK struct { + Payload *models.Notification +} + +// IsSuccess returns true when this notification o k response has a 2xx status code +func (o *NotificationOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this notification o k response has a 3xx status code +func (o *NotificationOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification o k response has a 4xx status code +func (o *NotificationOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this notification o k response has a 5xx status code +func (o *NotificationOK) IsServerError() bool { + return false +} + +// IsCode returns true when this notification o k response a status code equal to that given +func (o *NotificationOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the notification o k response +func (o *NotificationOK) Code() int { + return 200 +} + +func (o *NotificationOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationOK %s", 200, payload) +} + +func (o *NotificationOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationOK %s", 200, payload) +} + +func (o *NotificationOK) GetPayload() *models.Notification { + return o.Payload +} + +func (o *NotificationOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Notification) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewNotificationBadRequest creates a NotificationBadRequest with default headers values +func NewNotificationBadRequest() *NotificationBadRequest { + return &NotificationBadRequest{} +} + +/* +NotificationBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type NotificationBadRequest struct { +} + +// IsSuccess returns true when this notification bad request response has a 2xx status code +func (o *NotificationBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification bad request response has a 3xx status code +func (o *NotificationBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification bad request response has a 4xx status code +func (o *NotificationBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification bad request response has a 5xx status code +func (o *NotificationBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this notification bad request response a status code equal to that given +func (o *NotificationBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the notification bad request response +func (o *NotificationBadRequest) Code() int { + return 400 +} + +func (o *NotificationBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationBadRequest", 400) +} + +func (o *NotificationBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationBadRequest", 400) +} + +func (o *NotificationBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationUnauthorized creates a NotificationUnauthorized with default headers values +func NewNotificationUnauthorized() *NotificationUnauthorized { + return &NotificationUnauthorized{} +} + +/* +NotificationUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type NotificationUnauthorized struct { +} + +// IsSuccess returns true when this notification unauthorized response has a 2xx status code +func (o *NotificationUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification unauthorized response has a 3xx status code +func (o *NotificationUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification unauthorized response has a 4xx status code +func (o *NotificationUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification unauthorized response has a 5xx status code +func (o *NotificationUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this notification unauthorized response a status code equal to that given +func (o *NotificationUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the notification unauthorized response +func (o *NotificationUnauthorized) Code() int { + return 401 +} + +func (o *NotificationUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationUnauthorized", 401) +} + +func (o *NotificationUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationUnauthorized", 401) +} + +func (o *NotificationUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationNotFound creates a NotificationNotFound with default headers values +func NewNotificationNotFound() *NotificationNotFound { + return &NotificationNotFound{} +} + +/* +NotificationNotFound describes a response with status code 404, with default header values. + +not found +*/ +type NotificationNotFound struct { +} + +// IsSuccess returns true when this notification not found response has a 2xx status code +func (o *NotificationNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification not found response has a 3xx status code +func (o *NotificationNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification not found response has a 4xx status code +func (o *NotificationNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification not found response has a 5xx status code +func (o *NotificationNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this notification not found response a status code equal to that given +func (o *NotificationNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the notification not found response +func (o *NotificationNotFound) Code() int { + return 404 +} + +func (o *NotificationNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotFound", 404) +} + +func (o *NotificationNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotFound", 404) +} + +func (o *NotificationNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationNotAcceptable creates a NotificationNotAcceptable with default headers values +func NewNotificationNotAcceptable() *NotificationNotAcceptable { + return &NotificationNotAcceptable{} +} + +/* +NotificationNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type NotificationNotAcceptable struct { +} + +// IsSuccess returns true when this notification not acceptable response has a 2xx status code +func (o *NotificationNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification not acceptable response has a 3xx status code +func (o *NotificationNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification not acceptable response has a 4xx status code +func (o *NotificationNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this notification not acceptable response has a 5xx status code +func (o *NotificationNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this notification not acceptable response a status code equal to that given +func (o *NotificationNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the notification not acceptable response +func (o *NotificationNotAcceptable) Code() int { + return 406 +} + +func (o *NotificationNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotAcceptable", 406) +} + +func (o *NotificationNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationNotAcceptable", 406) +} + +func (o *NotificationNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationInternalServerError creates a NotificationInternalServerError with default headers values +func NewNotificationInternalServerError() *NotificationInternalServerError { + return &NotificationInternalServerError{} +} + +/* +NotificationInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type NotificationInternalServerError struct { +} + +// IsSuccess returns true when this notification internal server error response has a 2xx status code +func (o *NotificationInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notification internal server error response has a 3xx status code +func (o *NotificationInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notification internal server error response has a 4xx status code +func (o *NotificationInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this notification internal server error response has a 5xx status code +func (o *NotificationInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this notification internal server error response a status code equal to that given +func (o *NotificationInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the notification internal server error response +func (o *NotificationInternalServerError) Code() int { + return 500 +} + +func (o *NotificationInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationInternalServerError", 500) +} + +func (o *NotificationInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/notification/{id}][%d] notificationInternalServerError", 500) +} + +func (o *NotificationInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/notifications/notifications_client.go b/client/notifications/notifications_client.go new file mode 100644 index 0000000..26f8290 --- /dev/null +++ b/client/notifications/notifications_client.go @@ -0,0 +1,199 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new notifications API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new notifications API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new notifications API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for notifications API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + ClearNotifications(params *ClearNotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ClearNotificationsOK, error) + + Notification(params *NotificationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationOK, error) + + Notifications(params *NotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +ClearNotifications clears delete all notifications for currently authorized user + +Will return an empty object `{}` to indicate success. +*/ +func (a *Client) ClearNotifications(params *ClearNotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ClearNotificationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewClearNotificationsParams() + } + op := &runtime.ClientOperation{ + ID: "clearNotifications", + Method: "POST", + PathPattern: "/api/v1/notifications/clear", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ClearNotificationsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ClearNotificationsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for clearNotifications: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +Notification gets a single notification with the given ID +*/ +func (a *Client) Notification(params *NotificationParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNotificationParams() + } + op := &runtime.ClientOperation{ + ID: "notification", + Method: "GET", + PathPattern: "/api/v1/notification/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NotificationReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*NotificationOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for notification: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + Notifications gets notifications for currently authorized user + + The notifications will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The next and previous queries can be parsed from the returned Link header. +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) Notifications(params *NotificationsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*NotificationsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNotificationsParams() + } + op := &runtime.ClientOperation{ + ID: "notifications", + Method: "GET", + PathPattern: "/api/v1/notifications", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NotificationsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*NotificationsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for notifications: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/notifications/notifications_parameters.go b/client/notifications/notifications_parameters.go new file mode 100644 index 0000000..3496edb --- /dev/null +++ b/client/notifications/notifications_parameters.go @@ -0,0 +1,369 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// 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" +) + +// NewNotificationsParams creates a new NotificationsParams 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 NewNotificationsParams() *NotificationsParams { + return &NotificationsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNotificationsParamsWithTimeout creates a new NotificationsParams object +// with the ability to set a timeout on a request. +func NewNotificationsParamsWithTimeout(timeout time.Duration) *NotificationsParams { + return &NotificationsParams{ + timeout: timeout, + } +} + +// NewNotificationsParamsWithContext creates a new NotificationsParams object +// with the ability to set a context for a request. +func NewNotificationsParamsWithContext(ctx context.Context) *NotificationsParams { + return &NotificationsParams{ + Context: ctx, + } +} + +// NewNotificationsParamsWithHTTPClient creates a new NotificationsParams object +// with the ability to set a custom HTTPClient for a request. +func NewNotificationsParamsWithHTTPClient(client *http.Client) *NotificationsParams { + return &NotificationsParams{ + HTTPClient: client, + } +} + +/* +NotificationsParams contains all the parameters to send to the API endpoint + + for the notifications operation. + + Typically these are written to a http.Request. +*/ +type NotificationsParams struct { + + /* ExcludeTypes. + + Types of notifications to exclude. + */ + ExcludeTypes []string + + /* Limit. + + Number of notifications to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only notifications *OLDER* than the given max notification ID. The notification with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only notifications *immediately newer* than the given since notification ID. The notification with the specified ID will not be included in the response. + */ + MinID *string + + /* SinceID. + + Return only notifications *newer* than the given since notification ID. The notification with the specified ID will not be included in the response. + */ + SinceID *string + + /* Types. + + Types of notifications to include. If not provided, all notification types will be included. + */ + Types []string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationsParams) WithDefaults() *NotificationsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the notifications params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NotificationsParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := NotificationsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the notifications params +func (o *NotificationsParams) WithTimeout(timeout time.Duration) *NotificationsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the notifications params +func (o *NotificationsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the notifications params +func (o *NotificationsParams) WithContext(ctx context.Context) *NotificationsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the notifications params +func (o *NotificationsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the notifications params +func (o *NotificationsParams) WithHTTPClient(client *http.Client) *NotificationsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the notifications params +func (o *NotificationsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithExcludeTypes adds the excludeTypes to the notifications params +func (o *NotificationsParams) WithExcludeTypes(excludeTypes []string) *NotificationsParams { + o.SetExcludeTypes(excludeTypes) + return o +} + +// SetExcludeTypes adds the excludeTypes to the notifications params +func (o *NotificationsParams) SetExcludeTypes(excludeTypes []string) { + o.ExcludeTypes = excludeTypes +} + +// WithLimit adds the limit to the notifications params +func (o *NotificationsParams) WithLimit(limit *int64) *NotificationsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the notifications params +func (o *NotificationsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the notifications params +func (o *NotificationsParams) WithMaxID(maxID *string) *NotificationsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the notifications params +func (o *NotificationsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the notifications params +func (o *NotificationsParams) WithMinID(minID *string) *NotificationsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the notifications params +func (o *NotificationsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the notifications params +func (o *NotificationsParams) WithSinceID(sinceID *string) *NotificationsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the notifications params +func (o *NotificationsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTypes adds the types to the notifications params +func (o *NotificationsParams) WithTypes(types []string) *NotificationsParams { + o.SetTypes(types) + return o +} + +// SetTypes adds the types to the notifications params +func (o *NotificationsParams) SetTypes(types []string) { + o.Types = types +} + +// WriteToRequest writes these params to a swagger request +func (o *NotificationsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ExcludeTypes != nil { + + // binding items for exclude_types[] + joinedExcludeTypes := o.bindParamExcludeTypes(reg) + + // query array param exclude_types[] + if err := r.SetQueryParam("exclude_types[]", joinedExcludeTypes...); err != nil { + return err + } + } + + 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.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 o.Types != nil { + + // binding items for types[] + joinedTypes := o.bindParamTypes(reg) + + // query array param types[] + if err := r.SetQueryParam("types[]", joinedTypes...); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamNotifications binds the parameter exclude_types[] +func (o *NotificationsParams) bindParamExcludeTypes(formats strfmt.Registry) []string { + excludeTypesIR := o.ExcludeTypes + + var excludeTypesIC []string + for _, excludeTypesIIR := range excludeTypesIR { // explode []string + + excludeTypesIIV := excludeTypesIIR // string as string + excludeTypesIC = append(excludeTypesIC, excludeTypesIIV) + } + + // items.CollectionFormat: "" + excludeTypesIS := swag.JoinByFormat(excludeTypesIC, "") + + return excludeTypesIS +} + +// bindParamNotifications binds the parameter types[] +func (o *NotificationsParams) bindParamTypes(formats strfmt.Registry) []string { + typesIR := o.Types + + var typesIC []string + for _, typesIIR := range typesIR { // explode []string + + typesIIV := typesIIR // string as string + typesIC = append(typesIC, typesIIV) + } + + // items.CollectionFormat: "" + typesIS := swag.JoinByFormat(typesIC, "") + + return typesIS +} diff --git a/client/notifications/notifications_responses.go b/client/notifications/notifications_responses.go new file mode 100644 index 0000000..d46fdb3 --- /dev/null +++ b/client/notifications/notifications_responses.go @@ -0,0 +1,426 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package notifications + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NotificationsReader is a Reader for the Notifications structure. +type NotificationsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NotificationsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNotificationsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewNotificationsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewNotificationsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewNotificationsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewNotificationsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewNotificationsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/notifications] notifications", response, response.Code()) + } +} + +// NewNotificationsOK creates a NotificationsOK with default headers values +func NewNotificationsOK() *NotificationsOK { + return &NotificationsOK{} +} + +/* +NotificationsOK describes a response with status code 200, with default header values. + +Array of notifications. +*/ +type NotificationsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Notification +} + +// IsSuccess returns true when this notifications o k response has a 2xx status code +func (o *NotificationsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this notifications o k response has a 3xx status code +func (o *NotificationsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications o k response has a 4xx status code +func (o *NotificationsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this notifications o k response has a 5xx status code +func (o *NotificationsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications o k response a status code equal to that given +func (o *NotificationsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the notifications o k response +func (o *NotificationsOK) Code() int { + return 200 +} + +func (o *NotificationsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsOK %s", 200, payload) +} + +func (o *NotificationsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsOK %s", 200, payload) +} + +func (o *NotificationsOK) GetPayload() []*models.Notification { + return o.Payload +} + +func (o *NotificationsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewNotificationsBadRequest creates a NotificationsBadRequest with default headers values +func NewNotificationsBadRequest() *NotificationsBadRequest { + return &NotificationsBadRequest{} +} + +/* +NotificationsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type NotificationsBadRequest struct { +} + +// IsSuccess returns true when this notifications bad request response has a 2xx status code +func (o *NotificationsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications bad request response has a 3xx status code +func (o *NotificationsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications bad request response has a 4xx status code +func (o *NotificationsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications bad request response has a 5xx status code +func (o *NotificationsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications bad request response a status code equal to that given +func (o *NotificationsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the notifications bad request response +func (o *NotificationsBadRequest) Code() int { + return 400 +} + +func (o *NotificationsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsBadRequest", 400) +} + +func (o *NotificationsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsBadRequest", 400) +} + +func (o *NotificationsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsUnauthorized creates a NotificationsUnauthorized with default headers values +func NewNotificationsUnauthorized() *NotificationsUnauthorized { + return &NotificationsUnauthorized{} +} + +/* +NotificationsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type NotificationsUnauthorized struct { +} + +// IsSuccess returns true when this notifications unauthorized response has a 2xx status code +func (o *NotificationsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications unauthorized response has a 3xx status code +func (o *NotificationsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications unauthorized response has a 4xx status code +func (o *NotificationsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications unauthorized response has a 5xx status code +func (o *NotificationsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications unauthorized response a status code equal to that given +func (o *NotificationsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the notifications unauthorized response +func (o *NotificationsUnauthorized) Code() int { + return 401 +} + +func (o *NotificationsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsUnauthorized", 401) +} + +func (o *NotificationsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsUnauthorized", 401) +} + +func (o *NotificationsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsNotFound creates a NotificationsNotFound with default headers values +func NewNotificationsNotFound() *NotificationsNotFound { + return &NotificationsNotFound{} +} + +/* +NotificationsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type NotificationsNotFound struct { +} + +// IsSuccess returns true when this notifications not found response has a 2xx status code +func (o *NotificationsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications not found response has a 3xx status code +func (o *NotificationsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications not found response has a 4xx status code +func (o *NotificationsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications not found response has a 5xx status code +func (o *NotificationsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications not found response a status code equal to that given +func (o *NotificationsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the notifications not found response +func (o *NotificationsNotFound) Code() int { + return 404 +} + +func (o *NotificationsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotFound", 404) +} + +func (o *NotificationsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotFound", 404) +} + +func (o *NotificationsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsNotAcceptable creates a NotificationsNotAcceptable with default headers values +func NewNotificationsNotAcceptable() *NotificationsNotAcceptable { + return &NotificationsNotAcceptable{} +} + +/* +NotificationsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type NotificationsNotAcceptable struct { +} + +// IsSuccess returns true when this notifications not acceptable response has a 2xx status code +func (o *NotificationsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications not acceptable response has a 3xx status code +func (o *NotificationsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications not acceptable response has a 4xx status code +func (o *NotificationsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this notifications not acceptable response has a 5xx status code +func (o *NotificationsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this notifications not acceptable response a status code equal to that given +func (o *NotificationsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the notifications not acceptable response +func (o *NotificationsNotAcceptable) Code() int { + return 406 +} + +func (o *NotificationsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotAcceptable", 406) +} + +func (o *NotificationsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsNotAcceptable", 406) +} + +func (o *NotificationsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewNotificationsInternalServerError creates a NotificationsInternalServerError with default headers values +func NewNotificationsInternalServerError() *NotificationsInternalServerError { + return &NotificationsInternalServerError{} +} + +/* +NotificationsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type NotificationsInternalServerError struct { +} + +// IsSuccess returns true when this notifications internal server error response has a 2xx status code +func (o *NotificationsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this notifications internal server error response has a 3xx status code +func (o *NotificationsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this notifications internal server error response has a 4xx status code +func (o *NotificationsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this notifications internal server error response has a 5xx status code +func (o *NotificationsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this notifications internal server error response a status code equal to that given +func (o *NotificationsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the notifications internal server error response +func (o *NotificationsInternalServerError) Code() int { + return 500 +} + +func (o *NotificationsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsInternalServerError", 500) +} + +func (o *NotificationsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/notifications][%d] notificationsInternalServerError", 500) +} + +func (o *NotificationsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/nr_well_known/host_meta_get_parameters.go b/client/nr_well_known/host_meta_get_parameters.go new file mode 100644 index 0000000..09061cb --- /dev/null +++ b/client/nr_well_known/host_meta_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" +) + +// NewHostMetaGetParams creates a new HostMetaGetParams 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 NewHostMetaGetParams() *HostMetaGetParams { + return &HostMetaGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewHostMetaGetParamsWithTimeout creates a new HostMetaGetParams object +// with the ability to set a timeout on a request. +func NewHostMetaGetParamsWithTimeout(timeout time.Duration) *HostMetaGetParams { + return &HostMetaGetParams{ + timeout: timeout, + } +} + +// NewHostMetaGetParamsWithContext creates a new HostMetaGetParams object +// with the ability to set a context for a request. +func NewHostMetaGetParamsWithContext(ctx context.Context) *HostMetaGetParams { + return &HostMetaGetParams{ + Context: ctx, + } +} + +// NewHostMetaGetParamsWithHTTPClient creates a new HostMetaGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewHostMetaGetParamsWithHTTPClient(client *http.Client) *HostMetaGetParams { + return &HostMetaGetParams{ + HTTPClient: client, + } +} + +/* +HostMetaGetParams contains all the parameters to send to the API endpoint + + for the host meta get operation. + + Typically these are written to a http.Request. +*/ +type HostMetaGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the host meta get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HostMetaGetParams) WithDefaults() *HostMetaGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the host meta get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *HostMetaGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the host meta get params +func (o *HostMetaGetParams) WithTimeout(timeout time.Duration) *HostMetaGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the host meta get params +func (o *HostMetaGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the host meta get params +func (o *HostMetaGetParams) WithContext(ctx context.Context) *HostMetaGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the host meta get params +func (o *HostMetaGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the host meta get params +func (o *HostMetaGetParams) WithHTTPClient(client *http.Client) *HostMetaGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the host meta get params +func (o *HostMetaGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *HostMetaGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/nr_well_known/host_meta_get_responses.go b/client/nr_well_known/host_meta_get_responses.go new file mode 100644 index 0000000..a1fa20e --- /dev/null +++ b/client/nr_well_known/host_meta_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HostMetaGetReader is a Reader for the HostMetaGet structure. +type HostMetaGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HostMetaGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHostMetaGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /.well-known/host-meta] hostMetaGet", response, response.Code()) + } +} + +// NewHostMetaGetOK creates a HostMetaGetOK with default headers values +func NewHostMetaGetOK() *HostMetaGetOK { + return &HostMetaGetOK{} +} + +/* +HostMetaGetOK describes a response with status code 200, with default header values. + +HostMetaGetOK host meta get o k +*/ +type HostMetaGetOK struct { + Payload *models.HostMeta +} + +// IsSuccess returns true when this host meta get o k response has a 2xx status code +func (o *HostMetaGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this host meta get o k response has a 3xx status code +func (o *HostMetaGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this host meta get o k response has a 4xx status code +func (o *HostMetaGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this host meta get o k response has a 5xx status code +func (o *HostMetaGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this host meta get o k response a status code equal to that given +func (o *HostMetaGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the host meta get o k response +func (o *HostMetaGetOK) Code() int { + return 200 +} + +func (o *HostMetaGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/host-meta][%d] hostMetaGetOK %s", 200, payload) +} + +func (o *HostMetaGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/host-meta][%d] hostMetaGetOK %s", 200, payload) +} + +func (o *HostMetaGetOK) GetPayload() *models.HostMeta { + return o.Payload +} + +func (o *HostMetaGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.HostMeta) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/nr_well_known/node_info_well_known_get_parameters.go b/client/nr_well_known/node_info_well_known_get_parameters.go new file mode 100644 index 0000000..e74259d --- /dev/null +++ b/client/nr_well_known/node_info_well_known_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" +) + +// NewNodeInfoWellKnownGetParams creates a new NodeInfoWellKnownGetParams 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 NewNodeInfoWellKnownGetParams() *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewNodeInfoWellKnownGetParamsWithTimeout creates a new NodeInfoWellKnownGetParams object +// with the ability to set a timeout on a request. +func NewNodeInfoWellKnownGetParamsWithTimeout(timeout time.Duration) *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + timeout: timeout, + } +} + +// NewNodeInfoWellKnownGetParamsWithContext creates a new NodeInfoWellKnownGetParams object +// with the ability to set a context for a request. +func NewNodeInfoWellKnownGetParamsWithContext(ctx context.Context) *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + Context: ctx, + } +} + +// NewNodeInfoWellKnownGetParamsWithHTTPClient creates a new NodeInfoWellKnownGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewNodeInfoWellKnownGetParamsWithHTTPClient(client *http.Client) *NodeInfoWellKnownGetParams { + return &NodeInfoWellKnownGetParams{ + HTTPClient: client, + } +} + +/* +NodeInfoWellKnownGetParams contains all the parameters to send to the API endpoint + + for the node info well known get operation. + + Typically these are written to a http.Request. +*/ +type NodeInfoWellKnownGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the node info well known get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoWellKnownGetParams) WithDefaults() *NodeInfoWellKnownGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the node info well known get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *NodeInfoWellKnownGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the node info well known get params +func (o *NodeInfoWellKnownGetParams) WithTimeout(timeout time.Duration) *NodeInfoWellKnownGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the node info well known get params +func (o *NodeInfoWellKnownGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the node info well known get params +func (o *NodeInfoWellKnownGetParams) WithContext(ctx context.Context) *NodeInfoWellKnownGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the node info well known get params +func (o *NodeInfoWellKnownGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the node info well known get params +func (o *NodeInfoWellKnownGetParams) WithHTTPClient(client *http.Client) *NodeInfoWellKnownGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the node info well known get params +func (o *NodeInfoWellKnownGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *NodeInfoWellKnownGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/nr_well_known/node_info_well_known_get_responses.go b/client/nr_well_known/node_info_well_known_get_responses.go new file mode 100644 index 0000000..cc580f8 --- /dev/null +++ b/client/nr_well_known/node_info_well_known_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// NodeInfoWellKnownGetReader is a Reader for the NodeInfoWellKnownGet structure. +type NodeInfoWellKnownGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *NodeInfoWellKnownGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewNodeInfoWellKnownGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /.well-known/nodeinfo] nodeInfoWellKnownGet", response, response.Code()) + } +} + +// NewNodeInfoWellKnownGetOK creates a NodeInfoWellKnownGetOK with default headers values +func NewNodeInfoWellKnownGetOK() *NodeInfoWellKnownGetOK { + return &NodeInfoWellKnownGetOK{} +} + +/* +NodeInfoWellKnownGetOK describes a response with status code 200, with default header values. + +NodeInfoWellKnownGetOK node info well known get o k +*/ +type NodeInfoWellKnownGetOK struct { + Payload *models.WellKnownResponse +} + +// IsSuccess returns true when this node info well known get o k response has a 2xx status code +func (o *NodeInfoWellKnownGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this node info well known get o k response has a 3xx status code +func (o *NodeInfoWellKnownGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this node info well known get o k response has a 4xx status code +func (o *NodeInfoWellKnownGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this node info well known get o k response has a 5xx status code +func (o *NodeInfoWellKnownGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this node info well known get o k response a status code equal to that given +func (o *NodeInfoWellKnownGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the node info well known get o k response +func (o *NodeInfoWellKnownGetOK) Code() int { + return 200 +} + +func (o *NodeInfoWellKnownGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/nodeinfo][%d] nodeInfoWellKnownGetOK %s", 200, payload) +} + +func (o *NodeInfoWellKnownGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/nodeinfo][%d] nodeInfoWellKnownGetOK %s", 200, payload) +} + +func (o *NodeInfoWellKnownGetOK) GetPayload() *models.WellKnownResponse { + return o.Payload +} + +func (o *NodeInfoWellKnownGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.WellKnownResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/nr_well_known/nr_well_known_client.go b/client/nr_well_known/nr_well_known_client.go new file mode 100644 index 0000000..22f509b --- /dev/null +++ b/client/nr_well_known/nr_well_known_client.go @@ -0,0 +1,230 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new nr well known API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new nr well known API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new nr well known API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for nr well known API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithAccept allows the client to force the Accept header +// to negotiate a specific Producer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithAccept(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{mime} + } +} + +// WithAcceptApplicationJrdJSON sets the Accept header to "application/jrd+json". +func WithAcceptApplicationJrdJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/jrd+json"} +} + +// WithAcceptApplicationJSON sets the Accept header to "application/json". +func WithAcceptApplicationJSON(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/json"} +} + +// WithAcceptApplicationXrdXML sets the Accept header to "application/xrd+xml\"". +func WithAcceptApplicationXrdXML(r *runtime.ClientOperation) { + r.ProducesMediaTypes = []string{"application/xrd+xml\""} +} + +// ClientService is the interface for Client methods +type ClientService interface { + HostMetaGet(params *HostMetaGetParams, opts ...ClientOption) (*HostMetaGetOK, error) + + NodeInfoWellKnownGet(params *NodeInfoWellKnownGetParams, opts ...ClientOption) (*NodeInfoWellKnownGetOK, error) + + WebfingerGet(params *WebfingerGetParams, opts ...ClientOption) (*WebfingerGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +HostMetaGet returns a compliant hostmeta response to web host metadata queries + +See: https://www.rfc-editor.org/rfc/rfc6415.html +*/ +func (a *Client) HostMetaGet(params *HostMetaGetParams, opts ...ClientOption) (*HostMetaGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHostMetaGetParams() + } + op := &runtime.ClientOperation{ + ID: "hostMetaGet", + Method: "GET", + PathPattern: "/.well-known/host-meta", + ProducesMediaTypes: []string{"application/xrd+xml\""}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HostMetaGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HostMetaGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for hostMetaGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + NodeInfoWellKnownGet returns a well known response which redirects callers to nodeinfo 2 0 + + eg. `{"links":[{"rel":"http://nodeinfo.diaspora.software/ns/schema/2.0","href":"http://example.org/nodeinfo/2.0"}]}` + +See: https://nodeinfo.diaspora.software/protocol.html +*/ +func (a *Client) NodeInfoWellKnownGet(params *NodeInfoWellKnownGetParams, opts ...ClientOption) (*NodeInfoWellKnownGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewNodeInfoWellKnownGetParams() + } + op := &runtime.ClientOperation{ + ID: "nodeInfoWellKnownGet", + Method: "GET", + PathPattern: "/.well-known/nodeinfo", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &NodeInfoWellKnownGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*NodeInfoWellKnownGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for nodeInfoWellKnownGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + WebfingerGet handles webfinger account lookup requests + + For example, a GET to `https://goblin.technology/.well-known/webfinger?resource=acct:tobi@goblin.technology` would return: + +``` + +{"subject":"acct:tobi@goblin.technology","aliases":["https://goblin.technology/users/tobi","https://goblin.technology/@tobi"],"links":[{"rel":"http://webfinger.net/rel/profile-page","type":"text/html","href":"https://goblin.technology/@tobi"},{"rel":"self","type":"application/activity+json","href":"https://goblin.technology/users/tobi"}]} + +``` + +See: https://webfinger.net/ +*/ +func (a *Client) WebfingerGet(params *WebfingerGetParams, opts ...ClientOption) (*WebfingerGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewWebfingerGetParams() + } + op := &runtime.ClientOperation{ + ID: "webfingerGet", + Method: "GET", + PathPattern: "/.well-known/webfinger", + ProducesMediaTypes: []string{"application/jrd+json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &WebfingerGetReader{formats: a.formats}, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*WebfingerGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for webfingerGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/nr_well_known/webfinger_get_parameters.go b/client/nr_well_known/webfinger_get_parameters.go new file mode 100644 index 0000000..34f3a88 --- /dev/null +++ b/client/nr_well_known/webfinger_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// 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" +) + +// NewWebfingerGetParams creates a new WebfingerGetParams 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 NewWebfingerGetParams() *WebfingerGetParams { + return &WebfingerGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewWebfingerGetParamsWithTimeout creates a new WebfingerGetParams object +// with the ability to set a timeout on a request. +func NewWebfingerGetParamsWithTimeout(timeout time.Duration) *WebfingerGetParams { + return &WebfingerGetParams{ + timeout: timeout, + } +} + +// NewWebfingerGetParamsWithContext creates a new WebfingerGetParams object +// with the ability to set a context for a request. +func NewWebfingerGetParamsWithContext(ctx context.Context) *WebfingerGetParams { + return &WebfingerGetParams{ + Context: ctx, + } +} + +// NewWebfingerGetParamsWithHTTPClient creates a new WebfingerGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewWebfingerGetParamsWithHTTPClient(client *http.Client) *WebfingerGetParams { + return &WebfingerGetParams{ + HTTPClient: client, + } +} + +/* +WebfingerGetParams contains all the parameters to send to the API endpoint + + for the webfinger get operation. + + Typically these are written to a http.Request. +*/ +type WebfingerGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the webfinger get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *WebfingerGetParams) WithDefaults() *WebfingerGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the webfinger get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *WebfingerGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the webfinger get params +func (o *WebfingerGetParams) WithTimeout(timeout time.Duration) *WebfingerGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the webfinger get params +func (o *WebfingerGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the webfinger get params +func (o *WebfingerGetParams) WithContext(ctx context.Context) *WebfingerGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the webfinger get params +func (o *WebfingerGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the webfinger get params +func (o *WebfingerGetParams) WithHTTPClient(client *http.Client) *WebfingerGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the webfinger get params +func (o *WebfingerGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *WebfingerGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/nr_well_known/webfinger_get_responses.go b/client/nr_well_known/webfinger_get_responses.go new file mode 100644 index 0000000..6ba575a --- /dev/null +++ b/client/nr_well_known/webfinger_get_responses.go @@ -0,0 +1,106 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package nr_well_known + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// WebfingerGetReader is a Reader for the WebfingerGet structure. +type WebfingerGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *WebfingerGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewWebfingerGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + default: + return nil, runtime.NewAPIError("[GET /.well-known/webfinger] webfingerGet", response, response.Code()) + } +} + +// NewWebfingerGetOK creates a WebfingerGetOK with default headers values +func NewWebfingerGetOK() *WebfingerGetOK { + return &WebfingerGetOK{} +} + +/* +WebfingerGetOK describes a response with status code 200, with default header values. + +WebfingerGetOK webfinger get o k +*/ +type WebfingerGetOK struct { + Payload *models.WellKnownResponse +} + +// IsSuccess returns true when this webfinger get o k response has a 2xx status code +func (o *WebfingerGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this webfinger get o k response has a 3xx status code +func (o *WebfingerGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this webfinger get o k response has a 4xx status code +func (o *WebfingerGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this webfinger get o k response has a 5xx status code +func (o *WebfingerGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this webfinger get o k response a status code equal to that given +func (o *WebfingerGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the webfinger get o k response +func (o *WebfingerGetOK) Code() int { + return 200 +} + +func (o *WebfingerGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/webfinger][%d] webfingerGetOK %s", 200, payload) +} + +func (o *WebfingerGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /.well-known/webfinger][%d] webfingerGetOK %s", 200, payload) +} + +func (o *WebfingerGetOK) GetPayload() *models.WellKnownResponse { + return o.Payload +} + +func (o *WebfingerGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.WellKnownResponse) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} diff --git a/client/polls/poll_parameters.go b/client/polls/poll_parameters.go new file mode 100644 index 0000000..9aa473d --- /dev/null +++ b/client/polls/poll_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// 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" +) + +// NewPollParams creates a new PollParams 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 NewPollParams() *PollParams { + return &PollParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPollParamsWithTimeout creates a new PollParams object +// with the ability to set a timeout on a request. +func NewPollParamsWithTimeout(timeout time.Duration) *PollParams { + return &PollParams{ + timeout: timeout, + } +} + +// NewPollParamsWithContext creates a new PollParams object +// with the ability to set a context for a request. +func NewPollParamsWithContext(ctx context.Context) *PollParams { + return &PollParams{ + Context: ctx, + } +} + +// NewPollParamsWithHTTPClient creates a new PollParams object +// with the ability to set a custom HTTPClient for a request. +func NewPollParamsWithHTTPClient(client *http.Client) *PollParams { + return &PollParams{ + HTTPClient: client, + } +} + +/* +PollParams contains all the parameters to send to the API endpoint + + for the poll operation. + + Typically these are written to a http.Request. +*/ +type PollParams struct { + + /* ID. + + Target poll ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the poll params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollParams) WithDefaults() *PollParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the poll params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the poll params +func (o *PollParams) WithTimeout(timeout time.Duration) *PollParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the poll params +func (o *PollParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the poll params +func (o *PollParams) WithContext(ctx context.Context) *PollParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the poll params +func (o *PollParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the poll params +func (o *PollParams) WithHTTPClient(client *http.Client) *PollParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the poll params +func (o *PollParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the poll params +func (o *PollParams) WithID(id string) *PollParams { + o.SetID(id) + return o +} + +// SetID adds the id to the poll params +func (o *PollParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PollParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/polls/poll_responses.go b/client/polls/poll_responses.go new file mode 100644 index 0000000..357d657 --- /dev/null +++ b/client/polls/poll_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PollReader is a Reader for the Poll structure. +type PollReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PollReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPollOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPollBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPollUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPollForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPollNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPollNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPollInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/polls/{id}] poll", response, response.Code()) + } +} + +// NewPollOK creates a PollOK with default headers values +func NewPollOK() *PollOK { + return &PollOK{} +} + +/* +PollOK describes a response with status code 200, with default header values. + +The requested poll. +*/ +type PollOK struct { + Payload *models.Poll +} + +// IsSuccess returns true when this poll o k response has a 2xx status code +func (o *PollOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this poll o k response has a 3xx status code +func (o *PollOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll o k response has a 4xx status code +func (o *PollOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll o k response has a 5xx status code +func (o *PollOK) IsServerError() bool { + return false +} + +// IsCode returns true when this poll o k response a status code equal to that given +func (o *PollOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the poll o k response +func (o *PollOK) Code() int { + return 200 +} + +func (o *PollOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollOK %s", 200, payload) +} + +func (o *PollOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollOK %s", 200, payload) +} + +func (o *PollOK) GetPayload() *models.Poll { + return o.Payload +} + +func (o *PollOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Poll) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPollBadRequest creates a PollBadRequest with default headers values +func NewPollBadRequest() *PollBadRequest { + return &PollBadRequest{} +} + +/* +PollBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PollBadRequest struct { +} + +// IsSuccess returns true when this poll bad request response has a 2xx status code +func (o *PollBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll bad request response has a 3xx status code +func (o *PollBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll bad request response has a 4xx status code +func (o *PollBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll bad request response has a 5xx status code +func (o *PollBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this poll bad request response a status code equal to that given +func (o *PollBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the poll bad request response +func (o *PollBadRequest) Code() int { + return 400 +} + +func (o *PollBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollBadRequest", 400) +} + +func (o *PollBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollBadRequest", 400) +} + +func (o *PollBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollUnauthorized creates a PollUnauthorized with default headers values +func NewPollUnauthorized() *PollUnauthorized { + return &PollUnauthorized{} +} + +/* +PollUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PollUnauthorized struct { +} + +// IsSuccess returns true when this poll unauthorized response has a 2xx status code +func (o *PollUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll unauthorized response has a 3xx status code +func (o *PollUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll unauthorized response has a 4xx status code +func (o *PollUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll unauthorized response has a 5xx status code +func (o *PollUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this poll unauthorized response a status code equal to that given +func (o *PollUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the poll unauthorized response +func (o *PollUnauthorized) Code() int { + return 401 +} + +func (o *PollUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollUnauthorized", 401) +} + +func (o *PollUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollUnauthorized", 401) +} + +func (o *PollUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollForbidden creates a PollForbidden with default headers values +func NewPollForbidden() *PollForbidden { + return &PollForbidden{} +} + +/* +PollForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type PollForbidden struct { +} + +// IsSuccess returns true when this poll forbidden response has a 2xx status code +func (o *PollForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll forbidden response has a 3xx status code +func (o *PollForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll forbidden response has a 4xx status code +func (o *PollForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll forbidden response has a 5xx status code +func (o *PollForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this poll forbidden response a status code equal to that given +func (o *PollForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the poll forbidden response +func (o *PollForbidden) Code() int { + return 403 +} + +func (o *PollForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollForbidden", 403) +} + +func (o *PollForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollForbidden", 403) +} + +func (o *PollForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollNotFound creates a PollNotFound with default headers values +func NewPollNotFound() *PollNotFound { + return &PollNotFound{} +} + +/* +PollNotFound describes a response with status code 404, with default header values. + +not found +*/ +type PollNotFound struct { +} + +// IsSuccess returns true when this poll not found response has a 2xx status code +func (o *PollNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll not found response has a 3xx status code +func (o *PollNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll not found response has a 4xx status code +func (o *PollNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll not found response has a 5xx status code +func (o *PollNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this poll not found response a status code equal to that given +func (o *PollNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the poll not found response +func (o *PollNotFound) Code() int { + return 404 +} + +func (o *PollNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotFound", 404) +} + +func (o *PollNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotFound", 404) +} + +func (o *PollNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollNotAcceptable creates a PollNotAcceptable with default headers values +func NewPollNotAcceptable() *PollNotAcceptable { + return &PollNotAcceptable{} +} + +/* +PollNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PollNotAcceptable struct { +} + +// IsSuccess returns true when this poll not acceptable response has a 2xx status code +func (o *PollNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll not acceptable response has a 3xx status code +func (o *PollNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll not acceptable response has a 4xx status code +func (o *PollNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll not acceptable response has a 5xx status code +func (o *PollNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this poll not acceptable response a status code equal to that given +func (o *PollNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the poll not acceptable response +func (o *PollNotAcceptable) Code() int { + return 406 +} + +func (o *PollNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotAcceptable", 406) +} + +func (o *PollNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollNotAcceptable", 406) +} + +func (o *PollNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollInternalServerError creates a PollInternalServerError with default headers values +func NewPollInternalServerError() *PollInternalServerError { + return &PollInternalServerError{} +} + +/* +PollInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PollInternalServerError struct { +} + +// IsSuccess returns true when this poll internal server error response has a 2xx status code +func (o *PollInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll internal server error response has a 3xx status code +func (o *PollInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll internal server error response has a 4xx status code +func (o *PollInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll internal server error response has a 5xx status code +func (o *PollInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this poll internal server error response a status code equal to that given +func (o *PollInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the poll internal server error response +func (o *PollInternalServerError) Code() int { + return 500 +} + +func (o *PollInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollInternalServerError", 500) +} + +func (o *PollInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/polls/{id}][%d] pollInternalServerError", 500) +} + +func (o *PollInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/polls/poll_vote_parameters.go b/client/polls/poll_vote_parameters.go new file mode 100644 index 0000000..f3dd68c --- /dev/null +++ b/client/polls/poll_vote_parameters.go @@ -0,0 +1,197 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// 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" +) + +// NewPollVoteParams creates a new PollVoteParams 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 NewPollVoteParams() *PollVoteParams { + return &PollVoteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPollVoteParamsWithTimeout creates a new PollVoteParams object +// with the ability to set a timeout on a request. +func NewPollVoteParamsWithTimeout(timeout time.Duration) *PollVoteParams { + return &PollVoteParams{ + timeout: timeout, + } +} + +// NewPollVoteParamsWithContext creates a new PollVoteParams object +// with the ability to set a context for a request. +func NewPollVoteParamsWithContext(ctx context.Context) *PollVoteParams { + return &PollVoteParams{ + Context: ctx, + } +} + +// NewPollVoteParamsWithHTTPClient creates a new PollVoteParams object +// with the ability to set a custom HTTPClient for a request. +func NewPollVoteParamsWithHTTPClient(client *http.Client) *PollVoteParams { + return &PollVoteParams{ + HTTPClient: client, + } +} + +/* +PollVoteParams contains all the parameters to send to the API endpoint + + for the poll vote operation. + + Typically these are written to a http.Request. +*/ +type PollVoteParams struct { + + /* Choices. + + Poll choice indices on which to vote. + */ + Choices []int64 + + /* ID. + + Target poll ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the poll vote params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollVoteParams) WithDefaults() *PollVoteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the poll vote params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PollVoteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the poll vote params +func (o *PollVoteParams) WithTimeout(timeout time.Duration) *PollVoteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the poll vote params +func (o *PollVoteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the poll vote params +func (o *PollVoteParams) WithContext(ctx context.Context) *PollVoteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the poll vote params +func (o *PollVoteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the poll vote params +func (o *PollVoteParams) WithHTTPClient(client *http.Client) *PollVoteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the poll vote params +func (o *PollVoteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithChoices adds the choices to the poll vote params +func (o *PollVoteParams) WithChoices(choices []int64) *PollVoteParams { + o.SetChoices(choices) + return o +} + +// SetChoices adds the choices to the poll vote params +func (o *PollVoteParams) SetChoices(choices []int64) { + o.Choices = choices +} + +// WithID adds the id to the poll vote params +func (o *PollVoteParams) WithID(id string) *PollVoteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the poll vote params +func (o *PollVoteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *PollVoteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.Choices != nil { + + // binding items for choices + joinedChoices := o.bindParamChoices(reg) + + // form array param choices + if err := r.SetFormParam("choices", joinedChoices...); 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 +} + +// bindParamPollVote binds the parameter choices +func (o *PollVoteParams) bindParamChoices(formats strfmt.Registry) []string { + choicesIR := o.Choices + + var choicesIC []string + for _, choicesIIR := range choicesIR { // explode []int64 + + choicesIIV := swag.FormatInt64(choicesIIR) // int64 as string + choicesIC = append(choicesIC, choicesIIV) + } + + // items.CollectionFormat: "" + choicesIS := swag.JoinByFormat(choicesIC, "") + + return choicesIS +} diff --git a/client/polls/poll_vote_responses.go b/client/polls/poll_vote_responses.go new file mode 100644 index 0000000..5649bf0 --- /dev/null +++ b/client/polls/poll_vote_responses.go @@ -0,0 +1,540 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PollVoteReader is a Reader for the PollVote structure. +type PollVoteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PollVoteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPollVoteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPollVoteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPollVoteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewPollVoteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPollVoteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPollVoteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewPollVoteUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPollVoteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/polls/{id}/votes] pollVote", response, response.Code()) + } +} + +// NewPollVoteOK creates a PollVoteOK with default headers values +func NewPollVoteOK() *PollVoteOK { + return &PollVoteOK{} +} + +/* +PollVoteOK describes a response with status code 200, with default header values. + +The updated poll with user vote choices. +*/ +type PollVoteOK struct { + Payload *models.Poll +} + +// IsSuccess returns true when this poll vote o k response has a 2xx status code +func (o *PollVoteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this poll vote o k response has a 3xx status code +func (o *PollVoteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote o k response has a 4xx status code +func (o *PollVoteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll vote o k response has a 5xx status code +func (o *PollVoteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote o k response a status code equal to that given +func (o *PollVoteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the poll vote o k response +func (o *PollVoteOK) Code() int { + return 200 +} + +func (o *PollVoteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteOK %s", 200, payload) +} + +func (o *PollVoteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteOK %s", 200, payload) +} + +func (o *PollVoteOK) GetPayload() *models.Poll { + return o.Payload +} + +func (o *PollVoteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Poll) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPollVoteBadRequest creates a PollVoteBadRequest with default headers values +func NewPollVoteBadRequest() *PollVoteBadRequest { + return &PollVoteBadRequest{} +} + +/* +PollVoteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PollVoteBadRequest struct { +} + +// IsSuccess returns true when this poll vote bad request response has a 2xx status code +func (o *PollVoteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote bad request response has a 3xx status code +func (o *PollVoteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote bad request response has a 4xx status code +func (o *PollVoteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote bad request response has a 5xx status code +func (o *PollVoteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote bad request response a status code equal to that given +func (o *PollVoteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the poll vote bad request response +func (o *PollVoteBadRequest) Code() int { + return 400 +} + +func (o *PollVoteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteBadRequest", 400) +} + +func (o *PollVoteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteBadRequest", 400) +} + +func (o *PollVoteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteUnauthorized creates a PollVoteUnauthorized with default headers values +func NewPollVoteUnauthorized() *PollVoteUnauthorized { + return &PollVoteUnauthorized{} +} + +/* +PollVoteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PollVoteUnauthorized struct { +} + +// IsSuccess returns true when this poll vote unauthorized response has a 2xx status code +func (o *PollVoteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote unauthorized response has a 3xx status code +func (o *PollVoteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote unauthorized response has a 4xx status code +func (o *PollVoteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote unauthorized response has a 5xx status code +func (o *PollVoteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote unauthorized response a status code equal to that given +func (o *PollVoteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the poll vote unauthorized response +func (o *PollVoteUnauthorized) Code() int { + return 401 +} + +func (o *PollVoteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnauthorized", 401) +} + +func (o *PollVoteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnauthorized", 401) +} + +func (o *PollVoteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteForbidden creates a PollVoteForbidden with default headers values +func NewPollVoteForbidden() *PollVoteForbidden { + return &PollVoteForbidden{} +} + +/* +PollVoteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type PollVoteForbidden struct { +} + +// IsSuccess returns true when this poll vote forbidden response has a 2xx status code +func (o *PollVoteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote forbidden response has a 3xx status code +func (o *PollVoteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote forbidden response has a 4xx status code +func (o *PollVoteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote forbidden response has a 5xx status code +func (o *PollVoteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote forbidden response a status code equal to that given +func (o *PollVoteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the poll vote forbidden response +func (o *PollVoteForbidden) Code() int { + return 403 +} + +func (o *PollVoteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteForbidden", 403) +} + +func (o *PollVoteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteForbidden", 403) +} + +func (o *PollVoteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteNotFound creates a PollVoteNotFound with default headers values +func NewPollVoteNotFound() *PollVoteNotFound { + return &PollVoteNotFound{} +} + +/* +PollVoteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type PollVoteNotFound struct { +} + +// IsSuccess returns true when this poll vote not found response has a 2xx status code +func (o *PollVoteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote not found response has a 3xx status code +func (o *PollVoteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote not found response has a 4xx status code +func (o *PollVoteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote not found response has a 5xx status code +func (o *PollVoteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote not found response a status code equal to that given +func (o *PollVoteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the poll vote not found response +func (o *PollVoteNotFound) Code() int { + return 404 +} + +func (o *PollVoteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotFound", 404) +} + +func (o *PollVoteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotFound", 404) +} + +func (o *PollVoteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteNotAcceptable creates a PollVoteNotAcceptable with default headers values +func NewPollVoteNotAcceptable() *PollVoteNotAcceptable { + return &PollVoteNotAcceptable{} +} + +/* +PollVoteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PollVoteNotAcceptable struct { +} + +// IsSuccess returns true when this poll vote not acceptable response has a 2xx status code +func (o *PollVoteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote not acceptable response has a 3xx status code +func (o *PollVoteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote not acceptable response has a 4xx status code +func (o *PollVoteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote not acceptable response has a 5xx status code +func (o *PollVoteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote not acceptable response a status code equal to that given +func (o *PollVoteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the poll vote not acceptable response +func (o *PollVoteNotAcceptable) Code() int { + return 406 +} + +func (o *PollVoteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotAcceptable", 406) +} + +func (o *PollVoteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteNotAcceptable", 406) +} + +func (o *PollVoteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteUnprocessableEntity creates a PollVoteUnprocessableEntity with default headers values +func NewPollVoteUnprocessableEntity() *PollVoteUnprocessableEntity { + return &PollVoteUnprocessableEntity{} +} + +/* +PollVoteUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable entity +*/ +type PollVoteUnprocessableEntity struct { +} + +// IsSuccess returns true when this poll vote unprocessable entity response has a 2xx status code +func (o *PollVoteUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote unprocessable entity response has a 3xx status code +func (o *PollVoteUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote unprocessable entity response has a 4xx status code +func (o *PollVoteUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this poll vote unprocessable entity response has a 5xx status code +func (o *PollVoteUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this poll vote unprocessable entity response a status code equal to that given +func (o *PollVoteUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the poll vote unprocessable entity response +func (o *PollVoteUnprocessableEntity) Code() int { + return 422 +} + +func (o *PollVoteUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnprocessableEntity", 422) +} + +func (o *PollVoteUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteUnprocessableEntity", 422) +} + +func (o *PollVoteUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPollVoteInternalServerError creates a PollVoteInternalServerError with default headers values +func NewPollVoteInternalServerError() *PollVoteInternalServerError { + return &PollVoteInternalServerError{} +} + +/* +PollVoteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PollVoteInternalServerError struct { +} + +// IsSuccess returns true when this poll vote internal server error response has a 2xx status code +func (o *PollVoteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this poll vote internal server error response has a 3xx status code +func (o *PollVoteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this poll vote internal server error response has a 4xx status code +func (o *PollVoteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this poll vote internal server error response has a 5xx status code +func (o *PollVoteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this poll vote internal server error response a status code equal to that given +func (o *PollVoteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the poll vote internal server error response +func (o *PollVoteInternalServerError) Code() int { + return 500 +} + +func (o *PollVoteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteInternalServerError", 500) +} + +func (o *PollVoteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/polls/{id}/votes][%d] pollVoteInternalServerError", 500) +} + +func (o *PollVoteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/polls/polls_client.go b/client/polls/polls_client.go new file mode 100644 index 0000000..c94bd09 --- /dev/null +++ b/client/polls/polls_client.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package polls + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new polls API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new polls API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new polls API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for polls API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + Poll(params *PollParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollOK, error) + + PollVote(params *PollVoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollVoteOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +Poll views poll with given ID +*/ +func (a *Client) Poll(params *PollParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPollParams() + } + op := &runtime.ClientOperation{ + ID: "poll", + Method: "GET", + PathPattern: "/api/v1/polls/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PollReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PollOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for poll: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +PollVote votes with choices in the given poll +*/ +func (a *Client) PollVote(params *PollVoteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PollVoteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPollVoteParams() + } + op := &runtime.ClientOperation{ + ID: "pollVote", + Method: "POST", + PathPattern: "/api/v1/polls/{id}/votes", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PollVoteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PollVoteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for pollVote: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/preferences/preferences_client.go b/client/preferences/preferences_client.go new file mode 100644 index 0000000..6697a13 --- /dev/null +++ b/client/preferences/preferences_client.go @@ -0,0 +1,121 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package preferences + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new preferences API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new preferences API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new preferences API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for preferences API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + PreferencesGet(params *PreferencesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PreferencesGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + PreferencesGet returns an object of user preferences + + Example: + +``` + +{ +"posting:default:visibility": "public", +"posting:default:sensitive": false, +"posting:default:language": "en", +"reading:expand:media": "default", +"reading:expand:spoilers": false, +"reading:autoplay:gifs": false +} + +```` +*/ +func (a *Client) PreferencesGet(params *PreferencesGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PreferencesGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPreferencesGetParams() + } + op := &runtime.ClientOperation{ + ID: "preferencesGet", + Method: "GET", + PathPattern: "/api/v1/preferences", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PreferencesGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PreferencesGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for preferencesGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/preferences/preferences_get_parameters.go b/client/preferences/preferences_get_parameters.go new file mode 100644 index 0000000..eb0d67e --- /dev/null +++ b/client/preferences/preferences_get_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package preferences + +// 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" +) + +// NewPreferencesGetParams creates a new PreferencesGetParams 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 NewPreferencesGetParams() *PreferencesGetParams { + return &PreferencesGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPreferencesGetParamsWithTimeout creates a new PreferencesGetParams object +// with the ability to set a timeout on a request. +func NewPreferencesGetParamsWithTimeout(timeout time.Duration) *PreferencesGetParams { + return &PreferencesGetParams{ + timeout: timeout, + } +} + +// NewPreferencesGetParamsWithContext creates a new PreferencesGetParams object +// with the ability to set a context for a request. +func NewPreferencesGetParamsWithContext(ctx context.Context) *PreferencesGetParams { + return &PreferencesGetParams{ + Context: ctx, + } +} + +// NewPreferencesGetParamsWithHTTPClient creates a new PreferencesGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewPreferencesGetParamsWithHTTPClient(client *http.Client) *PreferencesGetParams { + return &PreferencesGetParams{ + HTTPClient: client, + } +} + +/* +PreferencesGetParams contains all the parameters to send to the API endpoint + + for the preferences get operation. + + Typically these are written to a http.Request. +*/ +type PreferencesGetParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the preferences get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PreferencesGetParams) WithDefaults() *PreferencesGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the preferences get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PreferencesGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the preferences get params +func (o *PreferencesGetParams) WithTimeout(timeout time.Duration) *PreferencesGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the preferences get params +func (o *PreferencesGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the preferences get params +func (o *PreferencesGetParams) WithContext(ctx context.Context) *PreferencesGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the preferences get params +func (o *PreferencesGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the preferences get params +func (o *PreferencesGetParams) WithHTTPClient(client *http.Client) *PreferencesGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the preferences get params +func (o *PreferencesGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *PreferencesGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/preferences/preferences_get_responses.go b/client/preferences/preferences_get_responses.go new file mode 100644 index 0000000..2fcca8d --- /dev/null +++ b/client/preferences/preferences_get_responses.go @@ -0,0 +1,412 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package preferences + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// PreferencesGetReader is a Reader for the PreferencesGet structure. +type PreferencesGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PreferencesGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPreferencesGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPreferencesGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPreferencesGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewPreferencesGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewPreferencesGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewPreferencesGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/preferences] preferencesGet", response, response.Code()) + } +} + +// NewPreferencesGetOK creates a PreferencesGetOK with default headers values +func NewPreferencesGetOK() *PreferencesGetOK { + return &PreferencesGetOK{} +} + +/* +PreferencesGetOK describes a response with status code 200, with default header values. + +PreferencesGetOK preferences get o k +*/ +type PreferencesGetOK struct { + Payload interface{} +} + +// IsSuccess returns true when this preferences get o k response has a 2xx status code +func (o *PreferencesGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this preferences get o k response has a 3xx status code +func (o *PreferencesGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get o k response has a 4xx status code +func (o *PreferencesGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this preferences get o k response has a 5xx status code +func (o *PreferencesGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get o k response a status code equal to that given +func (o *PreferencesGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the preferences get o k response +func (o *PreferencesGetOK) Code() int { + return 200 +} + +func (o *PreferencesGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetOK %s", 200, payload) +} + +func (o *PreferencesGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetOK %s", 200, payload) +} + +func (o *PreferencesGetOK) GetPayload() interface{} { + return o.Payload +} + +func (o *PreferencesGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPreferencesGetBadRequest creates a PreferencesGetBadRequest with default headers values +func NewPreferencesGetBadRequest() *PreferencesGetBadRequest { + return &PreferencesGetBadRequest{} +} + +/* +PreferencesGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PreferencesGetBadRequest struct { +} + +// IsSuccess returns true when this preferences get bad request response has a 2xx status code +func (o *PreferencesGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get bad request response has a 3xx status code +func (o *PreferencesGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get bad request response has a 4xx status code +func (o *PreferencesGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get bad request response has a 5xx status code +func (o *PreferencesGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get bad request response a status code equal to that given +func (o *PreferencesGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the preferences get bad request response +func (o *PreferencesGetBadRequest) Code() int { + return 400 +} + +func (o *PreferencesGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetBadRequest", 400) +} + +func (o *PreferencesGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetBadRequest", 400) +} + +func (o *PreferencesGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetUnauthorized creates a PreferencesGetUnauthorized with default headers values +func NewPreferencesGetUnauthorized() *PreferencesGetUnauthorized { + return &PreferencesGetUnauthorized{} +} + +/* +PreferencesGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PreferencesGetUnauthorized struct { +} + +// IsSuccess returns true when this preferences get unauthorized response has a 2xx status code +func (o *PreferencesGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get unauthorized response has a 3xx status code +func (o *PreferencesGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get unauthorized response has a 4xx status code +func (o *PreferencesGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get unauthorized response has a 5xx status code +func (o *PreferencesGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get unauthorized response a status code equal to that given +func (o *PreferencesGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the preferences get unauthorized response +func (o *PreferencesGetUnauthorized) Code() int { + return 401 +} + +func (o *PreferencesGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetUnauthorized", 401) +} + +func (o *PreferencesGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetUnauthorized", 401) +} + +func (o *PreferencesGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetNotFound creates a PreferencesGetNotFound with default headers values +func NewPreferencesGetNotFound() *PreferencesGetNotFound { + return &PreferencesGetNotFound{} +} + +/* +PreferencesGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type PreferencesGetNotFound struct { +} + +// IsSuccess returns true when this preferences get not found response has a 2xx status code +func (o *PreferencesGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get not found response has a 3xx status code +func (o *PreferencesGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get not found response has a 4xx status code +func (o *PreferencesGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get not found response has a 5xx status code +func (o *PreferencesGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get not found response a status code equal to that given +func (o *PreferencesGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the preferences get not found response +func (o *PreferencesGetNotFound) Code() int { + return 404 +} + +func (o *PreferencesGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotFound", 404) +} + +func (o *PreferencesGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotFound", 404) +} + +func (o *PreferencesGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetNotAcceptable creates a PreferencesGetNotAcceptable with default headers values +func NewPreferencesGetNotAcceptable() *PreferencesGetNotAcceptable { + return &PreferencesGetNotAcceptable{} +} + +/* +PreferencesGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type PreferencesGetNotAcceptable struct { +} + +// IsSuccess returns true when this preferences get not acceptable response has a 2xx status code +func (o *PreferencesGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get not acceptable response has a 3xx status code +func (o *PreferencesGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get not acceptable response has a 4xx status code +func (o *PreferencesGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this preferences get not acceptable response has a 5xx status code +func (o *PreferencesGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this preferences get not acceptable response a status code equal to that given +func (o *PreferencesGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the preferences get not acceptable response +func (o *PreferencesGetNotAcceptable) Code() int { + return 406 +} + +func (o *PreferencesGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotAcceptable", 406) +} + +func (o *PreferencesGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetNotAcceptable", 406) +} + +func (o *PreferencesGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPreferencesGetInternalServerError creates a PreferencesGetInternalServerError with default headers values +func NewPreferencesGetInternalServerError() *PreferencesGetInternalServerError { + return &PreferencesGetInternalServerError{} +} + +/* +PreferencesGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type PreferencesGetInternalServerError struct { +} + +// IsSuccess returns true when this preferences get internal server error response has a 2xx status code +func (o *PreferencesGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this preferences get internal server error response has a 3xx status code +func (o *PreferencesGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this preferences get internal server error response has a 4xx status code +func (o *PreferencesGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this preferences get internal server error response has a 5xx status code +func (o *PreferencesGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this preferences get internal server error response a status code equal to that given +func (o *PreferencesGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the preferences get internal server error response +func (o *PreferencesGetInternalServerError) Code() int { + return 500 +} + +func (o *PreferencesGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetInternalServerError", 500) +} + +func (o *PreferencesGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/preferences][%d] preferencesGetInternalServerError", 500) +} + +func (o *PreferencesGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/reports/report_create_parameters.go b/client/reports/report_create_parameters.go new file mode 100644 index 0000000..2df991d --- /dev/null +++ b/client/reports/report_create_parameters.go @@ -0,0 +1,365 @@ +// 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 +} diff --git a/client/reports/report_create_responses.go b/client/reports/report_create_responses.go new file mode 100644 index 0000000..2fc087a --- /dev/null +++ b/client/reports/report_create_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ReportCreateReader is a Reader for the ReportCreate structure. +type ReportCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReportCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReportCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewReportCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewReportCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewReportCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewReportCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewReportCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/reports] reportCreate", response, response.Code()) + } +} + +// NewReportCreateOK creates a ReportCreateOK with default headers values +func NewReportCreateOK() *ReportCreateOK { + return &ReportCreateOK{} +} + +/* +ReportCreateOK describes a response with status code 200, with default header values. + +The created report. +*/ +type ReportCreateOK struct { + Payload *models.Report +} + +// IsSuccess returns true when this report create o k response has a 2xx status code +func (o *ReportCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this report create o k response has a 3xx status code +func (o *ReportCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create o k response has a 4xx status code +func (o *ReportCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this report create o k response has a 5xx status code +func (o *ReportCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this report create o k response a status code equal to that given +func (o *ReportCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the report create o k response +func (o *ReportCreateOK) Code() int { + return 200 +} + +func (o *ReportCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateOK %s", 200, payload) +} + +func (o *ReportCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateOK %s", 200, payload) +} + +func (o *ReportCreateOK) GetPayload() *models.Report { + return o.Payload +} + +func (o *ReportCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Report) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewReportCreateBadRequest creates a ReportCreateBadRequest with default headers values +func NewReportCreateBadRequest() *ReportCreateBadRequest { + return &ReportCreateBadRequest{} +} + +/* +ReportCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ReportCreateBadRequest struct { +} + +// IsSuccess returns true when this report create bad request response has a 2xx status code +func (o *ReportCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create bad request response has a 3xx status code +func (o *ReportCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create bad request response has a 4xx status code +func (o *ReportCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create bad request response has a 5xx status code +func (o *ReportCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this report create bad request response a status code equal to that given +func (o *ReportCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the report create bad request response +func (o *ReportCreateBadRequest) Code() int { + return 400 +} + +func (o *ReportCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateBadRequest", 400) +} + +func (o *ReportCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateBadRequest", 400) +} + +func (o *ReportCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateUnauthorized creates a ReportCreateUnauthorized with default headers values +func NewReportCreateUnauthorized() *ReportCreateUnauthorized { + return &ReportCreateUnauthorized{} +} + +/* +ReportCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ReportCreateUnauthorized struct { +} + +// IsSuccess returns true when this report create unauthorized response has a 2xx status code +func (o *ReportCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create unauthorized response has a 3xx status code +func (o *ReportCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create unauthorized response has a 4xx status code +func (o *ReportCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create unauthorized response has a 5xx status code +func (o *ReportCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this report create unauthorized response a status code equal to that given +func (o *ReportCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the report create unauthorized response +func (o *ReportCreateUnauthorized) Code() int { + return 401 +} + +func (o *ReportCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateUnauthorized", 401) +} + +func (o *ReportCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateUnauthorized", 401) +} + +func (o *ReportCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateNotFound creates a ReportCreateNotFound with default headers values +func NewReportCreateNotFound() *ReportCreateNotFound { + return &ReportCreateNotFound{} +} + +/* +ReportCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ReportCreateNotFound struct { +} + +// IsSuccess returns true when this report create not found response has a 2xx status code +func (o *ReportCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create not found response has a 3xx status code +func (o *ReportCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create not found response has a 4xx status code +func (o *ReportCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create not found response has a 5xx status code +func (o *ReportCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this report create not found response a status code equal to that given +func (o *ReportCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the report create not found response +func (o *ReportCreateNotFound) Code() int { + return 404 +} + +func (o *ReportCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotFound", 404) +} + +func (o *ReportCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotFound", 404) +} + +func (o *ReportCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateNotAcceptable creates a ReportCreateNotAcceptable with default headers values +func NewReportCreateNotAcceptable() *ReportCreateNotAcceptable { + return &ReportCreateNotAcceptable{} +} + +/* +ReportCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ReportCreateNotAcceptable struct { +} + +// IsSuccess returns true when this report create not acceptable response has a 2xx status code +func (o *ReportCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create not acceptable response has a 3xx status code +func (o *ReportCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create not acceptable response has a 4xx status code +func (o *ReportCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this report create not acceptable response has a 5xx status code +func (o *ReportCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this report create not acceptable response a status code equal to that given +func (o *ReportCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the report create not acceptable response +func (o *ReportCreateNotAcceptable) Code() int { + return 406 +} + +func (o *ReportCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotAcceptable", 406) +} + +func (o *ReportCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateNotAcceptable", 406) +} + +func (o *ReportCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportCreateInternalServerError creates a ReportCreateInternalServerError with default headers values +func NewReportCreateInternalServerError() *ReportCreateInternalServerError { + return &ReportCreateInternalServerError{} +} + +/* +ReportCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ReportCreateInternalServerError struct { +} + +// IsSuccess returns true when this report create internal server error response has a 2xx status code +func (o *ReportCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report create internal server error response has a 3xx status code +func (o *ReportCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report create internal server error response has a 4xx status code +func (o *ReportCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this report create internal server error response has a 5xx status code +func (o *ReportCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this report create internal server error response a status code equal to that given +func (o *ReportCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the report create internal server error response +func (o *ReportCreateInternalServerError) Code() int { + return 500 +} + +func (o *ReportCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateInternalServerError", 500) +} + +func (o *ReportCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/reports][%d] reportCreateInternalServerError", 500) +} + +func (o *ReportCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/reports/report_get_parameters.go b/client/reports/report_get_parameters.go new file mode 100644 index 0000000..7d50fd2 --- /dev/null +++ b/client/reports/report_get_parameters.go @@ -0,0 +1,151 @@ +// 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" +) + +// NewReportGetParams creates a new ReportGetParams 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 NewReportGetParams() *ReportGetParams { + return &ReportGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReportGetParamsWithTimeout creates a new ReportGetParams object +// with the ability to set a timeout on a request. +func NewReportGetParamsWithTimeout(timeout time.Duration) *ReportGetParams { + return &ReportGetParams{ + timeout: timeout, + } +} + +// NewReportGetParamsWithContext creates a new ReportGetParams object +// with the ability to set a context for a request. +func NewReportGetParamsWithContext(ctx context.Context) *ReportGetParams { + return &ReportGetParams{ + Context: ctx, + } +} + +// NewReportGetParamsWithHTTPClient creates a new ReportGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewReportGetParamsWithHTTPClient(client *http.Client) *ReportGetParams { + return &ReportGetParams{ + HTTPClient: client, + } +} + +/* +ReportGetParams contains all the parameters to send to the API endpoint + + for the report get operation. + + Typically these are written to a http.Request. +*/ +type ReportGetParams struct { + + /* ID. + + ID of the report + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportGetParams) WithDefaults() *ReportGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the report get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the report get params +func (o *ReportGetParams) WithTimeout(timeout time.Duration) *ReportGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the report get params +func (o *ReportGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the report get params +func (o *ReportGetParams) WithContext(ctx context.Context) *ReportGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the report get params +func (o *ReportGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the report get params +func (o *ReportGetParams) WithHTTPClient(client *http.Client) *ReportGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the report get params +func (o *ReportGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the report get params +func (o *ReportGetParams) WithID(id string) *ReportGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the report get params +func (o *ReportGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ReportGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/reports/report_get_responses.go b/client/reports/report_get_responses.go new file mode 100644 index 0000000..8fb1a8d --- /dev/null +++ b/client/reports/report_get_responses.go @@ -0,0 +1,416 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ReportGetReader is a Reader for the ReportGet structure. +type ReportGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReportGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReportGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewReportGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewReportGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewReportGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewReportGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewReportGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/reports/{id}] reportGet", response, response.Code()) + } +} + +// NewReportGetOK creates a ReportGetOK with default headers values +func NewReportGetOK() *ReportGetOK { + return &ReportGetOK{} +} + +/* +ReportGetOK describes a response with status code 200, with default header values. + +The requested report. +*/ +type ReportGetOK struct { + Payload *models.Report +} + +// IsSuccess returns true when this report get o k response has a 2xx status code +func (o *ReportGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this report get o k response has a 3xx status code +func (o *ReportGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get o k response has a 4xx status code +func (o *ReportGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this report get o k response has a 5xx status code +func (o *ReportGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this report get o k response a status code equal to that given +func (o *ReportGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the report get o k response +func (o *ReportGetOK) Code() int { + return 200 +} + +func (o *ReportGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetOK %s", 200, payload) +} + +func (o *ReportGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetOK %s", 200, payload) +} + +func (o *ReportGetOK) GetPayload() *models.Report { + return o.Payload +} + +func (o *ReportGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Report) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewReportGetBadRequest creates a ReportGetBadRequest with default headers values +func NewReportGetBadRequest() *ReportGetBadRequest { + return &ReportGetBadRequest{} +} + +/* +ReportGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ReportGetBadRequest struct { +} + +// IsSuccess returns true when this report get bad request response has a 2xx status code +func (o *ReportGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get bad request response has a 3xx status code +func (o *ReportGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get bad request response has a 4xx status code +func (o *ReportGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get bad request response has a 5xx status code +func (o *ReportGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this report get bad request response a status code equal to that given +func (o *ReportGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the report get bad request response +func (o *ReportGetBadRequest) Code() int { + return 400 +} + +func (o *ReportGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetBadRequest", 400) +} + +func (o *ReportGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetBadRequest", 400) +} + +func (o *ReportGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetUnauthorized creates a ReportGetUnauthorized with default headers values +func NewReportGetUnauthorized() *ReportGetUnauthorized { + return &ReportGetUnauthorized{} +} + +/* +ReportGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ReportGetUnauthorized struct { +} + +// IsSuccess returns true when this report get unauthorized response has a 2xx status code +func (o *ReportGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get unauthorized response has a 3xx status code +func (o *ReportGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get unauthorized response has a 4xx status code +func (o *ReportGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get unauthorized response has a 5xx status code +func (o *ReportGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this report get unauthorized response a status code equal to that given +func (o *ReportGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the report get unauthorized response +func (o *ReportGetUnauthorized) Code() int { + return 401 +} + +func (o *ReportGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetUnauthorized", 401) +} + +func (o *ReportGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetUnauthorized", 401) +} + +func (o *ReportGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetNotFound creates a ReportGetNotFound with default headers values +func NewReportGetNotFound() *ReportGetNotFound { + return &ReportGetNotFound{} +} + +/* +ReportGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ReportGetNotFound struct { +} + +// IsSuccess returns true when this report get not found response has a 2xx status code +func (o *ReportGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get not found response has a 3xx status code +func (o *ReportGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get not found response has a 4xx status code +func (o *ReportGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get not found response has a 5xx status code +func (o *ReportGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this report get not found response a status code equal to that given +func (o *ReportGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the report get not found response +func (o *ReportGetNotFound) Code() int { + return 404 +} + +func (o *ReportGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotFound", 404) +} + +func (o *ReportGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotFound", 404) +} + +func (o *ReportGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetNotAcceptable creates a ReportGetNotAcceptable with default headers values +func NewReportGetNotAcceptable() *ReportGetNotAcceptable { + return &ReportGetNotAcceptable{} +} + +/* +ReportGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ReportGetNotAcceptable struct { +} + +// IsSuccess returns true when this report get not acceptable response has a 2xx status code +func (o *ReportGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get not acceptable response has a 3xx status code +func (o *ReportGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get not acceptable response has a 4xx status code +func (o *ReportGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this report get not acceptable response has a 5xx status code +func (o *ReportGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this report get not acceptable response a status code equal to that given +func (o *ReportGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the report get not acceptable response +func (o *ReportGetNotAcceptable) Code() int { + return 406 +} + +func (o *ReportGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotAcceptable", 406) +} + +func (o *ReportGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetNotAcceptable", 406) +} + +func (o *ReportGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportGetInternalServerError creates a ReportGetInternalServerError with default headers values +func NewReportGetInternalServerError() *ReportGetInternalServerError { + return &ReportGetInternalServerError{} +} + +/* +ReportGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ReportGetInternalServerError struct { +} + +// IsSuccess returns true when this report get internal server error response has a 2xx status code +func (o *ReportGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this report get internal server error response has a 3xx status code +func (o *ReportGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this report get internal server error response has a 4xx status code +func (o *ReportGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this report get internal server error response has a 5xx status code +func (o *ReportGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this report get internal server error response a status code equal to that given +func (o *ReportGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the report get internal server error response +func (o *ReportGetInternalServerError) Code() int { + return 500 +} + +func (o *ReportGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetInternalServerError", 500) +} + +func (o *ReportGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/reports/{id}][%d] reportGetInternalServerError", 500) +} + +func (o *ReportGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/reports/reports_client.go b/client/reports/reports_client.go new file mode 100644 index 0000000..e5f29fc --- /dev/null +++ b/client/reports/reports_client.go @@ -0,0 +1,227 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new reports API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new reports API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new reports API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for reports API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + ReportCreate(params *ReportCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportCreateOK, error) + + ReportGet(params *ReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportGetOK, error) + + Reports(params *ReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportsOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +ReportCreate creates a new user report with the given parameters +*/ +func (a *Client) ReportCreate(params *ReportCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReportCreateParams() + } + op := &runtime.ClientOperation{ + ID: "reportCreate", + Method: "POST", + PathPattern: "/api/v1/reports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReportCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ReportCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for reportCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ReportGet gets one report with the given id +*/ +func (a *Client) ReportGet(params *ReportGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReportGetParams() + } + op := &runtime.ClientOperation{ + ID: "reportGet", + Method: "GET", + PathPattern: "/api/v1/reports/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReportGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ReportGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for reportGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + Reports sees reports created by the requesting account + + The reports will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The next and previous queries can be parsed from the returned Link header. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) Reports(params *ReportsParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ReportsOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewReportsParams() + } + op := &runtime.ClientOperation{ + ID: "reports", + Method: "GET", + PathPattern: "/api/v1/reports", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ReportsReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ReportsOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for reports: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/reports/reports_parameters.go b/client/reports/reports_parameters.go new file mode 100644 index 0000000..0e2c98b --- /dev/null +++ b/client/reports/reports_parameters.go @@ -0,0 +1,347 @@ +// 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" +) + +// NewReportsParams creates a new ReportsParams 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 NewReportsParams() *ReportsParams { + return &ReportsParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewReportsParamsWithTimeout creates a new ReportsParams object +// with the ability to set a timeout on a request. +func NewReportsParamsWithTimeout(timeout time.Duration) *ReportsParams { + return &ReportsParams{ + timeout: timeout, + } +} + +// NewReportsParamsWithContext creates a new ReportsParams object +// with the ability to set a context for a request. +func NewReportsParamsWithContext(ctx context.Context) *ReportsParams { + return &ReportsParams{ + Context: ctx, + } +} + +// NewReportsParamsWithHTTPClient creates a new ReportsParams object +// with the ability to set a custom HTTPClient for a request. +func NewReportsParamsWithHTTPClient(client *http.Client) *ReportsParams { + return &ReportsParams{ + HTTPClient: client, + } +} + +/* +ReportsParams contains all the parameters to send to the API endpoint + + for the reports operation. + + Typically these are written to a http.Request. +*/ +type ReportsParams struct { + + /* Limit. + + Number of reports to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only reports *OLDER* than the given max ID (for paging downwards). The report with the specified ID will not be included in the response. + */ + MaxID *string + + /* MinID. + + Return only reports immediately *NEWER* than the given min ID (for paging upwards). The report with the specified ID will not be included in the response. + */ + MinID *string + + /* Resolved. + + If set to true, only resolved reports will be returned. If false, only unresolved reports will be returned. If unset, reports will not be filtered on their resolved status. + */ + Resolved *bool + + /* SinceID. + + Return only reports *NEWER* than the given since ID. The report with the specified ID will not be included in the response. + */ + SinceID *string + + /* TargetAccountID. + + Return only reports that target the given account id. + */ + TargetAccountID *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportsParams) WithDefaults() *ReportsParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the reports params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ReportsParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := ReportsParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the reports params +func (o *ReportsParams) WithTimeout(timeout time.Duration) *ReportsParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the reports params +func (o *ReportsParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the reports params +func (o *ReportsParams) WithContext(ctx context.Context) *ReportsParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the reports params +func (o *ReportsParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the reports params +func (o *ReportsParams) WithHTTPClient(client *http.Client) *ReportsParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the reports params +func (o *ReportsParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the reports params +func (o *ReportsParams) WithLimit(limit *int64) *ReportsParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the reports params +func (o *ReportsParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the reports params +func (o *ReportsParams) WithMaxID(maxID *string) *ReportsParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the reports params +func (o *ReportsParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the reports params +func (o *ReportsParams) WithMinID(minID *string) *ReportsParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the reports params +func (o *ReportsParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithResolved adds the resolved to the reports params +func (o *ReportsParams) WithResolved(resolved *bool) *ReportsParams { + o.SetResolved(resolved) + return o +} + +// SetResolved adds the resolved to the reports params +func (o *ReportsParams) SetResolved(resolved *bool) { + o.Resolved = resolved +} + +// WithSinceID adds the sinceID to the reports params +func (o *ReportsParams) WithSinceID(sinceID *string) *ReportsParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the reports params +func (o *ReportsParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTargetAccountID adds the targetAccountID to the reports params +func (o *ReportsParams) WithTargetAccountID(targetAccountID *string) *ReportsParams { + o.SetTargetAccountID(targetAccountID) + return o +} + +// SetTargetAccountID adds the targetAccountId to the reports params +func (o *ReportsParams) SetTargetAccountID(targetAccountID *string) { + o.TargetAccountID = targetAccountID +} + +// WriteToRequest writes these params to a swagger request +func (o *ReportsParams) 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.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.Resolved != nil { + + // query param resolved + var qrResolved bool + + if o.Resolved != nil { + qrResolved = *o.Resolved + } + qResolved := swag.FormatBool(qrResolved) + if qResolved != "" { + + if err := r.SetQueryParam("resolved", qResolved); 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 o.TargetAccountID != nil { + + // query param target_account_id + var qrTargetAccountID string + + if o.TargetAccountID != nil { + qrTargetAccountID = *o.TargetAccountID + } + qTargetAccountID := qrTargetAccountID + if qTargetAccountID != "" { + + if err := r.SetQueryParam("target_account_id", qTargetAccountID); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/reports/reports_responses.go b/client/reports/reports_responses.go new file mode 100644 index 0000000..e050711 --- /dev/null +++ b/client/reports/reports_responses.go @@ -0,0 +1,426 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ReportsReader is a Reader for the Reports structure. +type ReportsReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ReportsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewReportsOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewReportsBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewReportsUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewReportsNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewReportsNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewReportsInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/reports] reports", response, response.Code()) + } +} + +// NewReportsOK creates a ReportsOK with default headers values +func NewReportsOK() *ReportsOK { + return &ReportsOK{} +} + +/* +ReportsOK describes a response with status code 200, with default header values. + +Array of reports. +*/ +type ReportsOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Report +} + +// IsSuccess returns true when this reports o k response has a 2xx status code +func (o *ReportsOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this reports o k response has a 3xx status code +func (o *ReportsOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports o k response has a 4xx status code +func (o *ReportsOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this reports o k response has a 5xx status code +func (o *ReportsOK) IsServerError() bool { + return false +} + +// IsCode returns true when this reports o k response a status code equal to that given +func (o *ReportsOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the reports o k response +func (o *ReportsOK) Code() int { + return 200 +} + +func (o *ReportsOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsOK %s", 200, payload) +} + +func (o *ReportsOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsOK %s", 200, payload) +} + +func (o *ReportsOK) GetPayload() []*models.Report { + return o.Payload +} + +func (o *ReportsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewReportsBadRequest creates a ReportsBadRequest with default headers values +func NewReportsBadRequest() *ReportsBadRequest { + return &ReportsBadRequest{} +} + +/* +ReportsBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ReportsBadRequest struct { +} + +// IsSuccess returns true when this reports bad request response has a 2xx status code +func (o *ReportsBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports bad request response has a 3xx status code +func (o *ReportsBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports bad request response has a 4xx status code +func (o *ReportsBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports bad request response has a 5xx status code +func (o *ReportsBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this reports bad request response a status code equal to that given +func (o *ReportsBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the reports bad request response +func (o *ReportsBadRequest) Code() int { + return 400 +} + +func (o *ReportsBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsBadRequest", 400) +} + +func (o *ReportsBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsBadRequest", 400) +} + +func (o *ReportsBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsUnauthorized creates a ReportsUnauthorized with default headers values +func NewReportsUnauthorized() *ReportsUnauthorized { + return &ReportsUnauthorized{} +} + +/* +ReportsUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ReportsUnauthorized struct { +} + +// IsSuccess returns true when this reports unauthorized response has a 2xx status code +func (o *ReportsUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports unauthorized response has a 3xx status code +func (o *ReportsUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports unauthorized response has a 4xx status code +func (o *ReportsUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports unauthorized response has a 5xx status code +func (o *ReportsUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this reports unauthorized response a status code equal to that given +func (o *ReportsUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the reports unauthorized response +func (o *ReportsUnauthorized) Code() int { + return 401 +} + +func (o *ReportsUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsUnauthorized", 401) +} + +func (o *ReportsUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsUnauthorized", 401) +} + +func (o *ReportsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsNotFound creates a ReportsNotFound with default headers values +func NewReportsNotFound() *ReportsNotFound { + return &ReportsNotFound{} +} + +/* +ReportsNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ReportsNotFound struct { +} + +// IsSuccess returns true when this reports not found response has a 2xx status code +func (o *ReportsNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports not found response has a 3xx status code +func (o *ReportsNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports not found response has a 4xx status code +func (o *ReportsNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports not found response has a 5xx status code +func (o *ReportsNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this reports not found response a status code equal to that given +func (o *ReportsNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the reports not found response +func (o *ReportsNotFound) Code() int { + return 404 +} + +func (o *ReportsNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotFound", 404) +} + +func (o *ReportsNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotFound", 404) +} + +func (o *ReportsNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsNotAcceptable creates a ReportsNotAcceptable with default headers values +func NewReportsNotAcceptable() *ReportsNotAcceptable { + return &ReportsNotAcceptable{} +} + +/* +ReportsNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ReportsNotAcceptable struct { +} + +// IsSuccess returns true when this reports not acceptable response has a 2xx status code +func (o *ReportsNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports not acceptable response has a 3xx status code +func (o *ReportsNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports not acceptable response has a 4xx status code +func (o *ReportsNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this reports not acceptable response has a 5xx status code +func (o *ReportsNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this reports not acceptable response a status code equal to that given +func (o *ReportsNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the reports not acceptable response +func (o *ReportsNotAcceptable) Code() int { + return 406 +} + +func (o *ReportsNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotAcceptable", 406) +} + +func (o *ReportsNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsNotAcceptable", 406) +} + +func (o *ReportsNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewReportsInternalServerError creates a ReportsInternalServerError with default headers values +func NewReportsInternalServerError() *ReportsInternalServerError { + return &ReportsInternalServerError{} +} + +/* +ReportsInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ReportsInternalServerError struct { +} + +// IsSuccess returns true when this reports internal server error response has a 2xx status code +func (o *ReportsInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this reports internal server error response has a 3xx status code +func (o *ReportsInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this reports internal server error response has a 4xx status code +func (o *ReportsInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this reports internal server error response has a 5xx status code +func (o *ReportsInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this reports internal server error response a status code equal to that given +func (o *ReportsInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the reports internal server error response +func (o *ReportsInternalServerError) Code() int { + return 500 +} + +func (o *ReportsInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsInternalServerError", 500) +} + +func (o *ReportsInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/reports][%d] reportsInternalServerError", 500) +} + +func (o *ReportsInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/search/search_client.go b/client/search/search_client.go new file mode 100644 index 0000000..457cc7a --- /dev/null +++ b/client/search/search_client.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package search + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new search API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new search API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new search API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for search API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + SearchGet(params *SearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchGetOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +SearchGet searches for statuses accounts or hashtags on this instance or elsewhere + +If statuses are in the result, they will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). +*/ +func (a *Client) SearchGet(params *SearchGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*SearchGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewSearchGetParams() + } + op := &runtime.ClientOperation{ + ID: "searchGet", + Method: "GET", + PathPattern: "/api/{api_version}/search", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &SearchGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*SearchGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for searchGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/search/search_get_parameters.go b/client/search/search_get_parameters.go new file mode 100644 index 0000000..3ba36a4 --- /dev/null +++ b/client/search/search_get_parameters.go @@ -0,0 +1,524 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package search + +// 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" +) + +// NewSearchGetParams creates a new SearchGetParams 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 NewSearchGetParams() *SearchGetParams { + return &SearchGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewSearchGetParamsWithTimeout creates a new SearchGetParams object +// with the ability to set a timeout on a request. +func NewSearchGetParamsWithTimeout(timeout time.Duration) *SearchGetParams { + return &SearchGetParams{ + timeout: timeout, + } +} + +// NewSearchGetParamsWithContext creates a new SearchGetParams object +// with the ability to set a context for a request. +func NewSearchGetParamsWithContext(ctx context.Context) *SearchGetParams { + return &SearchGetParams{ + Context: ctx, + } +} + +// NewSearchGetParamsWithHTTPClient creates a new SearchGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewSearchGetParamsWithHTTPClient(client *http.Client) *SearchGetParams { + return &SearchGetParams{ + HTTPClient: client, + } +} + +/* +SearchGetParams contains all the parameters to send to the API endpoint + + for the search get operation. + + Typically these are written to a http.Request. +*/ +type SearchGetParams struct { + + /* AccountID. + + Restrict results to statuses created by the specified account. + */ + AccountID *string + + /* APIVersion. + + Version of the API to use. Must be either `v1` or `v2`. If v1 is used, Hashtag results will be a slice of strings. If v2 is used, Hashtag results will be a slice of apimodel tags. + */ + APIVersion string + + /* ExcludeUnreviewed. + + If searching for hashtags, exclude those not yet approved by instance admin. Currently this parameter is unused. + */ + ExcludeUnreviewed *bool + + /* Following. + + If search type includes accounts, and search query is an arbitrary string, show only accounts that the requesting account follows. If this is set to `true`, then the GoToSocial instance will enhance the search by also searching within account notes, not just in usernames and display names. + */ + Following *bool + + /* Limit. + + Number of each type of item to return. + + Default: 20 + */ + Limit *int64 + + /* MaxID. + + Return only items *OLDER* than the given max ID. The item with the specified ID will not be included in the response. Currently only used if 'type' is set to a specific type. + */ + MaxID *string + + /* MinID. + + Return only items *immediately newer* than the given min ID. The item with the specified ID will not be included in the response. Currently only used if 'type' is set to a specific type. + */ + MinID *string + + /* Offset. + + Page number of results to return (starts at 0). This parameter is currently not used, page by selecting a specific query type and using maxID and minID instead. + */ + Offset *int64 + + /* Q. + + Query string to search for. This can be in the following forms: + - `@[username]` -- search for an account with the given username on any domain. Can return multiple results. + - @[username]@[domain]` -- search for a remote account with exact username and domain. Will only ever return 1 result at most. + - `https://example.org/some/arbitrary/url` -- search for an account OR a status with the given URL. Will only ever return 1 result at most. + - `#[hashtag_name]` -- search for a hashtag with the given hashtag name, or starting with the given hashtag name. Case insensitive. Can return multiple results. + - any arbitrary string -- search for accounts or statuses containing the given string. Can return multiple results. + + Arbitrary string queries may include the following operators: + - `from:localuser`, `from:remoteuser@instance.tld`: restrict results to statuses created by the specified account. + */ + Q string + + /* Resolve. + + If searching query is for `@[username]@[domain]`, or a URL, allow the GoToSocial instance to resolve the search by making calls to remote instances (webfinger, ActivityPub, etc). + */ + Resolve *bool + + /* Type. + + Type of item to return. One of: + - `` -- empty string; return any/all results. + - `accounts` -- return only account(s). + - `statuses` -- return only status(es). + - `hashtags` -- return only hashtag(s). + If `type` is specified, paging can be performed using max_id and min_id parameters. + If `type` is not specified, see the `offset` parameter for paging. + */ + Type *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SearchGetParams) WithDefaults() *SearchGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the search get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *SearchGetParams) SetDefaults() { + var ( + excludeUnreviewedDefault = bool(false) + + followingDefault = bool(false) + + limitDefault = int64(20) + + offsetDefault = int64(0) + + resolveDefault = bool(false) + ) + + val := SearchGetParams{ + ExcludeUnreviewed: &excludeUnreviewedDefault, + Following: &followingDefault, + Limit: &limitDefault, + Offset: &offsetDefault, + Resolve: &resolveDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the search get params +func (o *SearchGetParams) WithTimeout(timeout time.Duration) *SearchGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the search get params +func (o *SearchGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the search get params +func (o *SearchGetParams) WithContext(ctx context.Context) *SearchGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the search get params +func (o *SearchGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the search get params +func (o *SearchGetParams) WithHTTPClient(client *http.Client) *SearchGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the search get params +func (o *SearchGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccountID adds the accountID to the search get params +func (o *SearchGetParams) WithAccountID(accountID *string) *SearchGetParams { + o.SetAccountID(accountID) + return o +} + +// SetAccountID adds the accountId to the search get params +func (o *SearchGetParams) SetAccountID(accountID *string) { + o.AccountID = accountID +} + +// WithAPIVersion adds the aPIVersion to the search get params +func (o *SearchGetParams) WithAPIVersion(aPIVersion string) *SearchGetParams { + o.SetAPIVersion(aPIVersion) + return o +} + +// SetAPIVersion adds the apiVersion to the search get params +func (o *SearchGetParams) SetAPIVersion(aPIVersion string) { + o.APIVersion = aPIVersion +} + +// WithExcludeUnreviewed adds the excludeUnreviewed to the search get params +func (o *SearchGetParams) WithExcludeUnreviewed(excludeUnreviewed *bool) *SearchGetParams { + o.SetExcludeUnreviewed(excludeUnreviewed) + return o +} + +// SetExcludeUnreviewed adds the excludeUnreviewed to the search get params +func (o *SearchGetParams) SetExcludeUnreviewed(excludeUnreviewed *bool) { + o.ExcludeUnreviewed = excludeUnreviewed +} + +// WithFollowing adds the following to the search get params +func (o *SearchGetParams) WithFollowing(following *bool) *SearchGetParams { + o.SetFollowing(following) + return o +} + +// SetFollowing adds the following to the search get params +func (o *SearchGetParams) SetFollowing(following *bool) { + o.Following = following +} + +// WithLimit adds the limit to the search get params +func (o *SearchGetParams) WithLimit(limit *int64) *SearchGetParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the search get params +func (o *SearchGetParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the search get params +func (o *SearchGetParams) WithMaxID(maxID *string) *SearchGetParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the search get params +func (o *SearchGetParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the search get params +func (o *SearchGetParams) WithMinID(minID *string) *SearchGetParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the search get params +func (o *SearchGetParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithOffset adds the offset to the search get params +func (o *SearchGetParams) WithOffset(offset *int64) *SearchGetParams { + o.SetOffset(offset) + return o +} + +// SetOffset adds the offset to the search get params +func (o *SearchGetParams) SetOffset(offset *int64) { + o.Offset = offset +} + +// WithQ adds the q to the search get params +func (o *SearchGetParams) WithQ(q string) *SearchGetParams { + o.SetQ(q) + return o +} + +// SetQ adds the q to the search get params +func (o *SearchGetParams) SetQ(q string) { + o.Q = q +} + +// WithResolve adds the resolve to the search get params +func (o *SearchGetParams) WithResolve(resolve *bool) *SearchGetParams { + o.SetResolve(resolve) + return o +} + +// SetResolve adds the resolve to the search get params +func (o *SearchGetParams) SetResolve(resolve *bool) { + o.Resolve = resolve +} + +// WithType adds the typeVar to the search get params +func (o *SearchGetParams) WithType(typeVar *string) *SearchGetParams { + o.SetType(typeVar) + return o +} + +// SetType adds the type to the search get params +func (o *SearchGetParams) SetType(typeVar *string) { + o.Type = typeVar +} + +// WriteToRequest writes these params to a swagger request +func (o *SearchGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.AccountID != nil { + + // query param account_id + var qrAccountID string + + if o.AccountID != nil { + qrAccountID = *o.AccountID + } + qAccountID := qrAccountID + if qAccountID != "" { + + if err := r.SetQueryParam("account_id", qAccountID); err != nil { + return err + } + } + } + + // path param api_version + if err := r.SetPathParam("api_version", o.APIVersion); err != nil { + return err + } + + if o.ExcludeUnreviewed != nil { + + // query param exclude_unreviewed + var qrExcludeUnreviewed bool + + if o.ExcludeUnreviewed != nil { + qrExcludeUnreviewed = *o.ExcludeUnreviewed + } + qExcludeUnreviewed := swag.FormatBool(qrExcludeUnreviewed) + if qExcludeUnreviewed != "" { + + if err := r.SetQueryParam("exclude_unreviewed", qExcludeUnreviewed); err != nil { + return err + } + } + } + + if o.Following != nil { + + // query param following + var qrFollowing bool + + if o.Following != nil { + qrFollowing = *o.Following + } + qFollowing := swag.FormatBool(qrFollowing) + if qFollowing != "" { + + if err := r.SetQueryParam("following", qFollowing); err != nil { + return err + } + } + } + + 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.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.Offset != nil { + + // query param offset + var qrOffset int64 + + if o.Offset != nil { + qrOffset = *o.Offset + } + qOffset := swag.FormatInt64(qrOffset) + if qOffset != "" { + + if err := r.SetQueryParam("offset", qOffset); err != nil { + return err + } + } + } + + // query param q + qrQ := o.Q + qQ := qrQ + if qQ != "" { + + if err := r.SetQueryParam("q", qQ); err != nil { + return err + } + } + + if o.Resolve != nil { + + // query param resolve + var qrResolve bool + + if o.Resolve != nil { + qrResolve = *o.Resolve + } + qResolve := swag.FormatBool(qrResolve) + if qResolve != "" { + + if err := r.SetQueryParam("resolve", qResolve); err != nil { + return err + } + } + } + + if o.Type != nil { + + // query param type + var qrType string + + if o.Type != nil { + qrType = *o.Type + } + qType := qrType + if qType != "" { + + if err := r.SetQueryParam("type", qType); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/search/search_get_responses.go b/client/search/search_get_responses.go new file mode 100644 index 0000000..8523ca2 --- /dev/null +++ b/client/search/search_get_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package search + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// SearchGetReader is a Reader for the SearchGet structure. +type SearchGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *SearchGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewSearchGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewSearchGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewSearchGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewSearchGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewSearchGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewSearchGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/{api_version}/search] searchGet", response, response.Code()) + } +} + +// NewSearchGetOK creates a SearchGetOK with default headers values +func NewSearchGetOK() *SearchGetOK { + return &SearchGetOK{} +} + +/* +SearchGetOK describes a response with status code 200, with default header values. + +Results of the search. +*/ +type SearchGetOK struct { + Payload *models.SearchResult +} + +// IsSuccess returns true when this search get o k response has a 2xx status code +func (o *SearchGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this search get o k response has a 3xx status code +func (o *SearchGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get o k response has a 4xx status code +func (o *SearchGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this search get o k response has a 5xx status code +func (o *SearchGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this search get o k response a status code equal to that given +func (o *SearchGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the search get o k response +func (o *SearchGetOK) Code() int { + return 200 +} + +func (o *SearchGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetOK %s", 200, payload) +} + +func (o *SearchGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetOK %s", 200, payload) +} + +func (o *SearchGetOK) GetPayload() *models.SearchResult { + return o.Payload +} + +func (o *SearchGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.SearchResult) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewSearchGetBadRequest creates a SearchGetBadRequest with default headers values +func NewSearchGetBadRequest() *SearchGetBadRequest { + return &SearchGetBadRequest{} +} + +/* +SearchGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type SearchGetBadRequest struct { +} + +// IsSuccess returns true when this search get bad request response has a 2xx status code +func (o *SearchGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get bad request response has a 3xx status code +func (o *SearchGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get bad request response has a 4xx status code +func (o *SearchGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get bad request response has a 5xx status code +func (o *SearchGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this search get bad request response a status code equal to that given +func (o *SearchGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the search get bad request response +func (o *SearchGetBadRequest) Code() int { + return 400 +} + +func (o *SearchGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetBadRequest", 400) +} + +func (o *SearchGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetBadRequest", 400) +} + +func (o *SearchGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetUnauthorized creates a SearchGetUnauthorized with default headers values +func NewSearchGetUnauthorized() *SearchGetUnauthorized { + return &SearchGetUnauthorized{} +} + +/* +SearchGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type SearchGetUnauthorized struct { +} + +// IsSuccess returns true when this search get unauthorized response has a 2xx status code +func (o *SearchGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get unauthorized response has a 3xx status code +func (o *SearchGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get unauthorized response has a 4xx status code +func (o *SearchGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get unauthorized response has a 5xx status code +func (o *SearchGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this search get unauthorized response a status code equal to that given +func (o *SearchGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the search get unauthorized response +func (o *SearchGetUnauthorized) Code() int { + return 401 +} + +func (o *SearchGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetUnauthorized", 401) +} + +func (o *SearchGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetUnauthorized", 401) +} + +func (o *SearchGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetNotFound creates a SearchGetNotFound with default headers values +func NewSearchGetNotFound() *SearchGetNotFound { + return &SearchGetNotFound{} +} + +/* +SearchGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type SearchGetNotFound struct { +} + +// IsSuccess returns true when this search get not found response has a 2xx status code +func (o *SearchGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get not found response has a 3xx status code +func (o *SearchGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get not found response has a 4xx status code +func (o *SearchGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get not found response has a 5xx status code +func (o *SearchGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this search get not found response a status code equal to that given +func (o *SearchGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the search get not found response +func (o *SearchGetNotFound) Code() int { + return 404 +} + +func (o *SearchGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotFound", 404) +} + +func (o *SearchGetNotFound) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotFound", 404) +} + +func (o *SearchGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetNotAcceptable creates a SearchGetNotAcceptable with default headers values +func NewSearchGetNotAcceptable() *SearchGetNotAcceptable { + return &SearchGetNotAcceptable{} +} + +/* +SearchGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type SearchGetNotAcceptable struct { +} + +// IsSuccess returns true when this search get not acceptable response has a 2xx status code +func (o *SearchGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get not acceptable response has a 3xx status code +func (o *SearchGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get not acceptable response has a 4xx status code +func (o *SearchGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this search get not acceptable response has a 5xx status code +func (o *SearchGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this search get not acceptable response a status code equal to that given +func (o *SearchGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the search get not acceptable response +func (o *SearchGetNotAcceptable) Code() int { + return 406 +} + +func (o *SearchGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotAcceptable", 406) +} + +func (o *SearchGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetNotAcceptable", 406) +} + +func (o *SearchGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewSearchGetInternalServerError creates a SearchGetInternalServerError with default headers values +func NewSearchGetInternalServerError() *SearchGetInternalServerError { + return &SearchGetInternalServerError{} +} + +/* +SearchGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type SearchGetInternalServerError struct { +} + +// IsSuccess returns true when this search get internal server error response has a 2xx status code +func (o *SearchGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this search get internal server error response has a 3xx status code +func (o *SearchGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this search get internal server error response has a 4xx status code +func (o *SearchGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this search get internal server error response has a 5xx status code +func (o *SearchGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this search get internal server error response a status code equal to that given +func (o *SearchGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the search get internal server error response +func (o *SearchGetInternalServerError) Code() int { + return 500 +} + +func (o *SearchGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetInternalServerError", 500) +} + +func (o *SearchGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/{api_version}/search][%d] searchGetInternalServerError", 500) +} + +func (o *SearchGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_bookmark_parameters.go b/client/statuses/status_bookmark_parameters.go new file mode 100644 index 0000000..70d0206 --- /dev/null +++ b/client/statuses/status_bookmark_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusBookmarkParams creates a new StatusBookmarkParams 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 NewStatusBookmarkParams() *StatusBookmarkParams { + return &StatusBookmarkParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusBookmarkParamsWithTimeout creates a new StatusBookmarkParams object +// with the ability to set a timeout on a request. +func NewStatusBookmarkParamsWithTimeout(timeout time.Duration) *StatusBookmarkParams { + return &StatusBookmarkParams{ + timeout: timeout, + } +} + +// NewStatusBookmarkParamsWithContext creates a new StatusBookmarkParams object +// with the ability to set a context for a request. +func NewStatusBookmarkParamsWithContext(ctx context.Context) *StatusBookmarkParams { + return &StatusBookmarkParams{ + Context: ctx, + } +} + +// NewStatusBookmarkParamsWithHTTPClient creates a new StatusBookmarkParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusBookmarkParamsWithHTTPClient(client *http.Client) *StatusBookmarkParams { + return &StatusBookmarkParams{ + HTTPClient: client, + } +} + +/* +StatusBookmarkParams contains all the parameters to send to the API endpoint + + for the status bookmark operation. + + Typically these are written to a http.Request. +*/ +type StatusBookmarkParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status bookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBookmarkParams) WithDefaults() *StatusBookmarkParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status bookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBookmarkParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status bookmark params +func (o *StatusBookmarkParams) WithTimeout(timeout time.Duration) *StatusBookmarkParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status bookmark params +func (o *StatusBookmarkParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status bookmark params +func (o *StatusBookmarkParams) WithContext(ctx context.Context) *StatusBookmarkParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status bookmark params +func (o *StatusBookmarkParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status bookmark params +func (o *StatusBookmarkParams) WithHTTPClient(client *http.Client) *StatusBookmarkParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status bookmark params +func (o *StatusBookmarkParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status bookmark params +func (o *StatusBookmarkParams) WithID(id string) *StatusBookmarkParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status bookmark params +func (o *StatusBookmarkParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusBookmarkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_bookmark_responses.go b/client/statuses/status_bookmark_responses.go new file mode 100644 index 0000000..3f0f760 --- /dev/null +++ b/client/statuses/status_bookmark_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusBookmarkReader is a Reader for the StatusBookmark structure. +type StatusBookmarkReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusBookmarkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusBookmarkOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusBookmarkBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusBookmarkUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusBookmarkForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusBookmarkNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusBookmarkNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusBookmarkInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/bookmark] statusBookmark", response, response.Code()) + } +} + +// NewStatusBookmarkOK creates a StatusBookmarkOK with default headers values +func NewStatusBookmarkOK() *StatusBookmarkOK { + return &StatusBookmarkOK{} +} + +/* +StatusBookmarkOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusBookmarkOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status bookmark o k response has a 2xx status code +func (o *StatusBookmarkOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status bookmark o k response has a 3xx status code +func (o *StatusBookmarkOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark o k response has a 4xx status code +func (o *StatusBookmarkOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status bookmark o k response has a 5xx status code +func (o *StatusBookmarkOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark o k response a status code equal to that given +func (o *StatusBookmarkOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status bookmark o k response +func (o *StatusBookmarkOK) Code() int { + return 200 +} + +func (o *StatusBookmarkOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkOK %s", 200, payload) +} + +func (o *StatusBookmarkOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkOK %s", 200, payload) +} + +func (o *StatusBookmarkOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusBookmarkOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusBookmarkBadRequest creates a StatusBookmarkBadRequest with default headers values +func NewStatusBookmarkBadRequest() *StatusBookmarkBadRequest { + return &StatusBookmarkBadRequest{} +} + +/* +StatusBookmarkBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusBookmarkBadRequest struct { +} + +// IsSuccess returns true when this status bookmark bad request response has a 2xx status code +func (o *StatusBookmarkBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark bad request response has a 3xx status code +func (o *StatusBookmarkBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark bad request response has a 4xx status code +func (o *StatusBookmarkBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark bad request response has a 5xx status code +func (o *StatusBookmarkBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark bad request response a status code equal to that given +func (o *StatusBookmarkBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status bookmark bad request response +func (o *StatusBookmarkBadRequest) Code() int { + return 400 +} + +func (o *StatusBookmarkBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkBadRequest", 400) +} + +func (o *StatusBookmarkBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkBadRequest", 400) +} + +func (o *StatusBookmarkBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkUnauthorized creates a StatusBookmarkUnauthorized with default headers values +func NewStatusBookmarkUnauthorized() *StatusBookmarkUnauthorized { + return &StatusBookmarkUnauthorized{} +} + +/* +StatusBookmarkUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusBookmarkUnauthorized struct { +} + +// IsSuccess returns true when this status bookmark unauthorized response has a 2xx status code +func (o *StatusBookmarkUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark unauthorized response has a 3xx status code +func (o *StatusBookmarkUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark unauthorized response has a 4xx status code +func (o *StatusBookmarkUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark unauthorized response has a 5xx status code +func (o *StatusBookmarkUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark unauthorized response a status code equal to that given +func (o *StatusBookmarkUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status bookmark unauthorized response +func (o *StatusBookmarkUnauthorized) Code() int { + return 401 +} + +func (o *StatusBookmarkUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkUnauthorized", 401) +} + +func (o *StatusBookmarkUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkUnauthorized", 401) +} + +func (o *StatusBookmarkUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkForbidden creates a StatusBookmarkForbidden with default headers values +func NewStatusBookmarkForbidden() *StatusBookmarkForbidden { + return &StatusBookmarkForbidden{} +} + +/* +StatusBookmarkForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusBookmarkForbidden struct { +} + +// IsSuccess returns true when this status bookmark forbidden response has a 2xx status code +func (o *StatusBookmarkForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark forbidden response has a 3xx status code +func (o *StatusBookmarkForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark forbidden response has a 4xx status code +func (o *StatusBookmarkForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark forbidden response has a 5xx status code +func (o *StatusBookmarkForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark forbidden response a status code equal to that given +func (o *StatusBookmarkForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status bookmark forbidden response +func (o *StatusBookmarkForbidden) Code() int { + return 403 +} + +func (o *StatusBookmarkForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkForbidden", 403) +} + +func (o *StatusBookmarkForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkForbidden", 403) +} + +func (o *StatusBookmarkForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkNotFound creates a StatusBookmarkNotFound with default headers values +func NewStatusBookmarkNotFound() *StatusBookmarkNotFound { + return &StatusBookmarkNotFound{} +} + +/* +StatusBookmarkNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusBookmarkNotFound struct { +} + +// IsSuccess returns true when this status bookmark not found response has a 2xx status code +func (o *StatusBookmarkNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark not found response has a 3xx status code +func (o *StatusBookmarkNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark not found response has a 4xx status code +func (o *StatusBookmarkNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark not found response has a 5xx status code +func (o *StatusBookmarkNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark not found response a status code equal to that given +func (o *StatusBookmarkNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status bookmark not found response +func (o *StatusBookmarkNotFound) Code() int { + return 404 +} + +func (o *StatusBookmarkNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotFound", 404) +} + +func (o *StatusBookmarkNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotFound", 404) +} + +func (o *StatusBookmarkNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkNotAcceptable creates a StatusBookmarkNotAcceptable with default headers values +func NewStatusBookmarkNotAcceptable() *StatusBookmarkNotAcceptable { + return &StatusBookmarkNotAcceptable{} +} + +/* +StatusBookmarkNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusBookmarkNotAcceptable struct { +} + +// IsSuccess returns true when this status bookmark not acceptable response has a 2xx status code +func (o *StatusBookmarkNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark not acceptable response has a 3xx status code +func (o *StatusBookmarkNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark not acceptable response has a 4xx status code +func (o *StatusBookmarkNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status bookmark not acceptable response has a 5xx status code +func (o *StatusBookmarkNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status bookmark not acceptable response a status code equal to that given +func (o *StatusBookmarkNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status bookmark not acceptable response +func (o *StatusBookmarkNotAcceptable) Code() int { + return 406 +} + +func (o *StatusBookmarkNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotAcceptable", 406) +} + +func (o *StatusBookmarkNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkNotAcceptable", 406) +} + +func (o *StatusBookmarkNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBookmarkInternalServerError creates a StatusBookmarkInternalServerError with default headers values +func NewStatusBookmarkInternalServerError() *StatusBookmarkInternalServerError { + return &StatusBookmarkInternalServerError{} +} + +/* +StatusBookmarkInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusBookmarkInternalServerError struct { +} + +// IsSuccess returns true when this status bookmark internal server error response has a 2xx status code +func (o *StatusBookmarkInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status bookmark internal server error response has a 3xx status code +func (o *StatusBookmarkInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status bookmark internal server error response has a 4xx status code +func (o *StatusBookmarkInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status bookmark internal server error response has a 5xx status code +func (o *StatusBookmarkInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status bookmark internal server error response a status code equal to that given +func (o *StatusBookmarkInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status bookmark internal server error response +func (o *StatusBookmarkInternalServerError) Code() int { + return 500 +} + +func (o *StatusBookmarkInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkInternalServerError", 500) +} + +func (o *StatusBookmarkInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/bookmark][%d] statusBookmarkInternalServerError", 500) +} + +func (o *StatusBookmarkInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_boosted_by_parameters.go b/client/statuses/status_boosted_by_parameters.go new file mode 100644 index 0000000..672711e --- /dev/null +++ b/client/statuses/status_boosted_by_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusBoostedByParams creates a new StatusBoostedByParams 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 NewStatusBoostedByParams() *StatusBoostedByParams { + return &StatusBoostedByParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusBoostedByParamsWithTimeout creates a new StatusBoostedByParams object +// with the ability to set a timeout on a request. +func NewStatusBoostedByParamsWithTimeout(timeout time.Duration) *StatusBoostedByParams { + return &StatusBoostedByParams{ + timeout: timeout, + } +} + +// NewStatusBoostedByParamsWithContext creates a new StatusBoostedByParams object +// with the ability to set a context for a request. +func NewStatusBoostedByParamsWithContext(ctx context.Context) *StatusBoostedByParams { + return &StatusBoostedByParams{ + Context: ctx, + } +} + +// NewStatusBoostedByParamsWithHTTPClient creates a new StatusBoostedByParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusBoostedByParamsWithHTTPClient(client *http.Client) *StatusBoostedByParams { + return &StatusBoostedByParams{ + HTTPClient: client, + } +} + +/* +StatusBoostedByParams contains all the parameters to send to the API endpoint + + for the status boosted by operation. + + Typically these are written to a http.Request. +*/ +type StatusBoostedByParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status boosted by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBoostedByParams) WithDefaults() *StatusBoostedByParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status boosted by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusBoostedByParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status boosted by params +func (o *StatusBoostedByParams) WithTimeout(timeout time.Duration) *StatusBoostedByParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status boosted by params +func (o *StatusBoostedByParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status boosted by params +func (o *StatusBoostedByParams) WithContext(ctx context.Context) *StatusBoostedByParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status boosted by params +func (o *StatusBoostedByParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status boosted by params +func (o *StatusBoostedByParams) WithHTTPClient(client *http.Client) *StatusBoostedByParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status boosted by params +func (o *StatusBoostedByParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status boosted by params +func (o *StatusBoostedByParams) WithID(id string) *StatusBoostedByParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status boosted by params +func (o *StatusBoostedByParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusBoostedByParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_boosted_by_responses.go b/client/statuses/status_boosted_by_responses.go new file mode 100644 index 0000000..2248741 --- /dev/null +++ b/client/statuses/status_boosted_by_responses.go @@ -0,0 +1,352 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusBoostedByReader is a Reader for the StatusBoostedBy structure. +type StatusBoostedByReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusBoostedByReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusBoostedByOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusBoostedByBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusBoostedByUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusBoostedByForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusBoostedByNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/reblogged_by] statusBoostedBy", response, response.Code()) + } +} + +// NewStatusBoostedByOK creates a StatusBoostedByOK with default headers values +func NewStatusBoostedByOK() *StatusBoostedByOK { + return &StatusBoostedByOK{} +} + +/* +StatusBoostedByOK describes a response with status code 200, with default header values. + +StatusBoostedByOK status boosted by o k +*/ +type StatusBoostedByOK struct { + Payload []*models.Account +} + +// IsSuccess returns true when this status boosted by o k response has a 2xx status code +func (o *StatusBoostedByOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status boosted by o k response has a 3xx status code +func (o *StatusBoostedByOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by o k response has a 4xx status code +func (o *StatusBoostedByOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status boosted by o k response has a 5xx status code +func (o *StatusBoostedByOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by o k response a status code equal to that given +func (o *StatusBoostedByOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status boosted by o k response +func (o *StatusBoostedByOK) Code() int { + return 200 +} + +func (o *StatusBoostedByOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByOK %s", 200, payload) +} + +func (o *StatusBoostedByOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByOK %s", 200, payload) +} + +func (o *StatusBoostedByOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *StatusBoostedByOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusBoostedByBadRequest creates a StatusBoostedByBadRequest with default headers values +func NewStatusBoostedByBadRequest() *StatusBoostedByBadRequest { + return &StatusBoostedByBadRequest{} +} + +/* +StatusBoostedByBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusBoostedByBadRequest struct { +} + +// IsSuccess returns true when this status boosted by bad request response has a 2xx status code +func (o *StatusBoostedByBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by bad request response has a 3xx status code +func (o *StatusBoostedByBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by bad request response has a 4xx status code +func (o *StatusBoostedByBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by bad request response has a 5xx status code +func (o *StatusBoostedByBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by bad request response a status code equal to that given +func (o *StatusBoostedByBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status boosted by bad request response +func (o *StatusBoostedByBadRequest) Code() int { + return 400 +} + +func (o *StatusBoostedByBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByBadRequest", 400) +} + +func (o *StatusBoostedByBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByBadRequest", 400) +} + +func (o *StatusBoostedByBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBoostedByUnauthorized creates a StatusBoostedByUnauthorized with default headers values +func NewStatusBoostedByUnauthorized() *StatusBoostedByUnauthorized { + return &StatusBoostedByUnauthorized{} +} + +/* +StatusBoostedByUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusBoostedByUnauthorized struct { +} + +// IsSuccess returns true when this status boosted by unauthorized response has a 2xx status code +func (o *StatusBoostedByUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by unauthorized response has a 3xx status code +func (o *StatusBoostedByUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by unauthorized response has a 4xx status code +func (o *StatusBoostedByUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by unauthorized response has a 5xx status code +func (o *StatusBoostedByUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by unauthorized response a status code equal to that given +func (o *StatusBoostedByUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status boosted by unauthorized response +func (o *StatusBoostedByUnauthorized) Code() int { + return 401 +} + +func (o *StatusBoostedByUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByUnauthorized", 401) +} + +func (o *StatusBoostedByUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByUnauthorized", 401) +} + +func (o *StatusBoostedByUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBoostedByForbidden creates a StatusBoostedByForbidden with default headers values +func NewStatusBoostedByForbidden() *StatusBoostedByForbidden { + return &StatusBoostedByForbidden{} +} + +/* +StatusBoostedByForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusBoostedByForbidden struct { +} + +// IsSuccess returns true when this status boosted by forbidden response has a 2xx status code +func (o *StatusBoostedByForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by forbidden response has a 3xx status code +func (o *StatusBoostedByForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by forbidden response has a 4xx status code +func (o *StatusBoostedByForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by forbidden response has a 5xx status code +func (o *StatusBoostedByForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by forbidden response a status code equal to that given +func (o *StatusBoostedByForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status boosted by forbidden response +func (o *StatusBoostedByForbidden) Code() int { + return 403 +} + +func (o *StatusBoostedByForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByForbidden", 403) +} + +func (o *StatusBoostedByForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByForbidden", 403) +} + +func (o *StatusBoostedByForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusBoostedByNotFound creates a StatusBoostedByNotFound with default headers values +func NewStatusBoostedByNotFound() *StatusBoostedByNotFound { + return &StatusBoostedByNotFound{} +} + +/* +StatusBoostedByNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusBoostedByNotFound struct { +} + +// IsSuccess returns true when this status boosted by not found response has a 2xx status code +func (o *StatusBoostedByNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status boosted by not found response has a 3xx status code +func (o *StatusBoostedByNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status boosted by not found response has a 4xx status code +func (o *StatusBoostedByNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status boosted by not found response has a 5xx status code +func (o *StatusBoostedByNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status boosted by not found response a status code equal to that given +func (o *StatusBoostedByNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status boosted by not found response +func (o *StatusBoostedByNotFound) Code() int { + return 404 +} + +func (o *StatusBoostedByNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByNotFound", 404) +} + +func (o *StatusBoostedByNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/reblogged_by][%d] statusBoostedByNotFound", 404) +} + +func (o *StatusBoostedByNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_create_parameters.go b/client/statuses/status_create_parameters.go new file mode 100644 index 0000000..daa60df --- /dev/null +++ b/client/statuses/status_create_parameters.go @@ -0,0 +1,635 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusCreateParams creates a new StatusCreateParams 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 NewStatusCreateParams() *StatusCreateParams { + return &StatusCreateParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusCreateParamsWithTimeout creates a new StatusCreateParams object +// with the ability to set a timeout on a request. +func NewStatusCreateParamsWithTimeout(timeout time.Duration) *StatusCreateParams { + return &StatusCreateParams{ + timeout: timeout, + } +} + +// NewStatusCreateParamsWithContext creates a new StatusCreateParams object +// with the ability to set a context for a request. +func NewStatusCreateParamsWithContext(ctx context.Context) *StatusCreateParams { + return &StatusCreateParams{ + Context: ctx, + } +} + +// NewStatusCreateParamsWithHTTPClient creates a new StatusCreateParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusCreateParamsWithHTTPClient(client *http.Client) *StatusCreateParams { + return &StatusCreateParams{ + HTTPClient: client, + } +} + +/* +StatusCreateParams contains all the parameters to send to the API endpoint + + for the status create operation. + + Typically these are written to a http.Request. +*/ +type StatusCreateParams struct { + + /* ContentType. + + Content type to use when parsing this status. + */ + ContentType *string + + /* Federated. + + This status will be federated beyond the local timeline(s). + */ + Federated *bool + + /* InReplyToID. + + ID of the status being replied to, if status is a reply. + */ + InReplyToID *string + + /* Language. + + ISO 639 language code for this status. + */ + Language *string + + /* MediaIds. + + Array of Attachment ids to be attached as media. + If provided, status becomes optional, and poll cannot be used. + + If the status is being submitted as a form, the key is 'media_ids[]', + but if it's json or xml, the key is 'media_ids'. + */ + MediaIDs []string + + /* PollExpiresIn. + + Duration the poll should be open, in seconds. + If provided, media_ids cannot be used, and poll[options] must be provided. + + Format: int64 + */ + PollExpiresIn *int64 + + /* PollHideTotals. + + Hide vote counts until the poll ends. + + Default: true + */ + PollHideTotals *bool + + /* PollMultiple. + + Allow multiple choices on this poll. + */ + PollMultiple *bool + + /* PollOptions. + + Array of possible poll answers. + If provided, media_ids cannot be used, and poll[expires_in] must be provided. + */ + PollOptions []string + + /* ScheduledAt. + + ISO 8601 Datetime at which to schedule a status. + Providing this parameter will cause ScheduledStatus to be returned instead of Status. + Must be at least 5 minutes in the future. + + This feature isn't implemented yet. + */ + ScheduledAt *string + + /* Sensitive. + + Status and attached media should be marked as sensitive. + */ + Sensitive *bool + + /* SpoilerText. + + Text to be shown as a warning or subject before the actual content. + Statuses are generally collapsed behind this field. + */ + SpoilerText *string + + /* Status. + + Text content of the status. + If media_ids is provided, this becomes optional. + Attaching a poll is optional while status is provided. + */ + Status *string + + /* Visibility. + + Visibility of the posted status. + */ + Visibility *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusCreateParams) WithDefaults() *StatusCreateParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status create params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusCreateParams) SetDefaults() { + var ( + pollHideTotalsDefault = bool(true) + + pollMultipleDefault = bool(false) + ) + + val := StatusCreateParams{ + PollHideTotals: &pollHideTotalsDefault, + PollMultiple: &pollMultipleDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the status create params +func (o *StatusCreateParams) WithTimeout(timeout time.Duration) *StatusCreateParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status create params +func (o *StatusCreateParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status create params +func (o *StatusCreateParams) WithContext(ctx context.Context) *StatusCreateParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status create params +func (o *StatusCreateParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status create params +func (o *StatusCreateParams) WithHTTPClient(client *http.Client) *StatusCreateParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status create params +func (o *StatusCreateParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithContentType adds the contentType to the status create params +func (o *StatusCreateParams) WithContentType(contentType *string) *StatusCreateParams { + o.SetContentType(contentType) + return o +} + +// SetContentType adds the contentType to the status create params +func (o *StatusCreateParams) SetContentType(contentType *string) { + o.ContentType = contentType +} + +// WithFederated adds the federated to the status create params +func (o *StatusCreateParams) WithFederated(federated *bool) *StatusCreateParams { + o.SetFederated(federated) + return o +} + +// SetFederated adds the federated to the status create params +func (o *StatusCreateParams) SetFederated(federated *bool) { + o.Federated = federated +} + +// WithInReplyToID adds the inReplyToID to the status create params +func (o *StatusCreateParams) WithInReplyToID(inReplyToID *string) *StatusCreateParams { + o.SetInReplyToID(inReplyToID) + return o +} + +// SetInReplyToID adds the inReplyToId to the status create params +func (o *StatusCreateParams) SetInReplyToID(inReplyToID *string) { + o.InReplyToID = inReplyToID +} + +// WithLanguage adds the language to the status create params +func (o *StatusCreateParams) WithLanguage(language *string) *StatusCreateParams { + o.SetLanguage(language) + return o +} + +// SetLanguage adds the language to the status create params +func (o *StatusCreateParams) SetLanguage(language *string) { + o.Language = language +} + +// WithMediaIDs adds the mediaIds to the status create params +func (o *StatusCreateParams) WithMediaIDs(mediaIds []string) *StatusCreateParams { + o.SetMediaIDs(mediaIds) + return o +} + +// SetMediaIDs adds the mediaIds to the status create params +func (o *StatusCreateParams) SetMediaIDs(mediaIds []string) { + o.MediaIDs = mediaIds +} + +// WithPollExpiresIn adds the pollExpiresIn to the status create params +func (o *StatusCreateParams) WithPollExpiresIn(pollExpiresIn *int64) *StatusCreateParams { + o.SetPollExpiresIn(pollExpiresIn) + return o +} + +// SetPollExpiresIn adds the pollExpiresIn to the status create params +func (o *StatusCreateParams) SetPollExpiresIn(pollExpiresIn *int64) { + o.PollExpiresIn = pollExpiresIn +} + +// WithPollHideTotals adds the pollHideTotals to the status create params +func (o *StatusCreateParams) WithPollHideTotals(pollHideTotals *bool) *StatusCreateParams { + o.SetPollHideTotals(pollHideTotals) + return o +} + +// SetPollHideTotals adds the pollHideTotals to the status create params +func (o *StatusCreateParams) SetPollHideTotals(pollHideTotals *bool) { + o.PollHideTotals = pollHideTotals +} + +// WithPollMultiple adds the pollMultiple to the status create params +func (o *StatusCreateParams) WithPollMultiple(pollMultiple *bool) *StatusCreateParams { + o.SetPollMultiple(pollMultiple) + return o +} + +// SetPollMultiple adds the pollMultiple to the status create params +func (o *StatusCreateParams) SetPollMultiple(pollMultiple *bool) { + o.PollMultiple = pollMultiple +} + +// WithPollOptions adds the pollOptions to the status create params +func (o *StatusCreateParams) WithPollOptions(pollOptions []string) *StatusCreateParams { + o.SetPollOptions(pollOptions) + return o +} + +// SetPollOptions adds the pollOptions to the status create params +func (o *StatusCreateParams) SetPollOptions(pollOptions []string) { + o.PollOptions = pollOptions +} + +// WithScheduledAt adds the scheduledAt to the status create params +func (o *StatusCreateParams) WithScheduledAt(scheduledAt *string) *StatusCreateParams { + o.SetScheduledAt(scheduledAt) + return o +} + +// SetScheduledAt adds the scheduledAt to the status create params +func (o *StatusCreateParams) SetScheduledAt(scheduledAt *string) { + o.ScheduledAt = scheduledAt +} + +// WithSensitive adds the sensitive to the status create params +func (o *StatusCreateParams) WithSensitive(sensitive *bool) *StatusCreateParams { + o.SetSensitive(sensitive) + return o +} + +// SetSensitive adds the sensitive to the status create params +func (o *StatusCreateParams) SetSensitive(sensitive *bool) { + o.Sensitive = sensitive +} + +// WithSpoilerText adds the spoilerText to the status create params +func (o *StatusCreateParams) WithSpoilerText(spoilerText *string) *StatusCreateParams { + o.SetSpoilerText(spoilerText) + return o +} + +// SetSpoilerText adds the spoilerText to the status create params +func (o *StatusCreateParams) SetSpoilerText(spoilerText *string) { + o.SpoilerText = spoilerText +} + +// WithStatus adds the status to the status create params +func (o *StatusCreateParams) WithStatus(status *string) *StatusCreateParams { + o.SetStatus(status) + return o +} + +// SetStatus adds the status to the status create params +func (o *StatusCreateParams) SetStatus(status *string) { + o.Status = status +} + +// WithVisibility adds the visibility to the status create params +func (o *StatusCreateParams) WithVisibility(visibility *string) *StatusCreateParams { + o.SetVisibility(visibility) + return o +} + +// SetVisibility adds the visibility to the status create params +func (o *StatusCreateParams) SetVisibility(visibility *string) { + o.Visibility = visibility +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusCreateParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if o.ContentType != nil { + + // form param content_type + var frContentType string + if o.ContentType != nil { + frContentType = *o.ContentType + } + fContentType := frContentType + if fContentType != "" { + if err := r.SetFormParam("content_type", fContentType); err != nil { + return err + } + } + } + + if o.Federated != nil { + + // form param federated + var frFederated bool + if o.Federated != nil { + frFederated = *o.Federated + } + fFederated := swag.FormatBool(frFederated) + if fFederated != "" { + if err := r.SetFormParam("federated", fFederated); err != nil { + return err + } + } + } + + if o.InReplyToID != nil { + + // form param in_reply_to_id + var frInReplyToID string + if o.InReplyToID != nil { + frInReplyToID = *o.InReplyToID + } + fInReplyToID := frInReplyToID + if fInReplyToID != "" { + if err := r.SetFormParam("in_reply_to_id", fInReplyToID); err != nil { + return err + } + } + } + + if o.Language != nil { + + // form param language + var frLanguage string + if o.Language != nil { + frLanguage = *o.Language + } + fLanguage := frLanguage + if fLanguage != "" { + if err := r.SetFormParam("language", fLanguage); err != nil { + return err + } + } + } + + if o.MediaIDs != nil { + + // binding items for media_ids + joinedMediaIds := o.bindParamMediaIds(reg) + + // form array param media_ids + if err := r.SetFormParam("media_ids", joinedMediaIds...); err != nil { + return err + } + } + + if o.PollExpiresIn != nil { + + // form param poll[expires_in] + var frPollExpiresIn int64 + if o.PollExpiresIn != nil { + frPollExpiresIn = *o.PollExpiresIn + } + fPollExpiresIn := swag.FormatInt64(frPollExpiresIn) + if fPollExpiresIn != "" { + if err := r.SetFormParam("poll[expires_in]", fPollExpiresIn); err != nil { + return err + } + } + } + + if o.PollHideTotals != nil { + + // form param poll[hide_totals] + var frPollHideTotals bool + if o.PollHideTotals != nil { + frPollHideTotals = *o.PollHideTotals + } + fPollHideTotals := swag.FormatBool(frPollHideTotals) + if fPollHideTotals != "" { + if err := r.SetFormParam("poll[hide_totals]", fPollHideTotals); err != nil { + return err + } + } + } + + if o.PollMultiple != nil { + + // form param poll[multiple] + var frPollMultiple bool + if o.PollMultiple != nil { + frPollMultiple = *o.PollMultiple + } + fPollMultiple := swag.FormatBool(frPollMultiple) + if fPollMultiple != "" { + if err := r.SetFormParam("poll[multiple]", fPollMultiple); err != nil { + return err + } + } + } + + if o.PollOptions != nil { + + // binding items for poll[options][] + joinedPollOptions := o.bindParamPollOptions(reg) + + // form array param poll[options][] + if err := r.SetFormParam("poll[options][]", joinedPollOptions...); err != nil { + return err + } + } + + if o.ScheduledAt != nil { + + // form param scheduled_at + var frScheduledAt string + if o.ScheduledAt != nil { + frScheduledAt = *o.ScheduledAt + } + fScheduledAt := frScheduledAt + if fScheduledAt != "" { + if err := r.SetFormParam("scheduled_at", fScheduledAt); err != nil { + return err + } + } + } + + if o.Sensitive != nil { + + // form param sensitive + var frSensitive bool + if o.Sensitive != nil { + frSensitive = *o.Sensitive + } + fSensitive := swag.FormatBool(frSensitive) + if fSensitive != "" { + if err := r.SetFormParam("sensitive", fSensitive); err != nil { + return err + } + } + } + + if o.SpoilerText != nil { + + // form param spoiler_text + var frSpoilerText string + if o.SpoilerText != nil { + frSpoilerText = *o.SpoilerText + } + fSpoilerText := frSpoilerText + if fSpoilerText != "" { + if err := r.SetFormParam("spoiler_text", fSpoilerText); err != nil { + return err + } + } + } + + if o.Status != nil { + + // form param status + var frStatus string + if o.Status != nil { + frStatus = *o.Status + } + fStatus := frStatus + if fStatus != "" { + if err := r.SetFormParam("status", fStatus); err != nil { + return err + } + } + } + + if o.Visibility != nil { + + // form param visibility + var frVisibility string + if o.Visibility != nil { + frVisibility = *o.Visibility + } + fVisibility := frVisibility + if fVisibility != "" { + if err := r.SetFormParam("visibility", fVisibility); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +// bindParamStatusCreate binds the parameter media_ids +func (o *StatusCreateParams) bindParamMediaIds(formats strfmt.Registry) []string { + mediaIdsIR := o.MediaIDs + + var mediaIdsIC []string + for _, mediaIdsIIR := range mediaIdsIR { // explode []string + + mediaIdsIIV := mediaIdsIIR // string as string + mediaIdsIC = append(mediaIdsIC, mediaIdsIIV) + } + + // items.CollectionFormat: "" + mediaIdsIS := swag.JoinByFormat(mediaIdsIC, "") + + return mediaIdsIS +} + +// bindParamStatusCreate binds the parameter poll[options][] +func (o *StatusCreateParams) bindParamPollOptions(formats strfmt.Registry) []string { + pollOptionsIR := o.PollOptions + + var pollOptionsIC []string + for _, pollOptionsIIR := range pollOptionsIR { // explode []string + + pollOptionsIIV := pollOptionsIIR // string as string + pollOptionsIC = append(pollOptionsIC, pollOptionsIIV) + } + + // items.CollectionFormat: "" + pollOptionsIS := swag.JoinByFormat(pollOptionsIC, "") + + return pollOptionsIS +} diff --git a/client/statuses/status_create_responses.go b/client/statuses/status_create_responses.go new file mode 100644 index 0000000..78d42e7 --- /dev/null +++ b/client/statuses/status_create_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusCreateReader is a Reader for the StatusCreate structure. +type StatusCreateReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusCreateReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusCreateOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusCreateBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusCreateUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusCreateForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusCreateNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusCreateNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusCreateInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses] statusCreate", response, response.Code()) + } +} + +// NewStatusCreateOK creates a StatusCreateOK with default headers values +func NewStatusCreateOK() *StatusCreateOK { + return &StatusCreateOK{} +} + +/* +StatusCreateOK describes a response with status code 200, with default header values. + +The newly created status. +*/ +type StatusCreateOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status create o k response has a 2xx status code +func (o *StatusCreateOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status create o k response has a 3xx status code +func (o *StatusCreateOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create o k response has a 4xx status code +func (o *StatusCreateOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status create o k response has a 5xx status code +func (o *StatusCreateOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status create o k response a status code equal to that given +func (o *StatusCreateOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status create o k response +func (o *StatusCreateOK) Code() int { + return 200 +} + +func (o *StatusCreateOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateOK %s", 200, payload) +} + +func (o *StatusCreateOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateOK %s", 200, payload) +} + +func (o *StatusCreateOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusCreateOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusCreateBadRequest creates a StatusCreateBadRequest with default headers values +func NewStatusCreateBadRequest() *StatusCreateBadRequest { + return &StatusCreateBadRequest{} +} + +/* +StatusCreateBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusCreateBadRequest struct { +} + +// IsSuccess returns true when this status create bad request response has a 2xx status code +func (o *StatusCreateBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create bad request response has a 3xx status code +func (o *StatusCreateBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create bad request response has a 4xx status code +func (o *StatusCreateBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create bad request response has a 5xx status code +func (o *StatusCreateBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status create bad request response a status code equal to that given +func (o *StatusCreateBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status create bad request response +func (o *StatusCreateBadRequest) Code() int { + return 400 +} + +func (o *StatusCreateBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateBadRequest", 400) +} + +func (o *StatusCreateBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateBadRequest", 400) +} + +func (o *StatusCreateBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateUnauthorized creates a StatusCreateUnauthorized with default headers values +func NewStatusCreateUnauthorized() *StatusCreateUnauthorized { + return &StatusCreateUnauthorized{} +} + +/* +StatusCreateUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusCreateUnauthorized struct { +} + +// IsSuccess returns true when this status create unauthorized response has a 2xx status code +func (o *StatusCreateUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create unauthorized response has a 3xx status code +func (o *StatusCreateUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create unauthorized response has a 4xx status code +func (o *StatusCreateUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create unauthorized response has a 5xx status code +func (o *StatusCreateUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status create unauthorized response a status code equal to that given +func (o *StatusCreateUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status create unauthorized response +func (o *StatusCreateUnauthorized) Code() int { + return 401 +} + +func (o *StatusCreateUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateUnauthorized", 401) +} + +func (o *StatusCreateUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateUnauthorized", 401) +} + +func (o *StatusCreateUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateForbidden creates a StatusCreateForbidden with default headers values +func NewStatusCreateForbidden() *StatusCreateForbidden { + return &StatusCreateForbidden{} +} + +/* +StatusCreateForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusCreateForbidden struct { +} + +// IsSuccess returns true when this status create forbidden response has a 2xx status code +func (o *StatusCreateForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create forbidden response has a 3xx status code +func (o *StatusCreateForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create forbidden response has a 4xx status code +func (o *StatusCreateForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create forbidden response has a 5xx status code +func (o *StatusCreateForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status create forbidden response a status code equal to that given +func (o *StatusCreateForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status create forbidden response +func (o *StatusCreateForbidden) Code() int { + return 403 +} + +func (o *StatusCreateForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateForbidden", 403) +} + +func (o *StatusCreateForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateForbidden", 403) +} + +func (o *StatusCreateForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateNotFound creates a StatusCreateNotFound with default headers values +func NewStatusCreateNotFound() *StatusCreateNotFound { + return &StatusCreateNotFound{} +} + +/* +StatusCreateNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusCreateNotFound struct { +} + +// IsSuccess returns true when this status create not found response has a 2xx status code +func (o *StatusCreateNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create not found response has a 3xx status code +func (o *StatusCreateNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create not found response has a 4xx status code +func (o *StatusCreateNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create not found response has a 5xx status code +func (o *StatusCreateNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status create not found response a status code equal to that given +func (o *StatusCreateNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status create not found response +func (o *StatusCreateNotFound) Code() int { + return 404 +} + +func (o *StatusCreateNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotFound", 404) +} + +func (o *StatusCreateNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotFound", 404) +} + +func (o *StatusCreateNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateNotAcceptable creates a StatusCreateNotAcceptable with default headers values +func NewStatusCreateNotAcceptable() *StatusCreateNotAcceptable { + return &StatusCreateNotAcceptable{} +} + +/* +StatusCreateNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusCreateNotAcceptable struct { +} + +// IsSuccess returns true when this status create not acceptable response has a 2xx status code +func (o *StatusCreateNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create not acceptable response has a 3xx status code +func (o *StatusCreateNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create not acceptable response has a 4xx status code +func (o *StatusCreateNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status create not acceptable response has a 5xx status code +func (o *StatusCreateNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status create not acceptable response a status code equal to that given +func (o *StatusCreateNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status create not acceptable response +func (o *StatusCreateNotAcceptable) Code() int { + return 406 +} + +func (o *StatusCreateNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotAcceptable", 406) +} + +func (o *StatusCreateNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateNotAcceptable", 406) +} + +func (o *StatusCreateNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusCreateInternalServerError creates a StatusCreateInternalServerError with default headers values +func NewStatusCreateInternalServerError() *StatusCreateInternalServerError { + return &StatusCreateInternalServerError{} +} + +/* +StatusCreateInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusCreateInternalServerError struct { +} + +// IsSuccess returns true when this status create internal server error response has a 2xx status code +func (o *StatusCreateInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status create internal server error response has a 3xx status code +func (o *StatusCreateInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status create internal server error response has a 4xx status code +func (o *StatusCreateInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status create internal server error response has a 5xx status code +func (o *StatusCreateInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status create internal server error response a status code equal to that given +func (o *StatusCreateInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status create internal server error response +func (o *StatusCreateInternalServerError) Code() int { + return 500 +} + +func (o *StatusCreateInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateInternalServerError", 500) +} + +func (o *StatusCreateInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses][%d] statusCreateInternalServerError", 500) +} + +func (o *StatusCreateInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_delete_parameters.go b/client/statuses/status_delete_parameters.go new file mode 100644 index 0000000..e74c572 --- /dev/null +++ b/client/statuses/status_delete_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusDeleteParams creates a new StatusDeleteParams 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 NewStatusDeleteParams() *StatusDeleteParams { + return &StatusDeleteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusDeleteParamsWithTimeout creates a new StatusDeleteParams object +// with the ability to set a timeout on a request. +func NewStatusDeleteParamsWithTimeout(timeout time.Duration) *StatusDeleteParams { + return &StatusDeleteParams{ + timeout: timeout, + } +} + +// NewStatusDeleteParamsWithContext creates a new StatusDeleteParams object +// with the ability to set a context for a request. +func NewStatusDeleteParamsWithContext(ctx context.Context) *StatusDeleteParams { + return &StatusDeleteParams{ + Context: ctx, + } +} + +// NewStatusDeleteParamsWithHTTPClient creates a new StatusDeleteParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusDeleteParamsWithHTTPClient(client *http.Client) *StatusDeleteParams { + return &StatusDeleteParams{ + HTTPClient: client, + } +} + +/* +StatusDeleteParams contains all the parameters to send to the API endpoint + + for the status delete operation. + + Typically these are written to a http.Request. +*/ +type StatusDeleteParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusDeleteParams) WithDefaults() *StatusDeleteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status delete params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusDeleteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status delete params +func (o *StatusDeleteParams) WithTimeout(timeout time.Duration) *StatusDeleteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status delete params +func (o *StatusDeleteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status delete params +func (o *StatusDeleteParams) WithContext(ctx context.Context) *StatusDeleteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status delete params +func (o *StatusDeleteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status delete params +func (o *StatusDeleteParams) WithHTTPClient(client *http.Client) *StatusDeleteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status delete params +func (o *StatusDeleteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status delete params +func (o *StatusDeleteParams) WithID(id string) *StatusDeleteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status delete params +func (o *StatusDeleteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusDeleteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_delete_responses.go b/client/statuses/status_delete_responses.go new file mode 100644 index 0000000..bd4408c --- /dev/null +++ b/client/statuses/status_delete_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusDeleteReader is a Reader for the StatusDelete structure. +type StatusDeleteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusDeleteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusDeleteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusDeleteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusDeleteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusDeleteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusDeleteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusDeleteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusDeleteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[DELETE /api/v1/statuses/{id}] statusDelete", response, response.Code()) + } +} + +// NewStatusDeleteOK creates a StatusDeleteOK with default headers values +func NewStatusDeleteOK() *StatusDeleteOK { + return &StatusDeleteOK{} +} + +/* +StatusDeleteOK describes a response with status code 200, with default header values. + +The status that was just deleted. +*/ +type StatusDeleteOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status delete o k response has a 2xx status code +func (o *StatusDeleteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status delete o k response has a 3xx status code +func (o *StatusDeleteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete o k response has a 4xx status code +func (o *StatusDeleteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status delete o k response has a 5xx status code +func (o *StatusDeleteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete o k response a status code equal to that given +func (o *StatusDeleteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status delete o k response +func (o *StatusDeleteOK) Code() int { + return 200 +} + +func (o *StatusDeleteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteOK %s", 200, payload) +} + +func (o *StatusDeleteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteOK %s", 200, payload) +} + +func (o *StatusDeleteOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusDeleteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusDeleteBadRequest creates a StatusDeleteBadRequest with default headers values +func NewStatusDeleteBadRequest() *StatusDeleteBadRequest { + return &StatusDeleteBadRequest{} +} + +/* +StatusDeleteBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusDeleteBadRequest struct { +} + +// IsSuccess returns true when this status delete bad request response has a 2xx status code +func (o *StatusDeleteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete bad request response has a 3xx status code +func (o *StatusDeleteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete bad request response has a 4xx status code +func (o *StatusDeleteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete bad request response has a 5xx status code +func (o *StatusDeleteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete bad request response a status code equal to that given +func (o *StatusDeleteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status delete bad request response +func (o *StatusDeleteBadRequest) Code() int { + return 400 +} + +func (o *StatusDeleteBadRequest) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteBadRequest", 400) +} + +func (o *StatusDeleteBadRequest) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteBadRequest", 400) +} + +func (o *StatusDeleteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteUnauthorized creates a StatusDeleteUnauthorized with default headers values +func NewStatusDeleteUnauthorized() *StatusDeleteUnauthorized { + return &StatusDeleteUnauthorized{} +} + +/* +StatusDeleteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusDeleteUnauthorized struct { +} + +// IsSuccess returns true when this status delete unauthorized response has a 2xx status code +func (o *StatusDeleteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete unauthorized response has a 3xx status code +func (o *StatusDeleteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete unauthorized response has a 4xx status code +func (o *StatusDeleteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete unauthorized response has a 5xx status code +func (o *StatusDeleteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete unauthorized response a status code equal to that given +func (o *StatusDeleteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status delete unauthorized response +func (o *StatusDeleteUnauthorized) Code() int { + return 401 +} + +func (o *StatusDeleteUnauthorized) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteUnauthorized", 401) +} + +func (o *StatusDeleteUnauthorized) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteUnauthorized", 401) +} + +func (o *StatusDeleteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteForbidden creates a StatusDeleteForbidden with default headers values +func NewStatusDeleteForbidden() *StatusDeleteForbidden { + return &StatusDeleteForbidden{} +} + +/* +StatusDeleteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusDeleteForbidden struct { +} + +// IsSuccess returns true when this status delete forbidden response has a 2xx status code +func (o *StatusDeleteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete forbidden response has a 3xx status code +func (o *StatusDeleteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete forbidden response has a 4xx status code +func (o *StatusDeleteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete forbidden response has a 5xx status code +func (o *StatusDeleteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete forbidden response a status code equal to that given +func (o *StatusDeleteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status delete forbidden response +func (o *StatusDeleteForbidden) Code() int { + return 403 +} + +func (o *StatusDeleteForbidden) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteForbidden", 403) +} + +func (o *StatusDeleteForbidden) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteForbidden", 403) +} + +func (o *StatusDeleteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteNotFound creates a StatusDeleteNotFound with default headers values +func NewStatusDeleteNotFound() *StatusDeleteNotFound { + return &StatusDeleteNotFound{} +} + +/* +StatusDeleteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusDeleteNotFound struct { +} + +// IsSuccess returns true when this status delete not found response has a 2xx status code +func (o *StatusDeleteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete not found response has a 3xx status code +func (o *StatusDeleteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete not found response has a 4xx status code +func (o *StatusDeleteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete not found response has a 5xx status code +func (o *StatusDeleteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete not found response a status code equal to that given +func (o *StatusDeleteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status delete not found response +func (o *StatusDeleteNotFound) Code() int { + return 404 +} + +func (o *StatusDeleteNotFound) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotFound", 404) +} + +func (o *StatusDeleteNotFound) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotFound", 404) +} + +func (o *StatusDeleteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteNotAcceptable creates a StatusDeleteNotAcceptable with default headers values +func NewStatusDeleteNotAcceptable() *StatusDeleteNotAcceptable { + return &StatusDeleteNotAcceptable{} +} + +/* +StatusDeleteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusDeleteNotAcceptable struct { +} + +// IsSuccess returns true when this status delete not acceptable response has a 2xx status code +func (o *StatusDeleteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete not acceptable response has a 3xx status code +func (o *StatusDeleteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete not acceptable response has a 4xx status code +func (o *StatusDeleteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status delete not acceptable response has a 5xx status code +func (o *StatusDeleteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status delete not acceptable response a status code equal to that given +func (o *StatusDeleteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status delete not acceptable response +func (o *StatusDeleteNotAcceptable) Code() int { + return 406 +} + +func (o *StatusDeleteNotAcceptable) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotAcceptable", 406) +} + +func (o *StatusDeleteNotAcceptable) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteNotAcceptable", 406) +} + +func (o *StatusDeleteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusDeleteInternalServerError creates a StatusDeleteInternalServerError with default headers values +func NewStatusDeleteInternalServerError() *StatusDeleteInternalServerError { + return &StatusDeleteInternalServerError{} +} + +/* +StatusDeleteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusDeleteInternalServerError struct { +} + +// IsSuccess returns true when this status delete internal server error response has a 2xx status code +func (o *StatusDeleteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status delete internal server error response has a 3xx status code +func (o *StatusDeleteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status delete internal server error response has a 4xx status code +func (o *StatusDeleteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status delete internal server error response has a 5xx status code +func (o *StatusDeleteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status delete internal server error response a status code equal to that given +func (o *StatusDeleteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status delete internal server error response +func (o *StatusDeleteInternalServerError) Code() int { + return 500 +} + +func (o *StatusDeleteInternalServerError) Error() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteInternalServerError", 500) +} + +func (o *StatusDeleteInternalServerError) String() string { + return fmt.Sprintf("[DELETE /api/v1/statuses/{id}][%d] statusDeleteInternalServerError", 500) +} + +func (o *StatusDeleteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_fave_parameters.go b/client/statuses/status_fave_parameters.go new file mode 100644 index 0000000..8062d36 --- /dev/null +++ b/client/statuses/status_fave_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusFaveParams creates a new StatusFaveParams 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 NewStatusFaveParams() *StatusFaveParams { + return &StatusFaveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusFaveParamsWithTimeout creates a new StatusFaveParams object +// with the ability to set a timeout on a request. +func NewStatusFaveParamsWithTimeout(timeout time.Duration) *StatusFaveParams { + return &StatusFaveParams{ + timeout: timeout, + } +} + +// NewStatusFaveParamsWithContext creates a new StatusFaveParams object +// with the ability to set a context for a request. +func NewStatusFaveParamsWithContext(ctx context.Context) *StatusFaveParams { + return &StatusFaveParams{ + Context: ctx, + } +} + +// NewStatusFaveParamsWithHTTPClient creates a new StatusFaveParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusFaveParamsWithHTTPClient(client *http.Client) *StatusFaveParams { + return &StatusFaveParams{ + HTTPClient: client, + } +} + +/* +StatusFaveParams contains all the parameters to send to the API endpoint + + for the status fave operation. + + Typically these are written to a http.Request. +*/ +type StatusFaveParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status fave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFaveParams) WithDefaults() *StatusFaveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status fave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFaveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status fave params +func (o *StatusFaveParams) WithTimeout(timeout time.Duration) *StatusFaveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status fave params +func (o *StatusFaveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status fave params +func (o *StatusFaveParams) WithContext(ctx context.Context) *StatusFaveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status fave params +func (o *StatusFaveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status fave params +func (o *StatusFaveParams) WithHTTPClient(client *http.Client) *StatusFaveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status fave params +func (o *StatusFaveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status fave params +func (o *StatusFaveParams) WithID(id string) *StatusFaveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status fave params +func (o *StatusFaveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusFaveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_fave_responses.go b/client/statuses/status_fave_responses.go new file mode 100644 index 0000000..c54847f --- /dev/null +++ b/client/statuses/status_fave_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusFaveReader is a Reader for the StatusFave structure. +type StatusFaveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusFaveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusFaveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusFaveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusFaveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusFaveForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusFaveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusFaveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusFaveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/favourite] statusFave", response, response.Code()) + } +} + +// NewStatusFaveOK creates a StatusFaveOK with default headers values +func NewStatusFaveOK() *StatusFaveOK { + return &StatusFaveOK{} +} + +/* +StatusFaveOK describes a response with status code 200, with default header values. + +The newly faved status. +*/ +type StatusFaveOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status fave o k response has a 2xx status code +func (o *StatusFaveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status fave o k response has a 3xx status code +func (o *StatusFaveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave o k response has a 4xx status code +func (o *StatusFaveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status fave o k response has a 5xx status code +func (o *StatusFaveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave o k response a status code equal to that given +func (o *StatusFaveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status fave o k response +func (o *StatusFaveOK) Code() int { + return 200 +} + +func (o *StatusFaveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveOK %s", 200, payload) +} + +func (o *StatusFaveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveOK %s", 200, payload) +} + +func (o *StatusFaveOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusFaveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusFaveBadRequest creates a StatusFaveBadRequest with default headers values +func NewStatusFaveBadRequest() *StatusFaveBadRequest { + return &StatusFaveBadRequest{} +} + +/* +StatusFaveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusFaveBadRequest struct { +} + +// IsSuccess returns true when this status fave bad request response has a 2xx status code +func (o *StatusFaveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave bad request response has a 3xx status code +func (o *StatusFaveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave bad request response has a 4xx status code +func (o *StatusFaveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave bad request response has a 5xx status code +func (o *StatusFaveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave bad request response a status code equal to that given +func (o *StatusFaveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status fave bad request response +func (o *StatusFaveBadRequest) Code() int { + return 400 +} + +func (o *StatusFaveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveBadRequest", 400) +} + +func (o *StatusFaveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveBadRequest", 400) +} + +func (o *StatusFaveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveUnauthorized creates a StatusFaveUnauthorized with default headers values +func NewStatusFaveUnauthorized() *StatusFaveUnauthorized { + return &StatusFaveUnauthorized{} +} + +/* +StatusFaveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusFaveUnauthorized struct { +} + +// IsSuccess returns true when this status fave unauthorized response has a 2xx status code +func (o *StatusFaveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave unauthorized response has a 3xx status code +func (o *StatusFaveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave unauthorized response has a 4xx status code +func (o *StatusFaveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave unauthorized response has a 5xx status code +func (o *StatusFaveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave unauthorized response a status code equal to that given +func (o *StatusFaveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status fave unauthorized response +func (o *StatusFaveUnauthorized) Code() int { + return 401 +} + +func (o *StatusFaveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveUnauthorized", 401) +} + +func (o *StatusFaveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveUnauthorized", 401) +} + +func (o *StatusFaveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveForbidden creates a StatusFaveForbidden with default headers values +func NewStatusFaveForbidden() *StatusFaveForbidden { + return &StatusFaveForbidden{} +} + +/* +StatusFaveForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusFaveForbidden struct { +} + +// IsSuccess returns true when this status fave forbidden response has a 2xx status code +func (o *StatusFaveForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave forbidden response has a 3xx status code +func (o *StatusFaveForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave forbidden response has a 4xx status code +func (o *StatusFaveForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave forbidden response has a 5xx status code +func (o *StatusFaveForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave forbidden response a status code equal to that given +func (o *StatusFaveForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status fave forbidden response +func (o *StatusFaveForbidden) Code() int { + return 403 +} + +func (o *StatusFaveForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveForbidden", 403) +} + +func (o *StatusFaveForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveForbidden", 403) +} + +func (o *StatusFaveForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveNotFound creates a StatusFaveNotFound with default headers values +func NewStatusFaveNotFound() *StatusFaveNotFound { + return &StatusFaveNotFound{} +} + +/* +StatusFaveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusFaveNotFound struct { +} + +// IsSuccess returns true when this status fave not found response has a 2xx status code +func (o *StatusFaveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave not found response has a 3xx status code +func (o *StatusFaveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave not found response has a 4xx status code +func (o *StatusFaveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave not found response has a 5xx status code +func (o *StatusFaveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave not found response a status code equal to that given +func (o *StatusFaveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status fave not found response +func (o *StatusFaveNotFound) Code() int { + return 404 +} + +func (o *StatusFaveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotFound", 404) +} + +func (o *StatusFaveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotFound", 404) +} + +func (o *StatusFaveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveNotAcceptable creates a StatusFaveNotAcceptable with default headers values +func NewStatusFaveNotAcceptable() *StatusFaveNotAcceptable { + return &StatusFaveNotAcceptable{} +} + +/* +StatusFaveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusFaveNotAcceptable struct { +} + +// IsSuccess returns true when this status fave not acceptable response has a 2xx status code +func (o *StatusFaveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave not acceptable response has a 3xx status code +func (o *StatusFaveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave not acceptable response has a 4xx status code +func (o *StatusFaveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status fave not acceptable response has a 5xx status code +func (o *StatusFaveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status fave not acceptable response a status code equal to that given +func (o *StatusFaveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status fave not acceptable response +func (o *StatusFaveNotAcceptable) Code() int { + return 406 +} + +func (o *StatusFaveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotAcceptable", 406) +} + +func (o *StatusFaveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveNotAcceptable", 406) +} + +func (o *StatusFaveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFaveInternalServerError creates a StatusFaveInternalServerError with default headers values +func NewStatusFaveInternalServerError() *StatusFaveInternalServerError { + return &StatusFaveInternalServerError{} +} + +/* +StatusFaveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusFaveInternalServerError struct { +} + +// IsSuccess returns true when this status fave internal server error response has a 2xx status code +func (o *StatusFaveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status fave internal server error response has a 3xx status code +func (o *StatusFaveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status fave internal server error response has a 4xx status code +func (o *StatusFaveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status fave internal server error response has a 5xx status code +func (o *StatusFaveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status fave internal server error response a status code equal to that given +func (o *StatusFaveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status fave internal server error response +func (o *StatusFaveInternalServerError) Code() int { + return 500 +} + +func (o *StatusFaveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveInternalServerError", 500) +} + +func (o *StatusFaveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/favourite][%d] statusFaveInternalServerError", 500) +} + +func (o *StatusFaveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_faved_by_parameters.go b/client/statuses/status_faved_by_parameters.go new file mode 100644 index 0000000..7517d8f --- /dev/null +++ b/client/statuses/status_faved_by_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusFavedByParams creates a new StatusFavedByParams 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 NewStatusFavedByParams() *StatusFavedByParams { + return &StatusFavedByParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusFavedByParamsWithTimeout creates a new StatusFavedByParams object +// with the ability to set a timeout on a request. +func NewStatusFavedByParamsWithTimeout(timeout time.Duration) *StatusFavedByParams { + return &StatusFavedByParams{ + timeout: timeout, + } +} + +// NewStatusFavedByParamsWithContext creates a new StatusFavedByParams object +// with the ability to set a context for a request. +func NewStatusFavedByParamsWithContext(ctx context.Context) *StatusFavedByParams { + return &StatusFavedByParams{ + Context: ctx, + } +} + +// NewStatusFavedByParamsWithHTTPClient creates a new StatusFavedByParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusFavedByParamsWithHTTPClient(client *http.Client) *StatusFavedByParams { + return &StatusFavedByParams{ + HTTPClient: client, + } +} + +/* +StatusFavedByParams contains all the parameters to send to the API endpoint + + for the status faved by operation. + + Typically these are written to a http.Request. +*/ +type StatusFavedByParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status faved by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFavedByParams) WithDefaults() *StatusFavedByParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status faved by params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusFavedByParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status faved by params +func (o *StatusFavedByParams) WithTimeout(timeout time.Duration) *StatusFavedByParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status faved by params +func (o *StatusFavedByParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status faved by params +func (o *StatusFavedByParams) WithContext(ctx context.Context) *StatusFavedByParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status faved by params +func (o *StatusFavedByParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status faved by params +func (o *StatusFavedByParams) WithHTTPClient(client *http.Client) *StatusFavedByParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status faved by params +func (o *StatusFavedByParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status faved by params +func (o *StatusFavedByParams) WithID(id string) *StatusFavedByParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status faved by params +func (o *StatusFavedByParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusFavedByParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_faved_by_responses.go b/client/statuses/status_faved_by_responses.go new file mode 100644 index 0000000..52dae22 --- /dev/null +++ b/client/statuses/status_faved_by_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusFavedByReader is a Reader for the StatusFavedBy structure. +type StatusFavedByReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusFavedByReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusFavedByOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusFavedByBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusFavedByUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusFavedByForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusFavedByNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusFavedByNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusFavedByInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/favourited_by] statusFavedBy", response, response.Code()) + } +} + +// NewStatusFavedByOK creates a StatusFavedByOK with default headers values +func NewStatusFavedByOK() *StatusFavedByOK { + return &StatusFavedByOK{} +} + +/* +StatusFavedByOK describes a response with status code 200, with default header values. + +StatusFavedByOK status faved by o k +*/ +type StatusFavedByOK struct { + Payload []*models.Account +} + +// IsSuccess returns true when this status faved by o k response has a 2xx status code +func (o *StatusFavedByOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status faved by o k response has a 3xx status code +func (o *StatusFavedByOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by o k response has a 4xx status code +func (o *StatusFavedByOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status faved by o k response has a 5xx status code +func (o *StatusFavedByOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by o k response a status code equal to that given +func (o *StatusFavedByOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status faved by o k response +func (o *StatusFavedByOK) Code() int { + return 200 +} + +func (o *StatusFavedByOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByOK %s", 200, payload) +} + +func (o *StatusFavedByOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByOK %s", 200, payload) +} + +func (o *StatusFavedByOK) GetPayload() []*models.Account { + return o.Payload +} + +func (o *StatusFavedByOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusFavedByBadRequest creates a StatusFavedByBadRequest with default headers values +func NewStatusFavedByBadRequest() *StatusFavedByBadRequest { + return &StatusFavedByBadRequest{} +} + +/* +StatusFavedByBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusFavedByBadRequest struct { +} + +// IsSuccess returns true when this status faved by bad request response has a 2xx status code +func (o *StatusFavedByBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by bad request response has a 3xx status code +func (o *StatusFavedByBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by bad request response has a 4xx status code +func (o *StatusFavedByBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by bad request response has a 5xx status code +func (o *StatusFavedByBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by bad request response a status code equal to that given +func (o *StatusFavedByBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status faved by bad request response +func (o *StatusFavedByBadRequest) Code() int { + return 400 +} + +func (o *StatusFavedByBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByBadRequest", 400) +} + +func (o *StatusFavedByBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByBadRequest", 400) +} + +func (o *StatusFavedByBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByUnauthorized creates a StatusFavedByUnauthorized with default headers values +func NewStatusFavedByUnauthorized() *StatusFavedByUnauthorized { + return &StatusFavedByUnauthorized{} +} + +/* +StatusFavedByUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusFavedByUnauthorized struct { +} + +// IsSuccess returns true when this status faved by unauthorized response has a 2xx status code +func (o *StatusFavedByUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by unauthorized response has a 3xx status code +func (o *StatusFavedByUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by unauthorized response has a 4xx status code +func (o *StatusFavedByUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by unauthorized response has a 5xx status code +func (o *StatusFavedByUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by unauthorized response a status code equal to that given +func (o *StatusFavedByUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status faved by unauthorized response +func (o *StatusFavedByUnauthorized) Code() int { + return 401 +} + +func (o *StatusFavedByUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByUnauthorized", 401) +} + +func (o *StatusFavedByUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByUnauthorized", 401) +} + +func (o *StatusFavedByUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByForbidden creates a StatusFavedByForbidden with default headers values +func NewStatusFavedByForbidden() *StatusFavedByForbidden { + return &StatusFavedByForbidden{} +} + +/* +StatusFavedByForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusFavedByForbidden struct { +} + +// IsSuccess returns true when this status faved by forbidden response has a 2xx status code +func (o *StatusFavedByForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by forbidden response has a 3xx status code +func (o *StatusFavedByForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by forbidden response has a 4xx status code +func (o *StatusFavedByForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by forbidden response has a 5xx status code +func (o *StatusFavedByForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by forbidden response a status code equal to that given +func (o *StatusFavedByForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status faved by forbidden response +func (o *StatusFavedByForbidden) Code() int { + return 403 +} + +func (o *StatusFavedByForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByForbidden", 403) +} + +func (o *StatusFavedByForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByForbidden", 403) +} + +func (o *StatusFavedByForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByNotFound creates a StatusFavedByNotFound with default headers values +func NewStatusFavedByNotFound() *StatusFavedByNotFound { + return &StatusFavedByNotFound{} +} + +/* +StatusFavedByNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusFavedByNotFound struct { +} + +// IsSuccess returns true when this status faved by not found response has a 2xx status code +func (o *StatusFavedByNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by not found response has a 3xx status code +func (o *StatusFavedByNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by not found response has a 4xx status code +func (o *StatusFavedByNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by not found response has a 5xx status code +func (o *StatusFavedByNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by not found response a status code equal to that given +func (o *StatusFavedByNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status faved by not found response +func (o *StatusFavedByNotFound) Code() int { + return 404 +} + +func (o *StatusFavedByNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotFound", 404) +} + +func (o *StatusFavedByNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotFound", 404) +} + +func (o *StatusFavedByNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByNotAcceptable creates a StatusFavedByNotAcceptable with default headers values +func NewStatusFavedByNotAcceptable() *StatusFavedByNotAcceptable { + return &StatusFavedByNotAcceptable{} +} + +/* +StatusFavedByNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusFavedByNotAcceptable struct { +} + +// IsSuccess returns true when this status faved by not acceptable response has a 2xx status code +func (o *StatusFavedByNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by not acceptable response has a 3xx status code +func (o *StatusFavedByNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by not acceptable response has a 4xx status code +func (o *StatusFavedByNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status faved by not acceptable response has a 5xx status code +func (o *StatusFavedByNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status faved by not acceptable response a status code equal to that given +func (o *StatusFavedByNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status faved by not acceptable response +func (o *StatusFavedByNotAcceptable) Code() int { + return 406 +} + +func (o *StatusFavedByNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotAcceptable", 406) +} + +func (o *StatusFavedByNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByNotAcceptable", 406) +} + +func (o *StatusFavedByNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusFavedByInternalServerError creates a StatusFavedByInternalServerError with default headers values +func NewStatusFavedByInternalServerError() *StatusFavedByInternalServerError { + return &StatusFavedByInternalServerError{} +} + +/* +StatusFavedByInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusFavedByInternalServerError struct { +} + +// IsSuccess returns true when this status faved by internal server error response has a 2xx status code +func (o *StatusFavedByInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status faved by internal server error response has a 3xx status code +func (o *StatusFavedByInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status faved by internal server error response has a 4xx status code +func (o *StatusFavedByInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status faved by internal server error response has a 5xx status code +func (o *StatusFavedByInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status faved by internal server error response a status code equal to that given +func (o *StatusFavedByInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status faved by internal server error response +func (o *StatusFavedByInternalServerError) Code() int { + return 500 +} + +func (o *StatusFavedByInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByInternalServerError", 500) +} + +func (o *StatusFavedByInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/favourited_by][%d] statusFavedByInternalServerError", 500) +} + +func (o *StatusFavedByInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_get_parameters.go b/client/statuses/status_get_parameters.go new file mode 100644 index 0000000..e21d586 --- /dev/null +++ b/client/statuses/status_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusGetParams creates a new StatusGetParams 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 NewStatusGetParams() *StatusGetParams { + return &StatusGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusGetParamsWithTimeout creates a new StatusGetParams object +// with the ability to set a timeout on a request. +func NewStatusGetParamsWithTimeout(timeout time.Duration) *StatusGetParams { + return &StatusGetParams{ + timeout: timeout, + } +} + +// NewStatusGetParamsWithContext creates a new StatusGetParams object +// with the ability to set a context for a request. +func NewStatusGetParamsWithContext(ctx context.Context) *StatusGetParams { + return &StatusGetParams{ + Context: ctx, + } +} + +// NewStatusGetParamsWithHTTPClient creates a new StatusGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusGetParamsWithHTTPClient(client *http.Client) *StatusGetParams { + return &StatusGetParams{ + HTTPClient: client, + } +} + +/* +StatusGetParams contains all the parameters to send to the API endpoint + + for the status get operation. + + Typically these are written to a http.Request. +*/ +type StatusGetParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusGetParams) WithDefaults() *StatusGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status get params +func (o *StatusGetParams) WithTimeout(timeout time.Duration) *StatusGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status get params +func (o *StatusGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status get params +func (o *StatusGetParams) WithContext(ctx context.Context) *StatusGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status get params +func (o *StatusGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status get params +func (o *StatusGetParams) WithHTTPClient(client *http.Client) *StatusGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status get params +func (o *StatusGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status get params +func (o *StatusGetParams) WithID(id string) *StatusGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status get params +func (o *StatusGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_get_responses.go b/client/statuses/status_get_responses.go new file mode 100644 index 0000000..6ac57b1 --- /dev/null +++ b/client/statuses/status_get_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusGetReader is a Reader for the StatusGet structure. +type StatusGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}] statusGet", response, response.Code()) + } +} + +// NewStatusGetOK creates a StatusGetOK with default headers values +func NewStatusGetOK() *StatusGetOK { + return &StatusGetOK{} +} + +/* +StatusGetOK describes a response with status code 200, with default header values. + +The requested status. +*/ +type StatusGetOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status get o k response has a 2xx status code +func (o *StatusGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status get o k response has a 3xx status code +func (o *StatusGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get o k response has a 4xx status code +func (o *StatusGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status get o k response has a 5xx status code +func (o *StatusGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status get o k response a status code equal to that given +func (o *StatusGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status get o k response +func (o *StatusGetOK) Code() int { + return 200 +} + +func (o *StatusGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetOK %s", 200, payload) +} + +func (o *StatusGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetOK %s", 200, payload) +} + +func (o *StatusGetOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusGetBadRequest creates a StatusGetBadRequest with default headers values +func NewStatusGetBadRequest() *StatusGetBadRequest { + return &StatusGetBadRequest{} +} + +/* +StatusGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusGetBadRequest struct { +} + +// IsSuccess returns true when this status get bad request response has a 2xx status code +func (o *StatusGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get bad request response has a 3xx status code +func (o *StatusGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get bad request response has a 4xx status code +func (o *StatusGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get bad request response has a 5xx status code +func (o *StatusGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status get bad request response a status code equal to that given +func (o *StatusGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status get bad request response +func (o *StatusGetBadRequest) Code() int { + return 400 +} + +func (o *StatusGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetBadRequest", 400) +} + +func (o *StatusGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetBadRequest", 400) +} + +func (o *StatusGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetUnauthorized creates a StatusGetUnauthorized with default headers values +func NewStatusGetUnauthorized() *StatusGetUnauthorized { + return &StatusGetUnauthorized{} +} + +/* +StatusGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusGetUnauthorized struct { +} + +// IsSuccess returns true when this status get unauthorized response has a 2xx status code +func (o *StatusGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get unauthorized response has a 3xx status code +func (o *StatusGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get unauthorized response has a 4xx status code +func (o *StatusGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get unauthorized response has a 5xx status code +func (o *StatusGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status get unauthorized response a status code equal to that given +func (o *StatusGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status get unauthorized response +func (o *StatusGetUnauthorized) Code() int { + return 401 +} + +func (o *StatusGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetUnauthorized", 401) +} + +func (o *StatusGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetUnauthorized", 401) +} + +func (o *StatusGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetForbidden creates a StatusGetForbidden with default headers values +func NewStatusGetForbidden() *StatusGetForbidden { + return &StatusGetForbidden{} +} + +/* +StatusGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusGetForbidden struct { +} + +// IsSuccess returns true when this status get forbidden response has a 2xx status code +func (o *StatusGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get forbidden response has a 3xx status code +func (o *StatusGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get forbidden response has a 4xx status code +func (o *StatusGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get forbidden response has a 5xx status code +func (o *StatusGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status get forbidden response a status code equal to that given +func (o *StatusGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status get forbidden response +func (o *StatusGetForbidden) Code() int { + return 403 +} + +func (o *StatusGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetForbidden", 403) +} + +func (o *StatusGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetForbidden", 403) +} + +func (o *StatusGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetNotFound creates a StatusGetNotFound with default headers values +func NewStatusGetNotFound() *StatusGetNotFound { + return &StatusGetNotFound{} +} + +/* +StatusGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusGetNotFound struct { +} + +// IsSuccess returns true when this status get not found response has a 2xx status code +func (o *StatusGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get not found response has a 3xx status code +func (o *StatusGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get not found response has a 4xx status code +func (o *StatusGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get not found response has a 5xx status code +func (o *StatusGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status get not found response a status code equal to that given +func (o *StatusGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status get not found response +func (o *StatusGetNotFound) Code() int { + return 404 +} + +func (o *StatusGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotFound", 404) +} + +func (o *StatusGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotFound", 404) +} + +func (o *StatusGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetNotAcceptable creates a StatusGetNotAcceptable with default headers values +func NewStatusGetNotAcceptable() *StatusGetNotAcceptable { + return &StatusGetNotAcceptable{} +} + +/* +StatusGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusGetNotAcceptable struct { +} + +// IsSuccess returns true when this status get not acceptable response has a 2xx status code +func (o *StatusGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get not acceptable response has a 3xx status code +func (o *StatusGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get not acceptable response has a 4xx status code +func (o *StatusGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status get not acceptable response has a 5xx status code +func (o *StatusGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status get not acceptable response a status code equal to that given +func (o *StatusGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status get not acceptable response +func (o *StatusGetNotAcceptable) Code() int { + return 406 +} + +func (o *StatusGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotAcceptable", 406) +} + +func (o *StatusGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetNotAcceptable", 406) +} + +func (o *StatusGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusGetInternalServerError creates a StatusGetInternalServerError with default headers values +func NewStatusGetInternalServerError() *StatusGetInternalServerError { + return &StatusGetInternalServerError{} +} + +/* +StatusGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusGetInternalServerError struct { +} + +// IsSuccess returns true when this status get internal server error response has a 2xx status code +func (o *StatusGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status get internal server error response has a 3xx status code +func (o *StatusGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status get internal server error response has a 4xx status code +func (o *StatusGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status get internal server error response has a 5xx status code +func (o *StatusGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status get internal server error response a status code equal to that given +func (o *StatusGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status get internal server error response +func (o *StatusGetInternalServerError) Code() int { + return 500 +} + +func (o *StatusGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetInternalServerError", 500) +} + +func (o *StatusGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}][%d] statusGetInternalServerError", 500) +} + +func (o *StatusGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_history_get_parameters.go b/client/statuses/status_history_get_parameters.go new file mode 100644 index 0000000..1b5c6e2 --- /dev/null +++ b/client/statuses/status_history_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusHistoryGetParams creates a new StatusHistoryGetParams 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 NewStatusHistoryGetParams() *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusHistoryGetParamsWithTimeout creates a new StatusHistoryGetParams object +// with the ability to set a timeout on a request. +func NewStatusHistoryGetParamsWithTimeout(timeout time.Duration) *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + timeout: timeout, + } +} + +// NewStatusHistoryGetParamsWithContext creates a new StatusHistoryGetParams object +// with the ability to set a context for a request. +func NewStatusHistoryGetParamsWithContext(ctx context.Context) *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + Context: ctx, + } +} + +// NewStatusHistoryGetParamsWithHTTPClient creates a new StatusHistoryGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusHistoryGetParamsWithHTTPClient(client *http.Client) *StatusHistoryGetParams { + return &StatusHistoryGetParams{ + HTTPClient: client, + } +} + +/* +StatusHistoryGetParams contains all the parameters to send to the API endpoint + + for the status history get operation. + + Typically these are written to a http.Request. +*/ +type StatusHistoryGetParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status history get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusHistoryGetParams) WithDefaults() *StatusHistoryGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status history get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusHistoryGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status history get params +func (o *StatusHistoryGetParams) WithTimeout(timeout time.Duration) *StatusHistoryGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status history get params +func (o *StatusHistoryGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status history get params +func (o *StatusHistoryGetParams) WithContext(ctx context.Context) *StatusHistoryGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status history get params +func (o *StatusHistoryGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status history get params +func (o *StatusHistoryGetParams) WithHTTPClient(client *http.Client) *StatusHistoryGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status history get params +func (o *StatusHistoryGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status history get params +func (o *StatusHistoryGetParams) WithID(id string) *StatusHistoryGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status history get params +func (o *StatusHistoryGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusHistoryGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_history_get_responses.go b/client/statuses/status_history_get_responses.go new file mode 100644 index 0000000..f333a73 --- /dev/null +++ b/client/statuses/status_history_get_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusHistoryGetReader is a Reader for the StatusHistoryGet structure. +type StatusHistoryGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusHistoryGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusHistoryGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusHistoryGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusHistoryGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusHistoryGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusHistoryGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusHistoryGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusHistoryGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/history] statusHistoryGet", response, response.Code()) + } +} + +// NewStatusHistoryGetOK creates a StatusHistoryGetOK with default headers values +func NewStatusHistoryGetOK() *StatusHistoryGetOK { + return &StatusHistoryGetOK{} +} + +/* +StatusHistoryGetOK describes a response with status code 200, with default header values. + +StatusHistoryGetOK status history get o k +*/ +type StatusHistoryGetOK struct { + Payload []*models.StatusEdit +} + +// IsSuccess returns true when this status history get o k response has a 2xx status code +func (o *StatusHistoryGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status history get o k response has a 3xx status code +func (o *StatusHistoryGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get o k response has a 4xx status code +func (o *StatusHistoryGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status history get o k response has a 5xx status code +func (o *StatusHistoryGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get o k response a status code equal to that given +func (o *StatusHistoryGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status history get o k response +func (o *StatusHistoryGetOK) Code() int { + return 200 +} + +func (o *StatusHistoryGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetOK %s", 200, payload) +} + +func (o *StatusHistoryGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetOK %s", 200, payload) +} + +func (o *StatusHistoryGetOK) GetPayload() []*models.StatusEdit { + return o.Payload +} + +func (o *StatusHistoryGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusHistoryGetBadRequest creates a StatusHistoryGetBadRequest with default headers values +func NewStatusHistoryGetBadRequest() *StatusHistoryGetBadRequest { + return &StatusHistoryGetBadRequest{} +} + +/* +StatusHistoryGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusHistoryGetBadRequest struct { +} + +// IsSuccess returns true when this status history get bad request response has a 2xx status code +func (o *StatusHistoryGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get bad request response has a 3xx status code +func (o *StatusHistoryGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get bad request response has a 4xx status code +func (o *StatusHistoryGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get bad request response has a 5xx status code +func (o *StatusHistoryGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get bad request response a status code equal to that given +func (o *StatusHistoryGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status history get bad request response +func (o *StatusHistoryGetBadRequest) Code() int { + return 400 +} + +func (o *StatusHistoryGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetBadRequest", 400) +} + +func (o *StatusHistoryGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetBadRequest", 400) +} + +func (o *StatusHistoryGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetUnauthorized creates a StatusHistoryGetUnauthorized with default headers values +func NewStatusHistoryGetUnauthorized() *StatusHistoryGetUnauthorized { + return &StatusHistoryGetUnauthorized{} +} + +/* +StatusHistoryGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusHistoryGetUnauthorized struct { +} + +// IsSuccess returns true when this status history get unauthorized response has a 2xx status code +func (o *StatusHistoryGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get unauthorized response has a 3xx status code +func (o *StatusHistoryGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get unauthorized response has a 4xx status code +func (o *StatusHistoryGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get unauthorized response has a 5xx status code +func (o *StatusHistoryGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get unauthorized response a status code equal to that given +func (o *StatusHistoryGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status history get unauthorized response +func (o *StatusHistoryGetUnauthorized) Code() int { + return 401 +} + +func (o *StatusHistoryGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetUnauthorized", 401) +} + +func (o *StatusHistoryGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetUnauthorized", 401) +} + +func (o *StatusHistoryGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetForbidden creates a StatusHistoryGetForbidden with default headers values +func NewStatusHistoryGetForbidden() *StatusHistoryGetForbidden { + return &StatusHistoryGetForbidden{} +} + +/* +StatusHistoryGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusHistoryGetForbidden struct { +} + +// IsSuccess returns true when this status history get forbidden response has a 2xx status code +func (o *StatusHistoryGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get forbidden response has a 3xx status code +func (o *StatusHistoryGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get forbidden response has a 4xx status code +func (o *StatusHistoryGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get forbidden response has a 5xx status code +func (o *StatusHistoryGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get forbidden response a status code equal to that given +func (o *StatusHistoryGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status history get forbidden response +func (o *StatusHistoryGetForbidden) Code() int { + return 403 +} + +func (o *StatusHistoryGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetForbidden", 403) +} + +func (o *StatusHistoryGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetForbidden", 403) +} + +func (o *StatusHistoryGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetNotFound creates a StatusHistoryGetNotFound with default headers values +func NewStatusHistoryGetNotFound() *StatusHistoryGetNotFound { + return &StatusHistoryGetNotFound{} +} + +/* +StatusHistoryGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusHistoryGetNotFound struct { +} + +// IsSuccess returns true when this status history get not found response has a 2xx status code +func (o *StatusHistoryGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get not found response has a 3xx status code +func (o *StatusHistoryGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get not found response has a 4xx status code +func (o *StatusHistoryGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get not found response has a 5xx status code +func (o *StatusHistoryGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get not found response a status code equal to that given +func (o *StatusHistoryGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status history get not found response +func (o *StatusHistoryGetNotFound) Code() int { + return 404 +} + +func (o *StatusHistoryGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotFound", 404) +} + +func (o *StatusHistoryGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotFound", 404) +} + +func (o *StatusHistoryGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetNotAcceptable creates a StatusHistoryGetNotAcceptable with default headers values +func NewStatusHistoryGetNotAcceptable() *StatusHistoryGetNotAcceptable { + return &StatusHistoryGetNotAcceptable{} +} + +/* +StatusHistoryGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusHistoryGetNotAcceptable struct { +} + +// IsSuccess returns true when this status history get not acceptable response has a 2xx status code +func (o *StatusHistoryGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get not acceptable response has a 3xx status code +func (o *StatusHistoryGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get not acceptable response has a 4xx status code +func (o *StatusHistoryGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status history get not acceptable response has a 5xx status code +func (o *StatusHistoryGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status history get not acceptable response a status code equal to that given +func (o *StatusHistoryGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status history get not acceptable response +func (o *StatusHistoryGetNotAcceptable) Code() int { + return 406 +} + +func (o *StatusHistoryGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotAcceptable", 406) +} + +func (o *StatusHistoryGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetNotAcceptable", 406) +} + +func (o *StatusHistoryGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusHistoryGetInternalServerError creates a StatusHistoryGetInternalServerError with default headers values +func NewStatusHistoryGetInternalServerError() *StatusHistoryGetInternalServerError { + return &StatusHistoryGetInternalServerError{} +} + +/* +StatusHistoryGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusHistoryGetInternalServerError struct { +} + +// IsSuccess returns true when this status history get internal server error response has a 2xx status code +func (o *StatusHistoryGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status history get internal server error response has a 3xx status code +func (o *StatusHistoryGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status history get internal server error response has a 4xx status code +func (o *StatusHistoryGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status history get internal server error response has a 5xx status code +func (o *StatusHistoryGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status history get internal server error response a status code equal to that given +func (o *StatusHistoryGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status history get internal server error response +func (o *StatusHistoryGetInternalServerError) Code() int { + return 500 +} + +func (o *StatusHistoryGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetInternalServerError", 500) +} + +func (o *StatusHistoryGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/history][%d] statusHistoryGetInternalServerError", 500) +} + +func (o *StatusHistoryGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_mute_parameters.go b/client/statuses/status_mute_parameters.go new file mode 100644 index 0000000..374f9e8 --- /dev/null +++ b/client/statuses/status_mute_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusMuteParams creates a new StatusMuteParams 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 NewStatusMuteParams() *StatusMuteParams { + return &StatusMuteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusMuteParamsWithTimeout creates a new StatusMuteParams object +// with the ability to set a timeout on a request. +func NewStatusMuteParamsWithTimeout(timeout time.Duration) *StatusMuteParams { + return &StatusMuteParams{ + timeout: timeout, + } +} + +// NewStatusMuteParamsWithContext creates a new StatusMuteParams object +// with the ability to set a context for a request. +func NewStatusMuteParamsWithContext(ctx context.Context) *StatusMuteParams { + return &StatusMuteParams{ + Context: ctx, + } +} + +// NewStatusMuteParamsWithHTTPClient creates a new StatusMuteParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusMuteParamsWithHTTPClient(client *http.Client) *StatusMuteParams { + return &StatusMuteParams{ + HTTPClient: client, + } +} + +/* +StatusMuteParams contains all the parameters to send to the API endpoint + + for the status mute operation. + + Typically these are written to a http.Request. +*/ +type StatusMuteParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status mute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusMuteParams) WithDefaults() *StatusMuteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status mute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusMuteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status mute params +func (o *StatusMuteParams) WithTimeout(timeout time.Duration) *StatusMuteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status mute params +func (o *StatusMuteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status mute params +func (o *StatusMuteParams) WithContext(ctx context.Context) *StatusMuteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status mute params +func (o *StatusMuteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status mute params +func (o *StatusMuteParams) WithHTTPClient(client *http.Client) *StatusMuteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status mute params +func (o *StatusMuteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status mute params +func (o *StatusMuteParams) WithID(id string) *StatusMuteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status mute params +func (o *StatusMuteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusMuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_mute_responses.go b/client/statuses/status_mute_responses.go new file mode 100644 index 0000000..ce52efd --- /dev/null +++ b/client/statuses/status_mute_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusMuteReader is a Reader for the StatusMute structure. +type StatusMuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusMuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusMuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusMuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusMuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusMuteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusMuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusMuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusMuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/mute] statusMute", response, response.Code()) + } +} + +// NewStatusMuteOK creates a StatusMuteOK with default headers values +func NewStatusMuteOK() *StatusMuteOK { + return &StatusMuteOK{} +} + +/* +StatusMuteOK describes a response with status code 200, with default header values. + +The now-muted status. +*/ +type StatusMuteOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status mute o k response has a 2xx status code +func (o *StatusMuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status mute o k response has a 3xx status code +func (o *StatusMuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute o k response has a 4xx status code +func (o *StatusMuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status mute o k response has a 5xx status code +func (o *StatusMuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute o k response a status code equal to that given +func (o *StatusMuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status mute o k response +func (o *StatusMuteOK) Code() int { + return 200 +} + +func (o *StatusMuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteOK %s", 200, payload) +} + +func (o *StatusMuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteOK %s", 200, payload) +} + +func (o *StatusMuteOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusMuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusMuteBadRequest creates a StatusMuteBadRequest with default headers values +func NewStatusMuteBadRequest() *StatusMuteBadRequest { + return &StatusMuteBadRequest{} +} + +/* +StatusMuteBadRequest describes a response with status code 400, with default header values. + +bad request; you're not part of the target status thread +*/ +type StatusMuteBadRequest struct { +} + +// IsSuccess returns true when this status mute bad request response has a 2xx status code +func (o *StatusMuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute bad request response has a 3xx status code +func (o *StatusMuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute bad request response has a 4xx status code +func (o *StatusMuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute bad request response has a 5xx status code +func (o *StatusMuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute bad request response a status code equal to that given +func (o *StatusMuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status mute bad request response +func (o *StatusMuteBadRequest) Code() int { + return 400 +} + +func (o *StatusMuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteBadRequest", 400) +} + +func (o *StatusMuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteBadRequest", 400) +} + +func (o *StatusMuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteUnauthorized creates a StatusMuteUnauthorized with default headers values +func NewStatusMuteUnauthorized() *StatusMuteUnauthorized { + return &StatusMuteUnauthorized{} +} + +/* +StatusMuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusMuteUnauthorized struct { +} + +// IsSuccess returns true when this status mute unauthorized response has a 2xx status code +func (o *StatusMuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute unauthorized response has a 3xx status code +func (o *StatusMuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute unauthorized response has a 4xx status code +func (o *StatusMuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute unauthorized response has a 5xx status code +func (o *StatusMuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute unauthorized response a status code equal to that given +func (o *StatusMuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status mute unauthorized response +func (o *StatusMuteUnauthorized) Code() int { + return 401 +} + +func (o *StatusMuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteUnauthorized", 401) +} + +func (o *StatusMuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteUnauthorized", 401) +} + +func (o *StatusMuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteForbidden creates a StatusMuteForbidden with default headers values +func NewStatusMuteForbidden() *StatusMuteForbidden { + return &StatusMuteForbidden{} +} + +/* +StatusMuteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusMuteForbidden struct { +} + +// IsSuccess returns true when this status mute forbidden response has a 2xx status code +func (o *StatusMuteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute forbidden response has a 3xx status code +func (o *StatusMuteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute forbidden response has a 4xx status code +func (o *StatusMuteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute forbidden response has a 5xx status code +func (o *StatusMuteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute forbidden response a status code equal to that given +func (o *StatusMuteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status mute forbidden response +func (o *StatusMuteForbidden) Code() int { + return 403 +} + +func (o *StatusMuteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteForbidden", 403) +} + +func (o *StatusMuteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteForbidden", 403) +} + +func (o *StatusMuteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteNotFound creates a StatusMuteNotFound with default headers values +func NewStatusMuteNotFound() *StatusMuteNotFound { + return &StatusMuteNotFound{} +} + +/* +StatusMuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusMuteNotFound struct { +} + +// IsSuccess returns true when this status mute not found response has a 2xx status code +func (o *StatusMuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute not found response has a 3xx status code +func (o *StatusMuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute not found response has a 4xx status code +func (o *StatusMuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute not found response has a 5xx status code +func (o *StatusMuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute not found response a status code equal to that given +func (o *StatusMuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status mute not found response +func (o *StatusMuteNotFound) Code() int { + return 404 +} + +func (o *StatusMuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotFound", 404) +} + +func (o *StatusMuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotFound", 404) +} + +func (o *StatusMuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteNotAcceptable creates a StatusMuteNotAcceptable with default headers values +func NewStatusMuteNotAcceptable() *StatusMuteNotAcceptable { + return &StatusMuteNotAcceptable{} +} + +/* +StatusMuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusMuteNotAcceptable struct { +} + +// IsSuccess returns true when this status mute not acceptable response has a 2xx status code +func (o *StatusMuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute not acceptable response has a 3xx status code +func (o *StatusMuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute not acceptable response has a 4xx status code +func (o *StatusMuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status mute not acceptable response has a 5xx status code +func (o *StatusMuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status mute not acceptable response a status code equal to that given +func (o *StatusMuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status mute not acceptable response +func (o *StatusMuteNotAcceptable) Code() int { + return 406 +} + +func (o *StatusMuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotAcceptable", 406) +} + +func (o *StatusMuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteNotAcceptable", 406) +} + +func (o *StatusMuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusMuteInternalServerError creates a StatusMuteInternalServerError with default headers values +func NewStatusMuteInternalServerError() *StatusMuteInternalServerError { + return &StatusMuteInternalServerError{} +} + +/* +StatusMuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusMuteInternalServerError struct { +} + +// IsSuccess returns true when this status mute internal server error response has a 2xx status code +func (o *StatusMuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status mute internal server error response has a 3xx status code +func (o *StatusMuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status mute internal server error response has a 4xx status code +func (o *StatusMuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status mute internal server error response has a 5xx status code +func (o *StatusMuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status mute internal server error response a status code equal to that given +func (o *StatusMuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status mute internal server error response +func (o *StatusMuteInternalServerError) Code() int { + return 500 +} + +func (o *StatusMuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteInternalServerError", 500) +} + +func (o *StatusMuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/mute][%d] statusMuteInternalServerError", 500) +} + +func (o *StatusMuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_pin_parameters.go b/client/statuses/status_pin_parameters.go new file mode 100644 index 0000000..0601477 --- /dev/null +++ b/client/statuses/status_pin_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusPinParams creates a new StatusPinParams 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 NewStatusPinParams() *StatusPinParams { + return &StatusPinParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusPinParamsWithTimeout creates a new StatusPinParams object +// with the ability to set a timeout on a request. +func NewStatusPinParamsWithTimeout(timeout time.Duration) *StatusPinParams { + return &StatusPinParams{ + timeout: timeout, + } +} + +// NewStatusPinParamsWithContext creates a new StatusPinParams object +// with the ability to set a context for a request. +func NewStatusPinParamsWithContext(ctx context.Context) *StatusPinParams { + return &StatusPinParams{ + Context: ctx, + } +} + +// NewStatusPinParamsWithHTTPClient creates a new StatusPinParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusPinParamsWithHTTPClient(client *http.Client) *StatusPinParams { + return &StatusPinParams{ + HTTPClient: client, + } +} + +/* +StatusPinParams contains all the parameters to send to the API endpoint + + for the status pin operation. + + Typically these are written to a http.Request. +*/ +type StatusPinParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status pin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusPinParams) WithDefaults() *StatusPinParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status pin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusPinParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status pin params +func (o *StatusPinParams) WithTimeout(timeout time.Duration) *StatusPinParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status pin params +func (o *StatusPinParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status pin params +func (o *StatusPinParams) WithContext(ctx context.Context) *StatusPinParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status pin params +func (o *StatusPinParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status pin params +func (o *StatusPinParams) WithHTTPClient(client *http.Client) *StatusPinParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status pin params +func (o *StatusPinParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status pin params +func (o *StatusPinParams) WithID(id string) *StatusPinParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status pin params +func (o *StatusPinParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusPinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_pin_responses.go b/client/statuses/status_pin_responses.go new file mode 100644 index 0000000..d1a4b03 --- /dev/null +++ b/client/statuses/status_pin_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusPinReader is a Reader for the StatusPin structure. +type StatusPinReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusPinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusPinOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusPinBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusPinUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusPinForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusPinNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusPinNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusPinInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/pin] statusPin", response, response.Code()) + } +} + +// NewStatusPinOK creates a StatusPinOK with default headers values +func NewStatusPinOK() *StatusPinOK { + return &StatusPinOK{} +} + +/* +StatusPinOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusPinOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status pin o k response has a 2xx status code +func (o *StatusPinOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status pin o k response has a 3xx status code +func (o *StatusPinOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin o k response has a 4xx status code +func (o *StatusPinOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status pin o k response has a 5xx status code +func (o *StatusPinOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin o k response a status code equal to that given +func (o *StatusPinOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status pin o k response +func (o *StatusPinOK) Code() int { + return 200 +} + +func (o *StatusPinOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinOK %s", 200, payload) +} + +func (o *StatusPinOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinOK %s", 200, payload) +} + +func (o *StatusPinOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusPinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusPinBadRequest creates a StatusPinBadRequest with default headers values +func NewStatusPinBadRequest() *StatusPinBadRequest { + return &StatusPinBadRequest{} +} + +/* +StatusPinBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusPinBadRequest struct { +} + +// IsSuccess returns true when this status pin bad request response has a 2xx status code +func (o *StatusPinBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin bad request response has a 3xx status code +func (o *StatusPinBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin bad request response has a 4xx status code +func (o *StatusPinBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin bad request response has a 5xx status code +func (o *StatusPinBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin bad request response a status code equal to that given +func (o *StatusPinBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status pin bad request response +func (o *StatusPinBadRequest) Code() int { + return 400 +} + +func (o *StatusPinBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinBadRequest", 400) +} + +func (o *StatusPinBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinBadRequest", 400) +} + +func (o *StatusPinBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinUnauthorized creates a StatusPinUnauthorized with default headers values +func NewStatusPinUnauthorized() *StatusPinUnauthorized { + return &StatusPinUnauthorized{} +} + +/* +StatusPinUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusPinUnauthorized struct { +} + +// IsSuccess returns true when this status pin unauthorized response has a 2xx status code +func (o *StatusPinUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin unauthorized response has a 3xx status code +func (o *StatusPinUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin unauthorized response has a 4xx status code +func (o *StatusPinUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin unauthorized response has a 5xx status code +func (o *StatusPinUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin unauthorized response a status code equal to that given +func (o *StatusPinUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status pin unauthorized response +func (o *StatusPinUnauthorized) Code() int { + return 401 +} + +func (o *StatusPinUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinUnauthorized", 401) +} + +func (o *StatusPinUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinUnauthorized", 401) +} + +func (o *StatusPinUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinForbidden creates a StatusPinForbidden with default headers values +func NewStatusPinForbidden() *StatusPinForbidden { + return &StatusPinForbidden{} +} + +/* +StatusPinForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusPinForbidden struct { +} + +// IsSuccess returns true when this status pin forbidden response has a 2xx status code +func (o *StatusPinForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin forbidden response has a 3xx status code +func (o *StatusPinForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin forbidden response has a 4xx status code +func (o *StatusPinForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin forbidden response has a 5xx status code +func (o *StatusPinForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin forbidden response a status code equal to that given +func (o *StatusPinForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status pin forbidden response +func (o *StatusPinForbidden) Code() int { + return 403 +} + +func (o *StatusPinForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinForbidden", 403) +} + +func (o *StatusPinForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinForbidden", 403) +} + +func (o *StatusPinForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinNotFound creates a StatusPinNotFound with default headers values +func NewStatusPinNotFound() *StatusPinNotFound { + return &StatusPinNotFound{} +} + +/* +StatusPinNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusPinNotFound struct { +} + +// IsSuccess returns true when this status pin not found response has a 2xx status code +func (o *StatusPinNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin not found response has a 3xx status code +func (o *StatusPinNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin not found response has a 4xx status code +func (o *StatusPinNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin not found response has a 5xx status code +func (o *StatusPinNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin not found response a status code equal to that given +func (o *StatusPinNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status pin not found response +func (o *StatusPinNotFound) Code() int { + return 404 +} + +func (o *StatusPinNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotFound", 404) +} + +func (o *StatusPinNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotFound", 404) +} + +func (o *StatusPinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinNotAcceptable creates a StatusPinNotAcceptable with default headers values +func NewStatusPinNotAcceptable() *StatusPinNotAcceptable { + return &StatusPinNotAcceptable{} +} + +/* +StatusPinNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusPinNotAcceptable struct { +} + +// IsSuccess returns true when this status pin not acceptable response has a 2xx status code +func (o *StatusPinNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin not acceptable response has a 3xx status code +func (o *StatusPinNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin not acceptable response has a 4xx status code +func (o *StatusPinNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status pin not acceptable response has a 5xx status code +func (o *StatusPinNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status pin not acceptable response a status code equal to that given +func (o *StatusPinNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status pin not acceptable response +func (o *StatusPinNotAcceptable) Code() int { + return 406 +} + +func (o *StatusPinNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotAcceptable", 406) +} + +func (o *StatusPinNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinNotAcceptable", 406) +} + +func (o *StatusPinNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusPinInternalServerError creates a StatusPinInternalServerError with default headers values +func NewStatusPinInternalServerError() *StatusPinInternalServerError { + return &StatusPinInternalServerError{} +} + +/* +StatusPinInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusPinInternalServerError struct { +} + +// IsSuccess returns true when this status pin internal server error response has a 2xx status code +func (o *StatusPinInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status pin internal server error response has a 3xx status code +func (o *StatusPinInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status pin internal server error response has a 4xx status code +func (o *StatusPinInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status pin internal server error response has a 5xx status code +func (o *StatusPinInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status pin internal server error response a status code equal to that given +func (o *StatusPinInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status pin internal server error response +func (o *StatusPinInternalServerError) Code() int { + return 500 +} + +func (o *StatusPinInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinInternalServerError", 500) +} + +func (o *StatusPinInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/pin][%d] statusPinInternalServerError", 500) +} + +func (o *StatusPinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_reblog_parameters.go b/client/statuses/status_reblog_parameters.go new file mode 100644 index 0000000..cab1693 --- /dev/null +++ b/client/statuses/status_reblog_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusReblogParams creates a new StatusReblogParams 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 NewStatusReblogParams() *StatusReblogParams { + return &StatusReblogParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusReblogParamsWithTimeout creates a new StatusReblogParams object +// with the ability to set a timeout on a request. +func NewStatusReblogParamsWithTimeout(timeout time.Duration) *StatusReblogParams { + return &StatusReblogParams{ + timeout: timeout, + } +} + +// NewStatusReblogParamsWithContext creates a new StatusReblogParams object +// with the ability to set a context for a request. +func NewStatusReblogParamsWithContext(ctx context.Context) *StatusReblogParams { + return &StatusReblogParams{ + Context: ctx, + } +} + +// NewStatusReblogParamsWithHTTPClient creates a new StatusReblogParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusReblogParamsWithHTTPClient(client *http.Client) *StatusReblogParams { + return &StatusReblogParams{ + HTTPClient: client, + } +} + +/* +StatusReblogParams contains all the parameters to send to the API endpoint + + for the status reblog operation. + + Typically these are written to a http.Request. +*/ +type StatusReblogParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status reblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusReblogParams) WithDefaults() *StatusReblogParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status reblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusReblogParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status reblog params +func (o *StatusReblogParams) WithTimeout(timeout time.Duration) *StatusReblogParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status reblog params +func (o *StatusReblogParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status reblog params +func (o *StatusReblogParams) WithContext(ctx context.Context) *StatusReblogParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status reblog params +func (o *StatusReblogParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status reblog params +func (o *StatusReblogParams) WithHTTPClient(client *http.Client) *StatusReblogParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status reblog params +func (o *StatusReblogParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status reblog params +func (o *StatusReblogParams) WithID(id string) *StatusReblogParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status reblog params +func (o *StatusReblogParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusReblogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_reblog_responses.go b/client/statuses/status_reblog_responses.go new file mode 100644 index 0000000..68104ab --- /dev/null +++ b/client/statuses/status_reblog_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusReblogReader is a Reader for the StatusReblog structure. +type StatusReblogReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusReblogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusReblogOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusReblogBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusReblogUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusReblogForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusReblogNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusReblogNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusReblogInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/reblog] statusReblog", response, response.Code()) + } +} + +// NewStatusReblogOK creates a StatusReblogOK with default headers values +func NewStatusReblogOK() *StatusReblogOK { + return &StatusReblogOK{} +} + +/* +StatusReblogOK describes a response with status code 200, with default header values. + +The boost of the status. +*/ +type StatusReblogOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status reblog o k response has a 2xx status code +func (o *StatusReblogOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status reblog o k response has a 3xx status code +func (o *StatusReblogOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog o k response has a 4xx status code +func (o *StatusReblogOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status reblog o k response has a 5xx status code +func (o *StatusReblogOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog o k response a status code equal to that given +func (o *StatusReblogOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status reblog o k response +func (o *StatusReblogOK) Code() int { + return 200 +} + +func (o *StatusReblogOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogOK %s", 200, payload) +} + +func (o *StatusReblogOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogOK %s", 200, payload) +} + +func (o *StatusReblogOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusReblogOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusReblogBadRequest creates a StatusReblogBadRequest with default headers values +func NewStatusReblogBadRequest() *StatusReblogBadRequest { + return &StatusReblogBadRequest{} +} + +/* +StatusReblogBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusReblogBadRequest struct { +} + +// IsSuccess returns true when this status reblog bad request response has a 2xx status code +func (o *StatusReblogBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog bad request response has a 3xx status code +func (o *StatusReblogBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog bad request response has a 4xx status code +func (o *StatusReblogBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog bad request response has a 5xx status code +func (o *StatusReblogBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog bad request response a status code equal to that given +func (o *StatusReblogBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status reblog bad request response +func (o *StatusReblogBadRequest) Code() int { + return 400 +} + +func (o *StatusReblogBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogBadRequest", 400) +} + +func (o *StatusReblogBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogBadRequest", 400) +} + +func (o *StatusReblogBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogUnauthorized creates a StatusReblogUnauthorized with default headers values +func NewStatusReblogUnauthorized() *StatusReblogUnauthorized { + return &StatusReblogUnauthorized{} +} + +/* +StatusReblogUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusReblogUnauthorized struct { +} + +// IsSuccess returns true when this status reblog unauthorized response has a 2xx status code +func (o *StatusReblogUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog unauthorized response has a 3xx status code +func (o *StatusReblogUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog unauthorized response has a 4xx status code +func (o *StatusReblogUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog unauthorized response has a 5xx status code +func (o *StatusReblogUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog unauthorized response a status code equal to that given +func (o *StatusReblogUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status reblog unauthorized response +func (o *StatusReblogUnauthorized) Code() int { + return 401 +} + +func (o *StatusReblogUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogUnauthorized", 401) +} + +func (o *StatusReblogUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogUnauthorized", 401) +} + +func (o *StatusReblogUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogForbidden creates a StatusReblogForbidden with default headers values +func NewStatusReblogForbidden() *StatusReblogForbidden { + return &StatusReblogForbidden{} +} + +/* +StatusReblogForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusReblogForbidden struct { +} + +// IsSuccess returns true when this status reblog forbidden response has a 2xx status code +func (o *StatusReblogForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog forbidden response has a 3xx status code +func (o *StatusReblogForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog forbidden response has a 4xx status code +func (o *StatusReblogForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog forbidden response has a 5xx status code +func (o *StatusReblogForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog forbidden response a status code equal to that given +func (o *StatusReblogForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status reblog forbidden response +func (o *StatusReblogForbidden) Code() int { + return 403 +} + +func (o *StatusReblogForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogForbidden", 403) +} + +func (o *StatusReblogForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogForbidden", 403) +} + +func (o *StatusReblogForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogNotFound creates a StatusReblogNotFound with default headers values +func NewStatusReblogNotFound() *StatusReblogNotFound { + return &StatusReblogNotFound{} +} + +/* +StatusReblogNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusReblogNotFound struct { +} + +// IsSuccess returns true when this status reblog not found response has a 2xx status code +func (o *StatusReblogNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog not found response has a 3xx status code +func (o *StatusReblogNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog not found response has a 4xx status code +func (o *StatusReblogNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog not found response has a 5xx status code +func (o *StatusReblogNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog not found response a status code equal to that given +func (o *StatusReblogNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status reblog not found response +func (o *StatusReblogNotFound) Code() int { + return 404 +} + +func (o *StatusReblogNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotFound", 404) +} + +func (o *StatusReblogNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotFound", 404) +} + +func (o *StatusReblogNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogNotAcceptable creates a StatusReblogNotAcceptable with default headers values +func NewStatusReblogNotAcceptable() *StatusReblogNotAcceptable { + return &StatusReblogNotAcceptable{} +} + +/* +StatusReblogNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusReblogNotAcceptable struct { +} + +// IsSuccess returns true when this status reblog not acceptable response has a 2xx status code +func (o *StatusReblogNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog not acceptable response has a 3xx status code +func (o *StatusReblogNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog not acceptable response has a 4xx status code +func (o *StatusReblogNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status reblog not acceptable response has a 5xx status code +func (o *StatusReblogNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status reblog not acceptable response a status code equal to that given +func (o *StatusReblogNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status reblog not acceptable response +func (o *StatusReblogNotAcceptable) Code() int { + return 406 +} + +func (o *StatusReblogNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotAcceptable", 406) +} + +func (o *StatusReblogNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogNotAcceptable", 406) +} + +func (o *StatusReblogNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusReblogInternalServerError creates a StatusReblogInternalServerError with default headers values +func NewStatusReblogInternalServerError() *StatusReblogInternalServerError { + return &StatusReblogInternalServerError{} +} + +/* +StatusReblogInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusReblogInternalServerError struct { +} + +// IsSuccess returns true when this status reblog internal server error response has a 2xx status code +func (o *StatusReblogInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status reblog internal server error response has a 3xx status code +func (o *StatusReblogInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status reblog internal server error response has a 4xx status code +func (o *StatusReblogInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status reblog internal server error response has a 5xx status code +func (o *StatusReblogInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status reblog internal server error response a status code equal to that given +func (o *StatusReblogInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status reblog internal server error response +func (o *StatusReblogInternalServerError) Code() int { + return 500 +} + +func (o *StatusReblogInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogInternalServerError", 500) +} + +func (o *StatusReblogInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/reblog][%d] statusReblogInternalServerError", 500) +} + +func (o *StatusReblogInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_source_get_parameters.go b/client/statuses/status_source_get_parameters.go new file mode 100644 index 0000000..ed65517 --- /dev/null +++ b/client/statuses/status_source_get_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusSourceGetParams creates a new StatusSourceGetParams 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 NewStatusSourceGetParams() *StatusSourceGetParams { + return &StatusSourceGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusSourceGetParamsWithTimeout creates a new StatusSourceGetParams object +// with the ability to set a timeout on a request. +func NewStatusSourceGetParamsWithTimeout(timeout time.Duration) *StatusSourceGetParams { + return &StatusSourceGetParams{ + timeout: timeout, + } +} + +// NewStatusSourceGetParamsWithContext creates a new StatusSourceGetParams object +// with the ability to set a context for a request. +func NewStatusSourceGetParamsWithContext(ctx context.Context) *StatusSourceGetParams { + return &StatusSourceGetParams{ + Context: ctx, + } +} + +// NewStatusSourceGetParamsWithHTTPClient creates a new StatusSourceGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusSourceGetParamsWithHTTPClient(client *http.Client) *StatusSourceGetParams { + return &StatusSourceGetParams{ + HTTPClient: client, + } +} + +/* +StatusSourceGetParams contains all the parameters to send to the API endpoint + + for the status source get operation. + + Typically these are written to a http.Request. +*/ +type StatusSourceGetParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status source get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusSourceGetParams) WithDefaults() *StatusSourceGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status source get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusSourceGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status source get params +func (o *StatusSourceGetParams) WithTimeout(timeout time.Duration) *StatusSourceGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status source get params +func (o *StatusSourceGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status source get params +func (o *StatusSourceGetParams) WithContext(ctx context.Context) *StatusSourceGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status source get params +func (o *StatusSourceGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status source get params +func (o *StatusSourceGetParams) WithHTTPClient(client *http.Client) *StatusSourceGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status source get params +func (o *StatusSourceGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status source get params +func (o *StatusSourceGetParams) WithID(id string) *StatusSourceGetParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status source get params +func (o *StatusSourceGetParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusSourceGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_source_get_responses.go b/client/statuses/status_source_get_responses.go new file mode 100644 index 0000000..571c35d --- /dev/null +++ b/client/statuses/status_source_get_responses.go @@ -0,0 +1,476 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusSourceGetReader is a Reader for the StatusSourceGet structure. +type StatusSourceGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusSourceGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusSourceGetOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusSourceGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusSourceGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusSourceGetForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusSourceGetNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusSourceGetNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusSourceGetInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/source] statusSourceGet", response, response.Code()) + } +} + +// NewStatusSourceGetOK creates a StatusSourceGetOK with default headers values +func NewStatusSourceGetOK() *StatusSourceGetOK { + return &StatusSourceGetOK{} +} + +/* +StatusSourceGetOK describes a response with status code 200, with default header values. + +StatusSourceGetOK status source get o k +*/ +type StatusSourceGetOK struct { + Payload []*models.StatusSource +} + +// IsSuccess returns true when this status source get o k response has a 2xx status code +func (o *StatusSourceGetOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status source get o k response has a 3xx status code +func (o *StatusSourceGetOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get o k response has a 4xx status code +func (o *StatusSourceGetOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status source get o k response has a 5xx status code +func (o *StatusSourceGetOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get o k response a status code equal to that given +func (o *StatusSourceGetOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status source get o k response +func (o *StatusSourceGetOK) Code() int { + return 200 +} + +func (o *StatusSourceGetOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetOK %s", 200, payload) +} + +func (o *StatusSourceGetOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetOK %s", 200, payload) +} + +func (o *StatusSourceGetOK) GetPayload() []*models.StatusSource { + return o.Payload +} + +func (o *StatusSourceGetOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusSourceGetBadRequest creates a StatusSourceGetBadRequest with default headers values +func NewStatusSourceGetBadRequest() *StatusSourceGetBadRequest { + return &StatusSourceGetBadRequest{} +} + +/* +StatusSourceGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusSourceGetBadRequest struct { +} + +// IsSuccess returns true when this status source get bad request response has a 2xx status code +func (o *StatusSourceGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get bad request response has a 3xx status code +func (o *StatusSourceGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get bad request response has a 4xx status code +func (o *StatusSourceGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get bad request response has a 5xx status code +func (o *StatusSourceGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get bad request response a status code equal to that given +func (o *StatusSourceGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status source get bad request response +func (o *StatusSourceGetBadRequest) Code() int { + return 400 +} + +func (o *StatusSourceGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetBadRequest", 400) +} + +func (o *StatusSourceGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetBadRequest", 400) +} + +func (o *StatusSourceGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetUnauthorized creates a StatusSourceGetUnauthorized with default headers values +func NewStatusSourceGetUnauthorized() *StatusSourceGetUnauthorized { + return &StatusSourceGetUnauthorized{} +} + +/* +StatusSourceGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusSourceGetUnauthorized struct { +} + +// IsSuccess returns true when this status source get unauthorized response has a 2xx status code +func (o *StatusSourceGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get unauthorized response has a 3xx status code +func (o *StatusSourceGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get unauthorized response has a 4xx status code +func (o *StatusSourceGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get unauthorized response has a 5xx status code +func (o *StatusSourceGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get unauthorized response a status code equal to that given +func (o *StatusSourceGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status source get unauthorized response +func (o *StatusSourceGetUnauthorized) Code() int { + return 401 +} + +func (o *StatusSourceGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetUnauthorized", 401) +} + +func (o *StatusSourceGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetUnauthorized", 401) +} + +func (o *StatusSourceGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetForbidden creates a StatusSourceGetForbidden with default headers values +func NewStatusSourceGetForbidden() *StatusSourceGetForbidden { + return &StatusSourceGetForbidden{} +} + +/* +StatusSourceGetForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusSourceGetForbidden struct { +} + +// IsSuccess returns true when this status source get forbidden response has a 2xx status code +func (o *StatusSourceGetForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get forbidden response has a 3xx status code +func (o *StatusSourceGetForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get forbidden response has a 4xx status code +func (o *StatusSourceGetForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get forbidden response has a 5xx status code +func (o *StatusSourceGetForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get forbidden response a status code equal to that given +func (o *StatusSourceGetForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status source get forbidden response +func (o *StatusSourceGetForbidden) Code() int { + return 403 +} + +func (o *StatusSourceGetForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetForbidden", 403) +} + +func (o *StatusSourceGetForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetForbidden", 403) +} + +func (o *StatusSourceGetForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetNotFound creates a StatusSourceGetNotFound with default headers values +func NewStatusSourceGetNotFound() *StatusSourceGetNotFound { + return &StatusSourceGetNotFound{} +} + +/* +StatusSourceGetNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusSourceGetNotFound struct { +} + +// IsSuccess returns true when this status source get not found response has a 2xx status code +func (o *StatusSourceGetNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get not found response has a 3xx status code +func (o *StatusSourceGetNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get not found response has a 4xx status code +func (o *StatusSourceGetNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get not found response has a 5xx status code +func (o *StatusSourceGetNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get not found response a status code equal to that given +func (o *StatusSourceGetNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status source get not found response +func (o *StatusSourceGetNotFound) Code() int { + return 404 +} + +func (o *StatusSourceGetNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotFound", 404) +} + +func (o *StatusSourceGetNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotFound", 404) +} + +func (o *StatusSourceGetNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetNotAcceptable creates a StatusSourceGetNotAcceptable with default headers values +func NewStatusSourceGetNotAcceptable() *StatusSourceGetNotAcceptable { + return &StatusSourceGetNotAcceptable{} +} + +/* +StatusSourceGetNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusSourceGetNotAcceptable struct { +} + +// IsSuccess returns true when this status source get not acceptable response has a 2xx status code +func (o *StatusSourceGetNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get not acceptable response has a 3xx status code +func (o *StatusSourceGetNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get not acceptable response has a 4xx status code +func (o *StatusSourceGetNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status source get not acceptable response has a 5xx status code +func (o *StatusSourceGetNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status source get not acceptable response a status code equal to that given +func (o *StatusSourceGetNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status source get not acceptable response +func (o *StatusSourceGetNotAcceptable) Code() int { + return 406 +} + +func (o *StatusSourceGetNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotAcceptable", 406) +} + +func (o *StatusSourceGetNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetNotAcceptable", 406) +} + +func (o *StatusSourceGetNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusSourceGetInternalServerError creates a StatusSourceGetInternalServerError with default headers values +func NewStatusSourceGetInternalServerError() *StatusSourceGetInternalServerError { + return &StatusSourceGetInternalServerError{} +} + +/* +StatusSourceGetInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusSourceGetInternalServerError struct { +} + +// IsSuccess returns true when this status source get internal server error response has a 2xx status code +func (o *StatusSourceGetInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status source get internal server error response has a 3xx status code +func (o *StatusSourceGetInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status source get internal server error response has a 4xx status code +func (o *StatusSourceGetInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status source get internal server error response has a 5xx status code +func (o *StatusSourceGetInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status source get internal server error response a status code equal to that given +func (o *StatusSourceGetInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status source get internal server error response +func (o *StatusSourceGetInternalServerError) Code() int { + return 500 +} + +func (o *StatusSourceGetInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetInternalServerError", 500) +} + +func (o *StatusSourceGetInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/source][%d] statusSourceGetInternalServerError", 500) +} + +func (o *StatusSourceGetInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_unbookmark_parameters.go b/client/statuses/status_unbookmark_parameters.go new file mode 100644 index 0000000..5c3e1d7 --- /dev/null +++ b/client/statuses/status_unbookmark_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnbookmarkParams creates a new StatusUnbookmarkParams 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 NewStatusUnbookmarkParams() *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnbookmarkParamsWithTimeout creates a new StatusUnbookmarkParams object +// with the ability to set a timeout on a request. +func NewStatusUnbookmarkParamsWithTimeout(timeout time.Duration) *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + timeout: timeout, + } +} + +// NewStatusUnbookmarkParamsWithContext creates a new StatusUnbookmarkParams object +// with the ability to set a context for a request. +func NewStatusUnbookmarkParamsWithContext(ctx context.Context) *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + Context: ctx, + } +} + +// NewStatusUnbookmarkParamsWithHTTPClient creates a new StatusUnbookmarkParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnbookmarkParamsWithHTTPClient(client *http.Client) *StatusUnbookmarkParams { + return &StatusUnbookmarkParams{ + HTTPClient: client, + } +} + +/* +StatusUnbookmarkParams contains all the parameters to send to the API endpoint + + for the status unbookmark operation. + + Typically these are written to a http.Request. +*/ +type StatusUnbookmarkParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unbookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnbookmarkParams) WithDefaults() *StatusUnbookmarkParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unbookmark params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnbookmarkParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unbookmark params +func (o *StatusUnbookmarkParams) WithTimeout(timeout time.Duration) *StatusUnbookmarkParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unbookmark params +func (o *StatusUnbookmarkParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unbookmark params +func (o *StatusUnbookmarkParams) WithContext(ctx context.Context) *StatusUnbookmarkParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unbookmark params +func (o *StatusUnbookmarkParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unbookmark params +func (o *StatusUnbookmarkParams) WithHTTPClient(client *http.Client) *StatusUnbookmarkParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unbookmark params +func (o *StatusUnbookmarkParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unbookmark params +func (o *StatusUnbookmarkParams) WithID(id string) *StatusUnbookmarkParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unbookmark params +func (o *StatusUnbookmarkParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnbookmarkParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_unbookmark_responses.go b/client/statuses/status_unbookmark_responses.go new file mode 100644 index 0000000..5c1d792 --- /dev/null +++ b/client/statuses/status_unbookmark_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnbookmarkReader is a Reader for the StatusUnbookmark structure. +type StatusUnbookmarkReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnbookmarkReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnbookmarkOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnbookmarkBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnbookmarkUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnbookmarkForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnbookmarkNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnbookmarkNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnbookmarkInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unbookmark] statusUnbookmark", response, response.Code()) + } +} + +// NewStatusUnbookmarkOK creates a StatusUnbookmarkOK with default headers values +func NewStatusUnbookmarkOK() *StatusUnbookmarkOK { + return &StatusUnbookmarkOK{} +} + +/* +StatusUnbookmarkOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusUnbookmarkOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unbookmark o k response has a 2xx status code +func (o *StatusUnbookmarkOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unbookmark o k response has a 3xx status code +func (o *StatusUnbookmarkOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark o k response has a 4xx status code +func (o *StatusUnbookmarkOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unbookmark o k response has a 5xx status code +func (o *StatusUnbookmarkOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark o k response a status code equal to that given +func (o *StatusUnbookmarkOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unbookmark o k response +func (o *StatusUnbookmarkOK) Code() int { + return 200 +} + +func (o *StatusUnbookmarkOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkOK %s", 200, payload) +} + +func (o *StatusUnbookmarkOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkOK %s", 200, payload) +} + +func (o *StatusUnbookmarkOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnbookmarkOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnbookmarkBadRequest creates a StatusUnbookmarkBadRequest with default headers values +func NewStatusUnbookmarkBadRequest() *StatusUnbookmarkBadRequest { + return &StatusUnbookmarkBadRequest{} +} + +/* +StatusUnbookmarkBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnbookmarkBadRequest struct { +} + +// IsSuccess returns true when this status unbookmark bad request response has a 2xx status code +func (o *StatusUnbookmarkBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark bad request response has a 3xx status code +func (o *StatusUnbookmarkBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark bad request response has a 4xx status code +func (o *StatusUnbookmarkBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark bad request response has a 5xx status code +func (o *StatusUnbookmarkBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark bad request response a status code equal to that given +func (o *StatusUnbookmarkBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unbookmark bad request response +func (o *StatusUnbookmarkBadRequest) Code() int { + return 400 +} + +func (o *StatusUnbookmarkBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkBadRequest", 400) +} + +func (o *StatusUnbookmarkBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkBadRequest", 400) +} + +func (o *StatusUnbookmarkBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkUnauthorized creates a StatusUnbookmarkUnauthorized with default headers values +func NewStatusUnbookmarkUnauthorized() *StatusUnbookmarkUnauthorized { + return &StatusUnbookmarkUnauthorized{} +} + +/* +StatusUnbookmarkUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnbookmarkUnauthorized struct { +} + +// IsSuccess returns true when this status unbookmark unauthorized response has a 2xx status code +func (o *StatusUnbookmarkUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark unauthorized response has a 3xx status code +func (o *StatusUnbookmarkUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark unauthorized response has a 4xx status code +func (o *StatusUnbookmarkUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark unauthorized response has a 5xx status code +func (o *StatusUnbookmarkUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark unauthorized response a status code equal to that given +func (o *StatusUnbookmarkUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unbookmark unauthorized response +func (o *StatusUnbookmarkUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnbookmarkUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkUnauthorized", 401) +} + +func (o *StatusUnbookmarkUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkUnauthorized", 401) +} + +func (o *StatusUnbookmarkUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkForbidden creates a StatusUnbookmarkForbidden with default headers values +func NewStatusUnbookmarkForbidden() *StatusUnbookmarkForbidden { + return &StatusUnbookmarkForbidden{} +} + +/* +StatusUnbookmarkForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnbookmarkForbidden struct { +} + +// IsSuccess returns true when this status unbookmark forbidden response has a 2xx status code +func (o *StatusUnbookmarkForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark forbidden response has a 3xx status code +func (o *StatusUnbookmarkForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark forbidden response has a 4xx status code +func (o *StatusUnbookmarkForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark forbidden response has a 5xx status code +func (o *StatusUnbookmarkForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark forbidden response a status code equal to that given +func (o *StatusUnbookmarkForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unbookmark forbidden response +func (o *StatusUnbookmarkForbidden) Code() int { + return 403 +} + +func (o *StatusUnbookmarkForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkForbidden", 403) +} + +func (o *StatusUnbookmarkForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkForbidden", 403) +} + +func (o *StatusUnbookmarkForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkNotFound creates a StatusUnbookmarkNotFound with default headers values +func NewStatusUnbookmarkNotFound() *StatusUnbookmarkNotFound { + return &StatusUnbookmarkNotFound{} +} + +/* +StatusUnbookmarkNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnbookmarkNotFound struct { +} + +// IsSuccess returns true when this status unbookmark not found response has a 2xx status code +func (o *StatusUnbookmarkNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark not found response has a 3xx status code +func (o *StatusUnbookmarkNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark not found response has a 4xx status code +func (o *StatusUnbookmarkNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark not found response has a 5xx status code +func (o *StatusUnbookmarkNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark not found response a status code equal to that given +func (o *StatusUnbookmarkNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unbookmark not found response +func (o *StatusUnbookmarkNotFound) Code() int { + return 404 +} + +func (o *StatusUnbookmarkNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotFound", 404) +} + +func (o *StatusUnbookmarkNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotFound", 404) +} + +func (o *StatusUnbookmarkNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkNotAcceptable creates a StatusUnbookmarkNotAcceptable with default headers values +func NewStatusUnbookmarkNotAcceptable() *StatusUnbookmarkNotAcceptable { + return &StatusUnbookmarkNotAcceptable{} +} + +/* +StatusUnbookmarkNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnbookmarkNotAcceptable struct { +} + +// IsSuccess returns true when this status unbookmark not acceptable response has a 2xx status code +func (o *StatusUnbookmarkNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark not acceptable response has a 3xx status code +func (o *StatusUnbookmarkNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark not acceptable response has a 4xx status code +func (o *StatusUnbookmarkNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unbookmark not acceptable response has a 5xx status code +func (o *StatusUnbookmarkNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unbookmark not acceptable response a status code equal to that given +func (o *StatusUnbookmarkNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unbookmark not acceptable response +func (o *StatusUnbookmarkNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnbookmarkNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotAcceptable", 406) +} + +func (o *StatusUnbookmarkNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkNotAcceptable", 406) +} + +func (o *StatusUnbookmarkNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnbookmarkInternalServerError creates a StatusUnbookmarkInternalServerError with default headers values +func NewStatusUnbookmarkInternalServerError() *StatusUnbookmarkInternalServerError { + return &StatusUnbookmarkInternalServerError{} +} + +/* +StatusUnbookmarkInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnbookmarkInternalServerError struct { +} + +// IsSuccess returns true when this status unbookmark internal server error response has a 2xx status code +func (o *StatusUnbookmarkInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unbookmark internal server error response has a 3xx status code +func (o *StatusUnbookmarkInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unbookmark internal server error response has a 4xx status code +func (o *StatusUnbookmarkInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unbookmark internal server error response has a 5xx status code +func (o *StatusUnbookmarkInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unbookmark internal server error response a status code equal to that given +func (o *StatusUnbookmarkInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unbookmark internal server error response +func (o *StatusUnbookmarkInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnbookmarkInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkInternalServerError", 500) +} + +func (o *StatusUnbookmarkInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unbookmark][%d] statusUnbookmarkInternalServerError", 500) +} + +func (o *StatusUnbookmarkInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_unfave_parameters.go b/client/statuses/status_unfave_parameters.go new file mode 100644 index 0000000..ec57983 --- /dev/null +++ b/client/statuses/status_unfave_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnfaveParams creates a new StatusUnfaveParams 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 NewStatusUnfaveParams() *StatusUnfaveParams { + return &StatusUnfaveParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnfaveParamsWithTimeout creates a new StatusUnfaveParams object +// with the ability to set a timeout on a request. +func NewStatusUnfaveParamsWithTimeout(timeout time.Duration) *StatusUnfaveParams { + return &StatusUnfaveParams{ + timeout: timeout, + } +} + +// NewStatusUnfaveParamsWithContext creates a new StatusUnfaveParams object +// with the ability to set a context for a request. +func NewStatusUnfaveParamsWithContext(ctx context.Context) *StatusUnfaveParams { + return &StatusUnfaveParams{ + Context: ctx, + } +} + +// NewStatusUnfaveParamsWithHTTPClient creates a new StatusUnfaveParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnfaveParamsWithHTTPClient(client *http.Client) *StatusUnfaveParams { + return &StatusUnfaveParams{ + HTTPClient: client, + } +} + +/* +StatusUnfaveParams contains all the parameters to send to the API endpoint + + for the status unfave operation. + + Typically these are written to a http.Request. +*/ +type StatusUnfaveParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unfave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnfaveParams) WithDefaults() *StatusUnfaveParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unfave params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnfaveParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unfave params +func (o *StatusUnfaveParams) WithTimeout(timeout time.Duration) *StatusUnfaveParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unfave params +func (o *StatusUnfaveParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unfave params +func (o *StatusUnfaveParams) WithContext(ctx context.Context) *StatusUnfaveParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unfave params +func (o *StatusUnfaveParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unfave params +func (o *StatusUnfaveParams) WithHTTPClient(client *http.Client) *StatusUnfaveParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unfave params +func (o *StatusUnfaveParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unfave params +func (o *StatusUnfaveParams) WithID(id string) *StatusUnfaveParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unfave params +func (o *StatusUnfaveParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnfaveParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_unfave_responses.go b/client/statuses/status_unfave_responses.go new file mode 100644 index 0000000..823e0db --- /dev/null +++ b/client/statuses/status_unfave_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnfaveReader is a Reader for the StatusUnfave structure. +type StatusUnfaveReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnfaveReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnfaveOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnfaveBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnfaveUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnfaveForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnfaveNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnfaveNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnfaveInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unfavourite] statusUnfave", response, response.Code()) + } +} + +// NewStatusUnfaveOK creates a StatusUnfaveOK with default headers values +func NewStatusUnfaveOK() *StatusUnfaveOK { + return &StatusUnfaveOK{} +} + +/* +StatusUnfaveOK describes a response with status code 200, with default header values. + +The unfaved status. +*/ +type StatusUnfaveOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unfave o k response has a 2xx status code +func (o *StatusUnfaveOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unfave o k response has a 3xx status code +func (o *StatusUnfaveOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave o k response has a 4xx status code +func (o *StatusUnfaveOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unfave o k response has a 5xx status code +func (o *StatusUnfaveOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave o k response a status code equal to that given +func (o *StatusUnfaveOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unfave o k response +func (o *StatusUnfaveOK) Code() int { + return 200 +} + +func (o *StatusUnfaveOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveOK %s", 200, payload) +} + +func (o *StatusUnfaveOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveOK %s", 200, payload) +} + +func (o *StatusUnfaveOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnfaveOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnfaveBadRequest creates a StatusUnfaveBadRequest with default headers values +func NewStatusUnfaveBadRequest() *StatusUnfaveBadRequest { + return &StatusUnfaveBadRequest{} +} + +/* +StatusUnfaveBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnfaveBadRequest struct { +} + +// IsSuccess returns true when this status unfave bad request response has a 2xx status code +func (o *StatusUnfaveBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave bad request response has a 3xx status code +func (o *StatusUnfaveBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave bad request response has a 4xx status code +func (o *StatusUnfaveBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave bad request response has a 5xx status code +func (o *StatusUnfaveBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave bad request response a status code equal to that given +func (o *StatusUnfaveBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unfave bad request response +func (o *StatusUnfaveBadRequest) Code() int { + return 400 +} + +func (o *StatusUnfaveBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveBadRequest", 400) +} + +func (o *StatusUnfaveBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveBadRequest", 400) +} + +func (o *StatusUnfaveBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveUnauthorized creates a StatusUnfaveUnauthorized with default headers values +func NewStatusUnfaveUnauthorized() *StatusUnfaveUnauthorized { + return &StatusUnfaveUnauthorized{} +} + +/* +StatusUnfaveUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnfaveUnauthorized struct { +} + +// IsSuccess returns true when this status unfave unauthorized response has a 2xx status code +func (o *StatusUnfaveUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave unauthorized response has a 3xx status code +func (o *StatusUnfaveUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave unauthorized response has a 4xx status code +func (o *StatusUnfaveUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave unauthorized response has a 5xx status code +func (o *StatusUnfaveUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave unauthorized response a status code equal to that given +func (o *StatusUnfaveUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unfave unauthorized response +func (o *StatusUnfaveUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnfaveUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveUnauthorized", 401) +} + +func (o *StatusUnfaveUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveUnauthorized", 401) +} + +func (o *StatusUnfaveUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveForbidden creates a StatusUnfaveForbidden with default headers values +func NewStatusUnfaveForbidden() *StatusUnfaveForbidden { + return &StatusUnfaveForbidden{} +} + +/* +StatusUnfaveForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnfaveForbidden struct { +} + +// IsSuccess returns true when this status unfave forbidden response has a 2xx status code +func (o *StatusUnfaveForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave forbidden response has a 3xx status code +func (o *StatusUnfaveForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave forbidden response has a 4xx status code +func (o *StatusUnfaveForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave forbidden response has a 5xx status code +func (o *StatusUnfaveForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave forbidden response a status code equal to that given +func (o *StatusUnfaveForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unfave forbidden response +func (o *StatusUnfaveForbidden) Code() int { + return 403 +} + +func (o *StatusUnfaveForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveForbidden", 403) +} + +func (o *StatusUnfaveForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveForbidden", 403) +} + +func (o *StatusUnfaveForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveNotFound creates a StatusUnfaveNotFound with default headers values +func NewStatusUnfaveNotFound() *StatusUnfaveNotFound { + return &StatusUnfaveNotFound{} +} + +/* +StatusUnfaveNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnfaveNotFound struct { +} + +// IsSuccess returns true when this status unfave not found response has a 2xx status code +func (o *StatusUnfaveNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave not found response has a 3xx status code +func (o *StatusUnfaveNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave not found response has a 4xx status code +func (o *StatusUnfaveNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave not found response has a 5xx status code +func (o *StatusUnfaveNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave not found response a status code equal to that given +func (o *StatusUnfaveNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unfave not found response +func (o *StatusUnfaveNotFound) Code() int { + return 404 +} + +func (o *StatusUnfaveNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotFound", 404) +} + +func (o *StatusUnfaveNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotFound", 404) +} + +func (o *StatusUnfaveNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveNotAcceptable creates a StatusUnfaveNotAcceptable with default headers values +func NewStatusUnfaveNotAcceptable() *StatusUnfaveNotAcceptable { + return &StatusUnfaveNotAcceptable{} +} + +/* +StatusUnfaveNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnfaveNotAcceptable struct { +} + +// IsSuccess returns true when this status unfave not acceptable response has a 2xx status code +func (o *StatusUnfaveNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave not acceptable response has a 3xx status code +func (o *StatusUnfaveNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave not acceptable response has a 4xx status code +func (o *StatusUnfaveNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unfave not acceptable response has a 5xx status code +func (o *StatusUnfaveNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unfave not acceptable response a status code equal to that given +func (o *StatusUnfaveNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unfave not acceptable response +func (o *StatusUnfaveNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnfaveNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotAcceptable", 406) +} + +func (o *StatusUnfaveNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveNotAcceptable", 406) +} + +func (o *StatusUnfaveNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnfaveInternalServerError creates a StatusUnfaveInternalServerError with default headers values +func NewStatusUnfaveInternalServerError() *StatusUnfaveInternalServerError { + return &StatusUnfaveInternalServerError{} +} + +/* +StatusUnfaveInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnfaveInternalServerError struct { +} + +// IsSuccess returns true when this status unfave internal server error response has a 2xx status code +func (o *StatusUnfaveInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unfave internal server error response has a 3xx status code +func (o *StatusUnfaveInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unfave internal server error response has a 4xx status code +func (o *StatusUnfaveInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unfave internal server error response has a 5xx status code +func (o *StatusUnfaveInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unfave internal server error response a status code equal to that given +func (o *StatusUnfaveInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unfave internal server error response +func (o *StatusUnfaveInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnfaveInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveInternalServerError", 500) +} + +func (o *StatusUnfaveInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unfavourite][%d] statusUnfaveInternalServerError", 500) +} + +func (o *StatusUnfaveInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_unmute_parameters.go b/client/statuses/status_unmute_parameters.go new file mode 100644 index 0000000..7da7ed0 --- /dev/null +++ b/client/statuses/status_unmute_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnmuteParams creates a new StatusUnmuteParams 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 NewStatusUnmuteParams() *StatusUnmuteParams { + return &StatusUnmuteParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnmuteParamsWithTimeout creates a new StatusUnmuteParams object +// with the ability to set a timeout on a request. +func NewStatusUnmuteParamsWithTimeout(timeout time.Duration) *StatusUnmuteParams { + return &StatusUnmuteParams{ + timeout: timeout, + } +} + +// NewStatusUnmuteParamsWithContext creates a new StatusUnmuteParams object +// with the ability to set a context for a request. +func NewStatusUnmuteParamsWithContext(ctx context.Context) *StatusUnmuteParams { + return &StatusUnmuteParams{ + Context: ctx, + } +} + +// NewStatusUnmuteParamsWithHTTPClient creates a new StatusUnmuteParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnmuteParamsWithHTTPClient(client *http.Client) *StatusUnmuteParams { + return &StatusUnmuteParams{ + HTTPClient: client, + } +} + +/* +StatusUnmuteParams contains all the parameters to send to the API endpoint + + for the status unmute operation. + + Typically these are written to a http.Request. +*/ +type StatusUnmuteParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnmuteParams) WithDefaults() *StatusUnmuteParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unmute params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnmuteParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unmute params +func (o *StatusUnmuteParams) WithTimeout(timeout time.Duration) *StatusUnmuteParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unmute params +func (o *StatusUnmuteParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unmute params +func (o *StatusUnmuteParams) WithContext(ctx context.Context) *StatusUnmuteParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unmute params +func (o *StatusUnmuteParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unmute params +func (o *StatusUnmuteParams) WithHTTPClient(client *http.Client) *StatusUnmuteParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unmute params +func (o *StatusUnmuteParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unmute params +func (o *StatusUnmuteParams) WithID(id string) *StatusUnmuteParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unmute params +func (o *StatusUnmuteParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnmuteParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_unmute_responses.go b/client/statuses/status_unmute_responses.go new file mode 100644 index 0000000..bfa61de --- /dev/null +++ b/client/statuses/status_unmute_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnmuteReader is a Reader for the StatusUnmute structure. +type StatusUnmuteReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnmuteReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnmuteOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnmuteBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnmuteUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnmuteForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnmuteNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnmuteNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnmuteInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unmute] statusUnmute", response, response.Code()) + } +} + +// NewStatusUnmuteOK creates a StatusUnmuteOK with default headers values +func NewStatusUnmuteOK() *StatusUnmuteOK { + return &StatusUnmuteOK{} +} + +/* +StatusUnmuteOK describes a response with status code 200, with default header values. + +The now-unmuted status. +*/ +type StatusUnmuteOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unmute o k response has a 2xx status code +func (o *StatusUnmuteOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unmute o k response has a 3xx status code +func (o *StatusUnmuteOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute o k response has a 4xx status code +func (o *StatusUnmuteOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unmute o k response has a 5xx status code +func (o *StatusUnmuteOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute o k response a status code equal to that given +func (o *StatusUnmuteOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unmute o k response +func (o *StatusUnmuteOK) Code() int { + return 200 +} + +func (o *StatusUnmuteOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteOK %s", 200, payload) +} + +func (o *StatusUnmuteOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteOK %s", 200, payload) +} + +func (o *StatusUnmuteOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnmuteOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnmuteBadRequest creates a StatusUnmuteBadRequest with default headers values +func NewStatusUnmuteBadRequest() *StatusUnmuteBadRequest { + return &StatusUnmuteBadRequest{} +} + +/* +StatusUnmuteBadRequest describes a response with status code 400, with default header values. + +bad request; you're not part of the target status thread +*/ +type StatusUnmuteBadRequest struct { +} + +// IsSuccess returns true when this status unmute bad request response has a 2xx status code +func (o *StatusUnmuteBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute bad request response has a 3xx status code +func (o *StatusUnmuteBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute bad request response has a 4xx status code +func (o *StatusUnmuteBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute bad request response has a 5xx status code +func (o *StatusUnmuteBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute bad request response a status code equal to that given +func (o *StatusUnmuteBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unmute bad request response +func (o *StatusUnmuteBadRequest) Code() int { + return 400 +} + +func (o *StatusUnmuteBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteBadRequest", 400) +} + +func (o *StatusUnmuteBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteBadRequest", 400) +} + +func (o *StatusUnmuteBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteUnauthorized creates a StatusUnmuteUnauthorized with default headers values +func NewStatusUnmuteUnauthorized() *StatusUnmuteUnauthorized { + return &StatusUnmuteUnauthorized{} +} + +/* +StatusUnmuteUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnmuteUnauthorized struct { +} + +// IsSuccess returns true when this status unmute unauthorized response has a 2xx status code +func (o *StatusUnmuteUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute unauthorized response has a 3xx status code +func (o *StatusUnmuteUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute unauthorized response has a 4xx status code +func (o *StatusUnmuteUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute unauthorized response has a 5xx status code +func (o *StatusUnmuteUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute unauthorized response a status code equal to that given +func (o *StatusUnmuteUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unmute unauthorized response +func (o *StatusUnmuteUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnmuteUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteUnauthorized", 401) +} + +func (o *StatusUnmuteUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteUnauthorized", 401) +} + +func (o *StatusUnmuteUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteForbidden creates a StatusUnmuteForbidden with default headers values +func NewStatusUnmuteForbidden() *StatusUnmuteForbidden { + return &StatusUnmuteForbidden{} +} + +/* +StatusUnmuteForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnmuteForbidden struct { +} + +// IsSuccess returns true when this status unmute forbidden response has a 2xx status code +func (o *StatusUnmuteForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute forbidden response has a 3xx status code +func (o *StatusUnmuteForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute forbidden response has a 4xx status code +func (o *StatusUnmuteForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute forbidden response has a 5xx status code +func (o *StatusUnmuteForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute forbidden response a status code equal to that given +func (o *StatusUnmuteForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unmute forbidden response +func (o *StatusUnmuteForbidden) Code() int { + return 403 +} + +func (o *StatusUnmuteForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteForbidden", 403) +} + +func (o *StatusUnmuteForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteForbidden", 403) +} + +func (o *StatusUnmuteForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteNotFound creates a StatusUnmuteNotFound with default headers values +func NewStatusUnmuteNotFound() *StatusUnmuteNotFound { + return &StatusUnmuteNotFound{} +} + +/* +StatusUnmuteNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnmuteNotFound struct { +} + +// IsSuccess returns true when this status unmute not found response has a 2xx status code +func (o *StatusUnmuteNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute not found response has a 3xx status code +func (o *StatusUnmuteNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute not found response has a 4xx status code +func (o *StatusUnmuteNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute not found response has a 5xx status code +func (o *StatusUnmuteNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute not found response a status code equal to that given +func (o *StatusUnmuteNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unmute not found response +func (o *StatusUnmuteNotFound) Code() int { + return 404 +} + +func (o *StatusUnmuteNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotFound", 404) +} + +func (o *StatusUnmuteNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotFound", 404) +} + +func (o *StatusUnmuteNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteNotAcceptable creates a StatusUnmuteNotAcceptable with default headers values +func NewStatusUnmuteNotAcceptable() *StatusUnmuteNotAcceptable { + return &StatusUnmuteNotAcceptable{} +} + +/* +StatusUnmuteNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnmuteNotAcceptable struct { +} + +// IsSuccess returns true when this status unmute not acceptable response has a 2xx status code +func (o *StatusUnmuteNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute not acceptable response has a 3xx status code +func (o *StatusUnmuteNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute not acceptable response has a 4xx status code +func (o *StatusUnmuteNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unmute not acceptable response has a 5xx status code +func (o *StatusUnmuteNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unmute not acceptable response a status code equal to that given +func (o *StatusUnmuteNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unmute not acceptable response +func (o *StatusUnmuteNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnmuteNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotAcceptable", 406) +} + +func (o *StatusUnmuteNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteNotAcceptable", 406) +} + +func (o *StatusUnmuteNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnmuteInternalServerError creates a StatusUnmuteInternalServerError with default headers values +func NewStatusUnmuteInternalServerError() *StatusUnmuteInternalServerError { + return &StatusUnmuteInternalServerError{} +} + +/* +StatusUnmuteInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnmuteInternalServerError struct { +} + +// IsSuccess returns true when this status unmute internal server error response has a 2xx status code +func (o *StatusUnmuteInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unmute internal server error response has a 3xx status code +func (o *StatusUnmuteInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unmute internal server error response has a 4xx status code +func (o *StatusUnmuteInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unmute internal server error response has a 5xx status code +func (o *StatusUnmuteInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unmute internal server error response a status code equal to that given +func (o *StatusUnmuteInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unmute internal server error response +func (o *StatusUnmuteInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnmuteInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteInternalServerError", 500) +} + +func (o *StatusUnmuteInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unmute][%d] statusUnmuteInternalServerError", 500) +} + +func (o *StatusUnmuteInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_unpin_parameters.go b/client/statuses/status_unpin_parameters.go new file mode 100644 index 0000000..e25a60a --- /dev/null +++ b/client/statuses/status_unpin_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnpinParams creates a new StatusUnpinParams 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 NewStatusUnpinParams() *StatusUnpinParams { + return &StatusUnpinParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnpinParamsWithTimeout creates a new StatusUnpinParams object +// with the ability to set a timeout on a request. +func NewStatusUnpinParamsWithTimeout(timeout time.Duration) *StatusUnpinParams { + return &StatusUnpinParams{ + timeout: timeout, + } +} + +// NewStatusUnpinParamsWithContext creates a new StatusUnpinParams object +// with the ability to set a context for a request. +func NewStatusUnpinParamsWithContext(ctx context.Context) *StatusUnpinParams { + return &StatusUnpinParams{ + Context: ctx, + } +} + +// NewStatusUnpinParamsWithHTTPClient creates a new StatusUnpinParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnpinParamsWithHTTPClient(client *http.Client) *StatusUnpinParams { + return &StatusUnpinParams{ + HTTPClient: client, + } +} + +/* +StatusUnpinParams contains all the parameters to send to the API endpoint + + for the status unpin operation. + + Typically these are written to a http.Request. +*/ +type StatusUnpinParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unpin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnpinParams) WithDefaults() *StatusUnpinParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unpin params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnpinParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unpin params +func (o *StatusUnpinParams) WithTimeout(timeout time.Duration) *StatusUnpinParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unpin params +func (o *StatusUnpinParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unpin params +func (o *StatusUnpinParams) WithContext(ctx context.Context) *StatusUnpinParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unpin params +func (o *StatusUnpinParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unpin params +func (o *StatusUnpinParams) WithHTTPClient(client *http.Client) *StatusUnpinParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unpin params +func (o *StatusUnpinParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unpin params +func (o *StatusUnpinParams) WithID(id string) *StatusUnpinParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unpin params +func (o *StatusUnpinParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnpinParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_unpin_responses.go b/client/statuses/status_unpin_responses.go new file mode 100644 index 0000000..9ad1b58 --- /dev/null +++ b/client/statuses/status_unpin_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnpinReader is a Reader for the StatusUnpin structure. +type StatusUnpinReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnpinReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnpinOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnpinBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnpinUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnpinForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnpinNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnpinNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnpinInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unpin] statusUnpin", response, response.Code()) + } +} + +// NewStatusUnpinOK creates a StatusUnpinOK with default headers values +func NewStatusUnpinOK() *StatusUnpinOK { + return &StatusUnpinOK{} +} + +/* +StatusUnpinOK describes a response with status code 200, with default header values. + +The status. +*/ +type StatusUnpinOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unpin o k response has a 2xx status code +func (o *StatusUnpinOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unpin o k response has a 3xx status code +func (o *StatusUnpinOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin o k response has a 4xx status code +func (o *StatusUnpinOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unpin o k response has a 5xx status code +func (o *StatusUnpinOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin o k response a status code equal to that given +func (o *StatusUnpinOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unpin o k response +func (o *StatusUnpinOK) Code() int { + return 200 +} + +func (o *StatusUnpinOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinOK %s", 200, payload) +} + +func (o *StatusUnpinOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinOK %s", 200, payload) +} + +func (o *StatusUnpinOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnpinOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnpinBadRequest creates a StatusUnpinBadRequest with default headers values +func NewStatusUnpinBadRequest() *StatusUnpinBadRequest { + return &StatusUnpinBadRequest{} +} + +/* +StatusUnpinBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnpinBadRequest struct { +} + +// IsSuccess returns true when this status unpin bad request response has a 2xx status code +func (o *StatusUnpinBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin bad request response has a 3xx status code +func (o *StatusUnpinBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin bad request response has a 4xx status code +func (o *StatusUnpinBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin bad request response has a 5xx status code +func (o *StatusUnpinBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin bad request response a status code equal to that given +func (o *StatusUnpinBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unpin bad request response +func (o *StatusUnpinBadRequest) Code() int { + return 400 +} + +func (o *StatusUnpinBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinBadRequest", 400) +} + +func (o *StatusUnpinBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinBadRequest", 400) +} + +func (o *StatusUnpinBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinUnauthorized creates a StatusUnpinUnauthorized with default headers values +func NewStatusUnpinUnauthorized() *StatusUnpinUnauthorized { + return &StatusUnpinUnauthorized{} +} + +/* +StatusUnpinUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnpinUnauthorized struct { +} + +// IsSuccess returns true when this status unpin unauthorized response has a 2xx status code +func (o *StatusUnpinUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin unauthorized response has a 3xx status code +func (o *StatusUnpinUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin unauthorized response has a 4xx status code +func (o *StatusUnpinUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin unauthorized response has a 5xx status code +func (o *StatusUnpinUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin unauthorized response a status code equal to that given +func (o *StatusUnpinUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unpin unauthorized response +func (o *StatusUnpinUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnpinUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinUnauthorized", 401) +} + +func (o *StatusUnpinUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinUnauthorized", 401) +} + +func (o *StatusUnpinUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinForbidden creates a StatusUnpinForbidden with default headers values +func NewStatusUnpinForbidden() *StatusUnpinForbidden { + return &StatusUnpinForbidden{} +} + +/* +StatusUnpinForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnpinForbidden struct { +} + +// IsSuccess returns true when this status unpin forbidden response has a 2xx status code +func (o *StatusUnpinForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin forbidden response has a 3xx status code +func (o *StatusUnpinForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin forbidden response has a 4xx status code +func (o *StatusUnpinForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin forbidden response has a 5xx status code +func (o *StatusUnpinForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin forbidden response a status code equal to that given +func (o *StatusUnpinForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unpin forbidden response +func (o *StatusUnpinForbidden) Code() int { + return 403 +} + +func (o *StatusUnpinForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinForbidden", 403) +} + +func (o *StatusUnpinForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinForbidden", 403) +} + +func (o *StatusUnpinForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinNotFound creates a StatusUnpinNotFound with default headers values +func NewStatusUnpinNotFound() *StatusUnpinNotFound { + return &StatusUnpinNotFound{} +} + +/* +StatusUnpinNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnpinNotFound struct { +} + +// IsSuccess returns true when this status unpin not found response has a 2xx status code +func (o *StatusUnpinNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin not found response has a 3xx status code +func (o *StatusUnpinNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin not found response has a 4xx status code +func (o *StatusUnpinNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin not found response has a 5xx status code +func (o *StatusUnpinNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin not found response a status code equal to that given +func (o *StatusUnpinNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unpin not found response +func (o *StatusUnpinNotFound) Code() int { + return 404 +} + +func (o *StatusUnpinNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotFound", 404) +} + +func (o *StatusUnpinNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotFound", 404) +} + +func (o *StatusUnpinNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinNotAcceptable creates a StatusUnpinNotAcceptable with default headers values +func NewStatusUnpinNotAcceptable() *StatusUnpinNotAcceptable { + return &StatusUnpinNotAcceptable{} +} + +/* +StatusUnpinNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnpinNotAcceptable struct { +} + +// IsSuccess returns true when this status unpin not acceptable response has a 2xx status code +func (o *StatusUnpinNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin not acceptable response has a 3xx status code +func (o *StatusUnpinNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin not acceptable response has a 4xx status code +func (o *StatusUnpinNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unpin not acceptable response has a 5xx status code +func (o *StatusUnpinNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unpin not acceptable response a status code equal to that given +func (o *StatusUnpinNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unpin not acceptable response +func (o *StatusUnpinNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnpinNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotAcceptable", 406) +} + +func (o *StatusUnpinNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinNotAcceptable", 406) +} + +func (o *StatusUnpinNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnpinInternalServerError creates a StatusUnpinInternalServerError with default headers values +func NewStatusUnpinInternalServerError() *StatusUnpinInternalServerError { + return &StatusUnpinInternalServerError{} +} + +/* +StatusUnpinInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnpinInternalServerError struct { +} + +// IsSuccess returns true when this status unpin internal server error response has a 2xx status code +func (o *StatusUnpinInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unpin internal server error response has a 3xx status code +func (o *StatusUnpinInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unpin internal server error response has a 4xx status code +func (o *StatusUnpinInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unpin internal server error response has a 5xx status code +func (o *StatusUnpinInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unpin internal server error response a status code equal to that given +func (o *StatusUnpinInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unpin internal server error response +func (o *StatusUnpinInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnpinInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinInternalServerError", 500) +} + +func (o *StatusUnpinInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unpin][%d] statusUnpinInternalServerError", 500) +} + +func (o *StatusUnpinInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/status_unreblog_parameters.go b/client/statuses/status_unreblog_parameters.go new file mode 100644 index 0000000..e7832a4 --- /dev/null +++ b/client/statuses/status_unreblog_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewStatusUnreblogParams creates a new StatusUnreblogParams 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 NewStatusUnreblogParams() *StatusUnreblogParams { + return &StatusUnreblogParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStatusUnreblogParamsWithTimeout creates a new StatusUnreblogParams object +// with the ability to set a timeout on a request. +func NewStatusUnreblogParamsWithTimeout(timeout time.Duration) *StatusUnreblogParams { + return &StatusUnreblogParams{ + timeout: timeout, + } +} + +// NewStatusUnreblogParamsWithContext creates a new StatusUnreblogParams object +// with the ability to set a context for a request. +func NewStatusUnreblogParamsWithContext(ctx context.Context) *StatusUnreblogParams { + return &StatusUnreblogParams{ + Context: ctx, + } +} + +// NewStatusUnreblogParamsWithHTTPClient creates a new StatusUnreblogParams object +// with the ability to set a custom HTTPClient for a request. +func NewStatusUnreblogParamsWithHTTPClient(client *http.Client) *StatusUnreblogParams { + return &StatusUnreblogParams{ + HTTPClient: client, + } +} + +/* +StatusUnreblogParams contains all the parameters to send to the API endpoint + + for the status unreblog operation. + + Typically these are written to a http.Request. +*/ +type StatusUnreblogParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the status unreblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnreblogParams) WithDefaults() *StatusUnreblogParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the status unreblog params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StatusUnreblogParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the status unreblog params +func (o *StatusUnreblogParams) WithTimeout(timeout time.Duration) *StatusUnreblogParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the status unreblog params +func (o *StatusUnreblogParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the status unreblog params +func (o *StatusUnreblogParams) WithContext(ctx context.Context) *StatusUnreblogParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the status unreblog params +func (o *StatusUnreblogParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the status unreblog params +func (o *StatusUnreblogParams) WithHTTPClient(client *http.Client) *StatusUnreblogParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the status unreblog params +func (o *StatusUnreblogParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the status unreblog params +func (o *StatusUnreblogParams) WithID(id string) *StatusUnreblogParams { + o.SetID(id) + return o +} + +// SetID adds the id to the status unreblog params +func (o *StatusUnreblogParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *StatusUnreblogParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/status_unreblog_responses.go b/client/statuses/status_unreblog_responses.go new file mode 100644 index 0000000..4486c3b --- /dev/null +++ b/client/statuses/status_unreblog_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// StatusUnreblogReader is a Reader for the StatusUnreblog structure. +type StatusUnreblogReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StatusUnreblogReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewStatusUnreblogOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewStatusUnreblogBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStatusUnreblogUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewStatusUnreblogForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewStatusUnreblogNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewStatusUnreblogNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewStatusUnreblogInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/statuses/{id}/unreblog] statusUnreblog", response, response.Code()) + } +} + +// NewStatusUnreblogOK creates a StatusUnreblogOK with default headers values +func NewStatusUnreblogOK() *StatusUnreblogOK { + return &StatusUnreblogOK{} +} + +/* +StatusUnreblogOK describes a response with status code 200, with default header values. + +The unboosted status. +*/ +type StatusUnreblogOK struct { + Payload *models.Status +} + +// IsSuccess returns true when this status unreblog o k response has a 2xx status code +func (o *StatusUnreblogOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this status unreblog o k response has a 3xx status code +func (o *StatusUnreblogOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog o k response has a 4xx status code +func (o *StatusUnreblogOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unreblog o k response has a 5xx status code +func (o *StatusUnreblogOK) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog o k response a status code equal to that given +func (o *StatusUnreblogOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the status unreblog o k response +func (o *StatusUnreblogOK) Code() int { + return 200 +} + +func (o *StatusUnreblogOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogOK %s", 200, payload) +} + +func (o *StatusUnreblogOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogOK %s", 200, payload) +} + +func (o *StatusUnreblogOK) GetPayload() *models.Status { + return o.Payload +} + +func (o *StatusUnreblogOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.Status) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStatusUnreblogBadRequest creates a StatusUnreblogBadRequest with default headers values +func NewStatusUnreblogBadRequest() *StatusUnreblogBadRequest { + return &StatusUnreblogBadRequest{} +} + +/* +StatusUnreblogBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StatusUnreblogBadRequest struct { +} + +// IsSuccess returns true when this status unreblog bad request response has a 2xx status code +func (o *StatusUnreblogBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog bad request response has a 3xx status code +func (o *StatusUnreblogBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog bad request response has a 4xx status code +func (o *StatusUnreblogBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog bad request response has a 5xx status code +func (o *StatusUnreblogBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog bad request response a status code equal to that given +func (o *StatusUnreblogBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the status unreblog bad request response +func (o *StatusUnreblogBadRequest) Code() int { + return 400 +} + +func (o *StatusUnreblogBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogBadRequest", 400) +} + +func (o *StatusUnreblogBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogBadRequest", 400) +} + +func (o *StatusUnreblogBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogUnauthorized creates a StatusUnreblogUnauthorized with default headers values +func NewStatusUnreblogUnauthorized() *StatusUnreblogUnauthorized { + return &StatusUnreblogUnauthorized{} +} + +/* +StatusUnreblogUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StatusUnreblogUnauthorized struct { +} + +// IsSuccess returns true when this status unreblog unauthorized response has a 2xx status code +func (o *StatusUnreblogUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog unauthorized response has a 3xx status code +func (o *StatusUnreblogUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog unauthorized response has a 4xx status code +func (o *StatusUnreblogUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog unauthorized response has a 5xx status code +func (o *StatusUnreblogUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog unauthorized response a status code equal to that given +func (o *StatusUnreblogUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the status unreblog unauthorized response +func (o *StatusUnreblogUnauthorized) Code() int { + return 401 +} + +func (o *StatusUnreblogUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogUnauthorized", 401) +} + +func (o *StatusUnreblogUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogUnauthorized", 401) +} + +func (o *StatusUnreblogUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogForbidden creates a StatusUnreblogForbidden with default headers values +func NewStatusUnreblogForbidden() *StatusUnreblogForbidden { + return &StatusUnreblogForbidden{} +} + +/* +StatusUnreblogForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type StatusUnreblogForbidden struct { +} + +// IsSuccess returns true when this status unreblog forbidden response has a 2xx status code +func (o *StatusUnreblogForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog forbidden response has a 3xx status code +func (o *StatusUnreblogForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog forbidden response has a 4xx status code +func (o *StatusUnreblogForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog forbidden response has a 5xx status code +func (o *StatusUnreblogForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog forbidden response a status code equal to that given +func (o *StatusUnreblogForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the status unreblog forbidden response +func (o *StatusUnreblogForbidden) Code() int { + return 403 +} + +func (o *StatusUnreblogForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogForbidden", 403) +} + +func (o *StatusUnreblogForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogForbidden", 403) +} + +func (o *StatusUnreblogForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogNotFound creates a StatusUnreblogNotFound with default headers values +func NewStatusUnreblogNotFound() *StatusUnreblogNotFound { + return &StatusUnreblogNotFound{} +} + +/* +StatusUnreblogNotFound describes a response with status code 404, with default header values. + +not found +*/ +type StatusUnreblogNotFound struct { +} + +// IsSuccess returns true when this status unreblog not found response has a 2xx status code +func (o *StatusUnreblogNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog not found response has a 3xx status code +func (o *StatusUnreblogNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog not found response has a 4xx status code +func (o *StatusUnreblogNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog not found response has a 5xx status code +func (o *StatusUnreblogNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog not found response a status code equal to that given +func (o *StatusUnreblogNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the status unreblog not found response +func (o *StatusUnreblogNotFound) Code() int { + return 404 +} + +func (o *StatusUnreblogNotFound) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotFound", 404) +} + +func (o *StatusUnreblogNotFound) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotFound", 404) +} + +func (o *StatusUnreblogNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogNotAcceptable creates a StatusUnreblogNotAcceptable with default headers values +func NewStatusUnreblogNotAcceptable() *StatusUnreblogNotAcceptable { + return &StatusUnreblogNotAcceptable{} +} + +/* +StatusUnreblogNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type StatusUnreblogNotAcceptable struct { +} + +// IsSuccess returns true when this status unreblog not acceptable response has a 2xx status code +func (o *StatusUnreblogNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog not acceptable response has a 3xx status code +func (o *StatusUnreblogNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog not acceptable response has a 4xx status code +func (o *StatusUnreblogNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this status unreblog not acceptable response has a 5xx status code +func (o *StatusUnreblogNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this status unreblog not acceptable response a status code equal to that given +func (o *StatusUnreblogNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the status unreblog not acceptable response +func (o *StatusUnreblogNotAcceptable) Code() int { + return 406 +} + +func (o *StatusUnreblogNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotAcceptable", 406) +} + +func (o *StatusUnreblogNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogNotAcceptable", 406) +} + +func (o *StatusUnreblogNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStatusUnreblogInternalServerError creates a StatusUnreblogInternalServerError with default headers values +func NewStatusUnreblogInternalServerError() *StatusUnreblogInternalServerError { + return &StatusUnreblogInternalServerError{} +} + +/* +StatusUnreblogInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type StatusUnreblogInternalServerError struct { +} + +// IsSuccess returns true when this status unreblog internal server error response has a 2xx status code +func (o *StatusUnreblogInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this status unreblog internal server error response has a 3xx status code +func (o *StatusUnreblogInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this status unreblog internal server error response has a 4xx status code +func (o *StatusUnreblogInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this status unreblog internal server error response has a 5xx status code +func (o *StatusUnreblogInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this status unreblog internal server error response a status code equal to that given +func (o *StatusUnreblogInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the status unreblog internal server error response +func (o *StatusUnreblogInternalServerError) Code() int { + return 500 +} + +func (o *StatusUnreblogInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogInternalServerError", 500) +} + +func (o *StatusUnreblogInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/statuses/{id}/unreblog][%d] statusUnreblogInternalServerError", 500) +} + +func (o *StatusUnreblogInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/statuses/statuses_client.go b/client/statuses/statuses_client.go new file mode 100644 index 0000000..5ad608d --- /dev/null +++ b/client/statuses/statuses_client.go @@ -0,0 +1,861 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new statuses API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new statuses API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new statuses API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for statuses API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + StatusBookmark(params *StatusBookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBookmarkOK, error) + + StatusBoostedBy(params *StatusBoostedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBoostedByOK, error) + + StatusCreate(params *StatusCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusCreateOK, error) + + StatusDelete(params *StatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusDeleteOK, error) + + StatusFave(params *StatusFaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFaveOK, error) + + StatusFavedBy(params *StatusFavedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFavedByOK, error) + + StatusGet(params *StatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusGetOK, error) + + StatusHistoryGet(params *StatusHistoryGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusHistoryGetOK, error) + + StatusMute(params *StatusMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusMuteOK, error) + + StatusPin(params *StatusPinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusPinOK, error) + + StatusReblog(params *StatusReblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusReblogOK, error) + + StatusSourceGet(params *StatusSourceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusSourceGetOK, error) + + StatusUnbookmark(params *StatusUnbookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnbookmarkOK, error) + + StatusUnfave(params *StatusUnfaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnfaveOK, error) + + StatusUnmute(params *StatusUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnmuteOK, error) + + StatusUnpin(params *StatusUnpinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnpinOK, error) + + StatusUnreblog(params *StatusUnreblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnreblogOK, error) + + ThreadContext(params *ThreadContextParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ThreadContextOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +StatusBookmark bookmarks status with the given ID +*/ +func (a *Client) StatusBookmark(params *StatusBookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBookmarkOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusBookmarkParams() + } + op := &runtime.ClientOperation{ + ID: "statusBookmark", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/bookmark", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusBookmarkReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusBookmarkOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusBookmark: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusBoostedBy views accounts that have reblogged boosted the target status +*/ +func (a *Client) StatusBoostedBy(params *StatusBoostedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusBoostedByOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusBoostedByParams() + } + op := &runtime.ClientOperation{ + ID: "statusBoostedBy", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/reblogged_by", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusBoostedByReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusBoostedByOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusBoostedBy: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusCreate creates a new status + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) StatusCreate(params *StatusCreateParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusCreateOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusCreateParams() + } + op := &runtime.ClientOperation{ + ID: "statusCreate", + Method: "POST", + PathPattern: "/api/v1/statuses", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusCreateReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusCreateOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusCreate: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusDelete deletes status with the given ID the status must belong to you + + The deleted status will be returned in the response. The `text` field will contain the original text of the status as it was submitted. + +This is useful when doing a 'delete and redraft' type operation. +*/ +func (a *Client) StatusDelete(params *StatusDeleteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusDeleteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusDeleteParams() + } + op := &runtime.ClientOperation{ + ID: "statusDelete", + Method: "DELETE", + PathPattern: "/api/v1/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusDeleteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusDeleteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusDelete: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusFave stars like favourite the given status if permitted +*/ +func (a *Client) StatusFave(params *StatusFaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFaveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusFaveParams() + } + op := &runtime.ClientOperation{ + ID: "statusFave", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/favourite", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusFaveReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusFaveOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusFave: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusFavedBy views accounts that have faved starred liked the target status +*/ +func (a *Client) StatusFavedBy(params *StatusFavedByParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusFavedByOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusFavedByParams() + } + op := &runtime.ClientOperation{ + ID: "statusFavedBy", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/favourited_by", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusFavedByReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusFavedByOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusFavedBy: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusGet views status with the given ID +*/ +func (a *Client) StatusGet(params *StatusGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusGetParams() + } + op := &runtime.ClientOperation{ + ID: "statusGet", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusHistoryGet views edit history of status with the given ID + +UNIMPLEMENTED: Currently this endpoint will always return an array of length 1, containing only the latest/current version of the status. +*/ +func (a *Client) StatusHistoryGet(params *StatusHistoryGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusHistoryGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusHistoryGetParams() + } + op := &runtime.ClientOperation{ + ID: "statusHistoryGet", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/history", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusHistoryGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusHistoryGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusHistoryGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusMute mutes a status s thread this prevents notifications from being created for future replies likes boosts etc in the thread of which the target status is a part + + Target status must belong to you or mention you. + +Status thread mutes and unmutes are idempotent. If you already mute a thread, muting it again just means it stays muted and you'll get 200 OK back. +*/ +func (a *Client) StatusMute(params *StatusMuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusMuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusMuteParams() + } + op := &runtime.ClientOperation{ + ID: "statusMute", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/mute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusMuteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusMuteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusMute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusPin pins a status to the top of your profile and add it to your featured activity pub collection + + You can only pin original posts (not reblogs) that you authored yourself. + +Supported privacy levels for pinned posts are public, unlisted, and private/followers-only, +but only public posts will appear on the web version of your profile. +*/ +func (a *Client) StatusPin(params *StatusPinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusPinOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusPinParams() + } + op := &runtime.ClientOperation{ + ID: "statusPin", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/pin", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusPinReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusPinOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusPin: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusReblog reblogs boost status with the given ID + + If the target status is rebloggable/boostable, it will be shared with your followers. + +This is equivalent to an ActivityPub 'Announce' activity. +*/ +func (a *Client) StatusReblog(params *StatusReblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusReblogOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusReblogParams() + } + op := &runtime.ClientOperation{ + ID: "statusReblog", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/reblog", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusReblogReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusReblogOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusReblog: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusSourceGet views source text of status with the given ID requester must own the status +*/ +func (a *Client) StatusSourceGet(params *StatusSourceGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusSourceGetOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusSourceGetParams() + } + op := &runtime.ClientOperation{ + ID: "statusSourceGet", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/source", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusSourceGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusSourceGetOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusSourceGet: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnbookmark unbookmarks status with the given ID +*/ +func (a *Client) StatusUnbookmark(params *StatusUnbookmarkParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnbookmarkOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnbookmarkParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnbookmark", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unbookmark", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnbookmarkReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusUnbookmarkOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusUnbookmark: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnfave unstars unlike unfavourite the given status +*/ +func (a *Client) StatusUnfave(params *StatusUnfaveParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnfaveOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnfaveParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnfave", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unfavourite", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnfaveReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusUnfaveOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusUnfave: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + StatusUnmute unmutes a status s thread this reenables notifications for future replies likes boosts etc in the thread of which the target status is a part + + Target status must belong to you or mention you. + +Status thread mutes and unmutes are idempotent. If you already unmuted a thread, unmuting it again just means it stays unmuted and you'll get 200 OK back. +*/ +func (a *Client) StatusUnmute(params *StatusUnmuteParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnmuteOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnmuteParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnmute", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unmute", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnmuteReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusUnmuteOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusUnmute: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnpin unpins one of your pinned statuses +*/ +func (a *Client) StatusUnpin(params *StatusUnpinParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnpinOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnpinParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnpin", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unpin", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnpinReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusUnpinOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusUnpin: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +StatusUnreblog unreblogs unboost status with the given ID +*/ +func (a *Client) StatusUnreblog(params *StatusUnreblogParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*StatusUnreblogOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewStatusUnreblogParams() + } + op := &runtime.ClientOperation{ + ID: "statusUnreblog", + Method: "POST", + PathPattern: "/api/v1/statuses/{id}/unreblog", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &StatusUnreblogReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*StatusUnreblogOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for statusUnreblog: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +ThreadContext returns ancestors and descendants of the given status + +The returned statuses will be ordered in a thread structure, so they are suitable to be displayed in the order in which they were returned. +*/ +func (a *Client) ThreadContext(params *ThreadContextParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ThreadContextOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewThreadContextParams() + } + op := &runtime.ClientOperation{ + ID: "threadContext", + Method: "GET", + PathPattern: "/api/v1/statuses/{id}/context", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ThreadContextReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ThreadContextOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for threadContext: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/statuses/thread_context_parameters.go b/client/statuses/thread_context_parameters.go new file mode 100644 index 0000000..f697a6c --- /dev/null +++ b/client/statuses/thread_context_parameters.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// 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" +) + +// NewThreadContextParams creates a new ThreadContextParams 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 NewThreadContextParams() *ThreadContextParams { + return &ThreadContextParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewThreadContextParamsWithTimeout creates a new ThreadContextParams object +// with the ability to set a timeout on a request. +func NewThreadContextParamsWithTimeout(timeout time.Duration) *ThreadContextParams { + return &ThreadContextParams{ + timeout: timeout, + } +} + +// NewThreadContextParamsWithContext creates a new ThreadContextParams object +// with the ability to set a context for a request. +func NewThreadContextParamsWithContext(ctx context.Context) *ThreadContextParams { + return &ThreadContextParams{ + Context: ctx, + } +} + +// NewThreadContextParamsWithHTTPClient creates a new ThreadContextParams object +// with the ability to set a custom HTTPClient for a request. +func NewThreadContextParamsWithHTTPClient(client *http.Client) *ThreadContextParams { + return &ThreadContextParams{ + HTTPClient: client, + } +} + +/* +ThreadContextParams contains all the parameters to send to the API endpoint + + for the thread context operation. + + Typically these are written to a http.Request. +*/ +type ThreadContextParams struct { + + /* ID. + + Target status ID. + */ + ID string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the thread context params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ThreadContextParams) WithDefaults() *ThreadContextParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the thread context params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ThreadContextParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the thread context params +func (o *ThreadContextParams) WithTimeout(timeout time.Duration) *ThreadContextParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the thread context params +func (o *ThreadContextParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the thread context params +func (o *ThreadContextParams) WithContext(ctx context.Context) *ThreadContextParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the thread context params +func (o *ThreadContextParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the thread context params +func (o *ThreadContextParams) WithHTTPClient(client *http.Client) *ThreadContextParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the thread context params +func (o *ThreadContextParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the thread context params +func (o *ThreadContextParams) WithID(id string) *ThreadContextParams { + o.SetID(id) + return o +} + +// SetID adds the id to the thread context params +func (o *ThreadContextParams) SetID(id string) { + o.ID = id +} + +// WriteToRequest writes these params to a swagger request +func (o *ThreadContextParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/statuses/thread_context_responses.go b/client/statuses/thread_context_responses.go new file mode 100644 index 0000000..9809eef --- /dev/null +++ b/client/statuses/thread_context_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package statuses + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ThreadContextReader is a Reader for the ThreadContext structure. +type ThreadContextReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ThreadContextReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewThreadContextOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewThreadContextBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewThreadContextUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewThreadContextForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 404: + result := NewThreadContextNotFound() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewThreadContextNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewThreadContextInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/statuses/{id}/context] threadContext", response, response.Code()) + } +} + +// NewThreadContextOK creates a ThreadContextOK with default headers values +func NewThreadContextOK() *ThreadContextOK { + return &ThreadContextOK{} +} + +/* +ThreadContextOK describes a response with status code 200, with default header values. + +Thread context object. +*/ +type ThreadContextOK struct { + Payload *models.ThreadContext +} + +// IsSuccess returns true when this thread context o k response has a 2xx status code +func (o *ThreadContextOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this thread context o k response has a 3xx status code +func (o *ThreadContextOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context o k response has a 4xx status code +func (o *ThreadContextOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this thread context o k response has a 5xx status code +func (o *ThreadContextOK) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context o k response a status code equal to that given +func (o *ThreadContextOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the thread context o k response +func (o *ThreadContextOK) Code() int { + return 200 +} + +func (o *ThreadContextOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextOK %s", 200, payload) +} + +func (o *ThreadContextOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextOK %s", 200, payload) +} + +func (o *ThreadContextOK) GetPayload() *models.ThreadContext { + return o.Payload +} + +func (o *ThreadContextOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.ThreadContext) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewThreadContextBadRequest creates a ThreadContextBadRequest with default headers values +func NewThreadContextBadRequest() *ThreadContextBadRequest { + return &ThreadContextBadRequest{} +} + +/* +ThreadContextBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ThreadContextBadRequest struct { +} + +// IsSuccess returns true when this thread context bad request response has a 2xx status code +func (o *ThreadContextBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context bad request response has a 3xx status code +func (o *ThreadContextBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context bad request response has a 4xx status code +func (o *ThreadContextBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context bad request response has a 5xx status code +func (o *ThreadContextBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context bad request response a status code equal to that given +func (o *ThreadContextBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the thread context bad request response +func (o *ThreadContextBadRequest) Code() int { + return 400 +} + +func (o *ThreadContextBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextBadRequest", 400) +} + +func (o *ThreadContextBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextBadRequest", 400) +} + +func (o *ThreadContextBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextUnauthorized creates a ThreadContextUnauthorized with default headers values +func NewThreadContextUnauthorized() *ThreadContextUnauthorized { + return &ThreadContextUnauthorized{} +} + +/* +ThreadContextUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ThreadContextUnauthorized struct { +} + +// IsSuccess returns true when this thread context unauthorized response has a 2xx status code +func (o *ThreadContextUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context unauthorized response has a 3xx status code +func (o *ThreadContextUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context unauthorized response has a 4xx status code +func (o *ThreadContextUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context unauthorized response has a 5xx status code +func (o *ThreadContextUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context unauthorized response a status code equal to that given +func (o *ThreadContextUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the thread context unauthorized response +func (o *ThreadContextUnauthorized) Code() int { + return 401 +} + +func (o *ThreadContextUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextUnauthorized", 401) +} + +func (o *ThreadContextUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextUnauthorized", 401) +} + +func (o *ThreadContextUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextForbidden creates a ThreadContextForbidden with default headers values +func NewThreadContextForbidden() *ThreadContextForbidden { + return &ThreadContextForbidden{} +} + +/* +ThreadContextForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type ThreadContextForbidden struct { +} + +// IsSuccess returns true when this thread context forbidden response has a 2xx status code +func (o *ThreadContextForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context forbidden response has a 3xx status code +func (o *ThreadContextForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context forbidden response has a 4xx status code +func (o *ThreadContextForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context forbidden response has a 5xx status code +func (o *ThreadContextForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context forbidden response a status code equal to that given +func (o *ThreadContextForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the thread context forbidden response +func (o *ThreadContextForbidden) Code() int { + return 403 +} + +func (o *ThreadContextForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextForbidden", 403) +} + +func (o *ThreadContextForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextForbidden", 403) +} + +func (o *ThreadContextForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextNotFound creates a ThreadContextNotFound with default headers values +func NewThreadContextNotFound() *ThreadContextNotFound { + return &ThreadContextNotFound{} +} + +/* +ThreadContextNotFound describes a response with status code 404, with default header values. + +not found +*/ +type ThreadContextNotFound struct { +} + +// IsSuccess returns true when this thread context not found response has a 2xx status code +func (o *ThreadContextNotFound) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context not found response has a 3xx status code +func (o *ThreadContextNotFound) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context not found response has a 4xx status code +func (o *ThreadContextNotFound) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context not found response has a 5xx status code +func (o *ThreadContextNotFound) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context not found response a status code equal to that given +func (o *ThreadContextNotFound) IsCode(code int) bool { + return code == 404 +} + +// Code gets the status code for the thread context not found response +func (o *ThreadContextNotFound) Code() int { + return 404 +} + +func (o *ThreadContextNotFound) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotFound", 404) +} + +func (o *ThreadContextNotFound) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotFound", 404) +} + +func (o *ThreadContextNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextNotAcceptable creates a ThreadContextNotAcceptable with default headers values +func NewThreadContextNotAcceptable() *ThreadContextNotAcceptable { + return &ThreadContextNotAcceptable{} +} + +/* +ThreadContextNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type ThreadContextNotAcceptable struct { +} + +// IsSuccess returns true when this thread context not acceptable response has a 2xx status code +func (o *ThreadContextNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context not acceptable response has a 3xx status code +func (o *ThreadContextNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context not acceptable response has a 4xx status code +func (o *ThreadContextNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this thread context not acceptable response has a 5xx status code +func (o *ThreadContextNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this thread context not acceptable response a status code equal to that given +func (o *ThreadContextNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the thread context not acceptable response +func (o *ThreadContextNotAcceptable) Code() int { + return 406 +} + +func (o *ThreadContextNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotAcceptable", 406) +} + +func (o *ThreadContextNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextNotAcceptable", 406) +} + +func (o *ThreadContextNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewThreadContextInternalServerError creates a ThreadContextInternalServerError with default headers values +func NewThreadContextInternalServerError() *ThreadContextInternalServerError { + return &ThreadContextInternalServerError{} +} + +/* +ThreadContextInternalServerError describes a response with status code 500, with default header values. + +internal server error +*/ +type ThreadContextInternalServerError struct { +} + +// IsSuccess returns true when this thread context internal server error response has a 2xx status code +func (o *ThreadContextInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this thread context internal server error response has a 3xx status code +func (o *ThreadContextInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this thread context internal server error response has a 4xx status code +func (o *ThreadContextInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this thread context internal server error response has a 5xx status code +func (o *ThreadContextInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this thread context internal server error response a status code equal to that given +func (o *ThreadContextInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the thread context internal server error response +func (o *ThreadContextInternalServerError) Code() int { + return 500 +} + +func (o *ThreadContextInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextInternalServerError", 500) +} + +func (o *ThreadContextInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/statuses/{id}/context][%d] threadContextInternalServerError", 500) +} + +func (o *ThreadContextInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/streaming/stream_get_parameters.go b/client/streaming/stream_get_parameters.go new file mode 100644 index 0000000..c66912a --- /dev/null +++ b/client/streaming/stream_get_parameters.go @@ -0,0 +1,263 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package streaming + +// 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" +) + +// NewStreamGetParams creates a new StreamGetParams 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 NewStreamGetParams() *StreamGetParams { + return &StreamGetParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewStreamGetParamsWithTimeout creates a new StreamGetParams object +// with the ability to set a timeout on a request. +func NewStreamGetParamsWithTimeout(timeout time.Duration) *StreamGetParams { + return &StreamGetParams{ + timeout: timeout, + } +} + +// NewStreamGetParamsWithContext creates a new StreamGetParams object +// with the ability to set a context for a request. +func NewStreamGetParamsWithContext(ctx context.Context) *StreamGetParams { + return &StreamGetParams{ + Context: ctx, + } +} + +// NewStreamGetParamsWithHTTPClient creates a new StreamGetParams object +// with the ability to set a custom HTTPClient for a request. +func NewStreamGetParamsWithHTTPClient(client *http.Client) *StreamGetParams { + return &StreamGetParams{ + HTTPClient: client, + } +} + +/* +StreamGetParams contains all the parameters to send to the API endpoint + + for the stream get operation. + + Typically these are written to a http.Request. +*/ +type StreamGetParams struct { + + /* AccessToken. + + Access token for the requesting account. + */ + AccessToken string + + /* List. + + ID of the list to subscribe to. + Only used if stream type is 'list'. + */ + List *string + + /* Stream. + + Type of stream to request. + + Options are: + + `user`: receive updates for the account's home timeline. + `public`: receive updates for the public timeline. + `public:local`: receive updates for the local timeline. + `hashtag`: receive updates for a given hashtag. + `hashtag:local`: receive local updates for a given hashtag. + `list`: receive updates for a certain list of accounts. + `direct`: receive updates for direct messages. + */ + Stream string + + /* Tag. + + Name of the tag to subscribe to. + Only used if stream type is 'hashtag' or 'hashtag:local'. + */ + Tag *string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the stream get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StreamGetParams) WithDefaults() *StreamGetParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the stream get params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *StreamGetParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the stream get params +func (o *StreamGetParams) WithTimeout(timeout time.Duration) *StreamGetParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the stream get params +func (o *StreamGetParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the stream get params +func (o *StreamGetParams) WithContext(ctx context.Context) *StreamGetParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the stream get params +func (o *StreamGetParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the stream get params +func (o *StreamGetParams) WithHTTPClient(client *http.Client) *StreamGetParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the stream get params +func (o *StreamGetParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithAccessToken adds the accessToken to the stream get params +func (o *StreamGetParams) WithAccessToken(accessToken string) *StreamGetParams { + o.SetAccessToken(accessToken) + return o +} + +// SetAccessToken adds the accessToken to the stream get params +func (o *StreamGetParams) SetAccessToken(accessToken string) { + o.AccessToken = accessToken +} + +// WithList adds the list to the stream get params +func (o *StreamGetParams) WithList(list *string) *StreamGetParams { + o.SetList(list) + return o +} + +// SetList adds the list to the stream get params +func (o *StreamGetParams) SetList(list *string) { + o.List = list +} + +// WithStream adds the stream to the stream get params +func (o *StreamGetParams) WithStream(stream string) *StreamGetParams { + o.SetStream(stream) + return o +} + +// SetStream adds the stream to the stream get params +func (o *StreamGetParams) SetStream(stream string) { + o.Stream = stream +} + +// WithTag adds the tag to the stream get params +func (o *StreamGetParams) WithTag(tag *string) *StreamGetParams { + o.SetTag(tag) + return o +} + +// SetTag adds the tag to the stream get params +func (o *StreamGetParams) SetTag(tag *string) { + o.Tag = tag +} + +// WriteToRequest writes these params to a swagger request +func (o *StreamGetParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // query param access_token + qrAccessToken := o.AccessToken + qAccessToken := qrAccessToken + if qAccessToken != "" { + + if err := r.SetQueryParam("access_token", qAccessToken); err != nil { + return err + } + } + + if o.List != nil { + + // query param list + var qrList string + + if o.List != nil { + qrList = *o.List + } + qList := qrList + if qList != "" { + + if err := r.SetQueryParam("list", qList); err != nil { + return err + } + } + } + + // query param stream + qrStream := o.Stream + qStream := qrStream + if qStream != "" { + + if err := r.SetQueryParam("stream", qStream); err != nil { + return err + } + } + + if o.Tag != nil { + + // query param tag + var qrTag string + + if o.Tag != nil { + qrTag = *o.Tag + } + qTag := qrTag + if qTag != "" { + + if err := r.SetQueryParam("tag", qTag); err != nil { + return err + } + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/streaming/stream_get_responses.go b/client/streaming/stream_get_responses.go new file mode 100644 index 0000000..77cab35 --- /dev/null +++ b/client/streaming/stream_get_responses.go @@ -0,0 +1,389 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package streaming + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "encoding/json" + "fmt" + "io" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// StreamGetReader is a Reader for the StreamGet structure. +type StreamGetReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *StreamGetReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 101: + result := NewStreamGetSwitchingProtocols() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 400: + result := NewStreamGetBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewStreamGetUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/streaming] streamGet", response, response.Code()) + } +} + +// NewStreamGetSwitchingProtocols creates a StreamGetSwitchingProtocols with default headers values +func NewStreamGetSwitchingProtocols() *StreamGetSwitchingProtocols { + return &StreamGetSwitchingProtocols{} +} + +/* +StreamGetSwitchingProtocols describes a response with status code 101, with default header values. + +StreamGetSwitchingProtocols stream get switching protocols +*/ +type StreamGetSwitchingProtocols struct { + Payload *StreamGetSwitchingProtocolsBody +} + +// IsSuccess returns true when this stream get switching protocols response has a 2xx status code +func (o *StreamGetSwitchingProtocols) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this stream get switching protocols response has a 3xx status code +func (o *StreamGetSwitchingProtocols) IsRedirect() bool { + return false +} + +// IsClientError returns true when this stream get switching protocols response has a 4xx status code +func (o *StreamGetSwitchingProtocols) IsClientError() bool { + return false +} + +// IsServerError returns true when this stream get switching protocols response has a 5xx status code +func (o *StreamGetSwitchingProtocols) IsServerError() bool { + return false +} + +// IsCode returns true when this stream get switching protocols response a status code equal to that given +func (o *StreamGetSwitchingProtocols) IsCode(code int) bool { + return code == 101 +} + +// Code gets the status code for the stream get switching protocols response +func (o *StreamGetSwitchingProtocols) Code() int { + return 101 +} + +func (o *StreamGetSwitchingProtocols) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetSwitchingProtocols %s", 101, payload) +} + +func (o *StreamGetSwitchingProtocols) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetSwitchingProtocols %s", 101, payload) +} + +func (o *StreamGetSwitchingProtocols) GetPayload() *StreamGetSwitchingProtocolsBody { + return o.Payload +} + +func (o *StreamGetSwitchingProtocols) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(StreamGetSwitchingProtocolsBody) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewStreamGetBadRequest creates a StreamGetBadRequest with default headers values +func NewStreamGetBadRequest() *StreamGetBadRequest { + return &StreamGetBadRequest{} +} + +/* +StreamGetBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type StreamGetBadRequest struct { +} + +// IsSuccess returns true when this stream get bad request response has a 2xx status code +func (o *StreamGetBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this stream get bad request response has a 3xx status code +func (o *StreamGetBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this stream get bad request response has a 4xx status code +func (o *StreamGetBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this stream get bad request response has a 5xx status code +func (o *StreamGetBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this stream get bad request response a status code equal to that given +func (o *StreamGetBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the stream get bad request response +func (o *StreamGetBadRequest) Code() int { + return 400 +} + +func (o *StreamGetBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetBadRequest", 400) +} + +func (o *StreamGetBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetBadRequest", 400) +} + +func (o *StreamGetBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewStreamGetUnauthorized creates a StreamGetUnauthorized with default headers values +func NewStreamGetUnauthorized() *StreamGetUnauthorized { + return &StreamGetUnauthorized{} +} + +/* +StreamGetUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type StreamGetUnauthorized struct { +} + +// IsSuccess returns true when this stream get unauthorized response has a 2xx status code +func (o *StreamGetUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this stream get unauthorized response has a 3xx status code +func (o *StreamGetUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this stream get unauthorized response has a 4xx status code +func (o *StreamGetUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this stream get unauthorized response has a 5xx status code +func (o *StreamGetUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this stream get unauthorized response a status code equal to that given +func (o *StreamGetUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the stream get unauthorized response +func (o *StreamGetUnauthorized) Code() int { + return 401 +} + +func (o *StreamGetUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetUnauthorized", 401) +} + +func (o *StreamGetUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/streaming][%d] streamGetUnauthorized", 401) +} + +func (o *StreamGetUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +/* +StreamGetSwitchingProtocolsBody stream get switching protocols body +swagger:model StreamGetSwitchingProtocolsBody +*/ +type StreamGetSwitchingProtocolsBody struct { + + // The type of event being received. + // + // `update`: a new status has been received. + // `notification`: a new notification has been received. + // `delete`: a status has been deleted. + // `filters_changed`: filters (including keywords and statuses) have changed. + // Enum: ["update","notification","delete","filters_changed"] + Event string `json:"event,omitempty"` + + // The payload of the streamed message. + // Different depending on the `event` type. + // + // If present, it should be parsed as a string. + // + // If `event` = `update`, then the payload will be a JSON string of a status. + // If `event` = `notification`, then the payload will be a JSON string of a notification. + // If `event` = `delete`, then the payload will be a status ID. + // If `event` = `filters_changed`, then there is no payload. + // Example: {\"id\":\"01FC3TZ5CFG6H65GCKCJRKA669\",\"created_at\":\"2021-08-02T16:25:52Z\",\"sensitive\":false,\"spoiler_text\":\"\",\"visibility\":\"public\",\"language\":\"en\",\"uri\":\"https://gts.superseriousbusiness.org/users/dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"url\":\"https://gts.superseriousbusiness.org/@dumpsterqueer/statuses/01FC3TZ5CFG6H65GCKCJRKA669\",\"replies_count\":0,\"reblogs_count\":0,\"favourites_count\":0,\"favourited\":false,\"reblogged\":false,\"muted\":false,\"bookmarked\":fals…//gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/original/019036W043D8FXPJKSKCX7G965.png\",\"header_static\":\"https://gts.superseriousbusiness.org/fileserver/01JNN207W98SGG3CBJ76R5MVDN/header/small/019036W043D8FXPJKSKCX7G965.png\",\"followers_count\":33,\"following_count\":28,\"statuses_count\":126,\"last_status_at\":\"2021-08-02T16:25:52Z\",\"emojis\":[],\"fields\":[]},\"media_attachments\":[],\"mentions\":[],\"tags\":[],\"emojis\":[],\"card\":null,\"poll\":null,\"text\":\"a\"} + Payload string `json:"payload,omitempty"` + + // stream + Stream []string `json:"stream"` +} + +// Validate validates this stream get switching protocols body +func (o *StreamGetSwitchingProtocolsBody) Validate(formats strfmt.Registry) error { + var res []error + + if err := o.validateEvent(formats); err != nil { + res = append(res, err) + } + + if err := o.validateStream(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +var streamGetSwitchingProtocolsBodyTypeEventPropEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["update","notification","delete","filters_changed"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + streamGetSwitchingProtocolsBodyTypeEventPropEnum = append(streamGetSwitchingProtocolsBodyTypeEventPropEnum, v) + } +} + +const ( + + // StreamGetSwitchingProtocolsBodyEventUpdate captures enum value "update" + StreamGetSwitchingProtocolsBodyEventUpdate string = "update" + + // StreamGetSwitchingProtocolsBodyEventNotification captures enum value "notification" + StreamGetSwitchingProtocolsBodyEventNotification string = "notification" + + // StreamGetSwitchingProtocolsBodyEventDelete captures enum value "delete" + StreamGetSwitchingProtocolsBodyEventDelete string = "delete" + + // StreamGetSwitchingProtocolsBodyEventFiltersChanged captures enum value "filters_changed" + StreamGetSwitchingProtocolsBodyEventFiltersChanged string = "filters_changed" +) + +// prop value enum +func (o *StreamGetSwitchingProtocolsBody) validateEventEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, streamGetSwitchingProtocolsBodyTypeEventPropEnum, true); err != nil { + return err + } + return nil +} + +func (o *StreamGetSwitchingProtocolsBody) validateEvent(formats strfmt.Registry) error { + if swag.IsZero(o.Event) { // not required + return nil + } + + // value enum + if err := o.validateEventEnum("streamGetSwitchingProtocols"+"."+"event", "body", o.Event); err != nil { + return err + } + + return nil +} + +var streamGetSwitchingProtocolsBodyStreamItemsEnum []interface{} + +func init() { + var res []string + if err := json.Unmarshal([]byte(`["user","public","public:local","hashtag","hashtag:local","list","direct"]`), &res); err != nil { + panic(err) + } + for _, v := range res { + streamGetSwitchingProtocolsBodyStreamItemsEnum = append(streamGetSwitchingProtocolsBodyStreamItemsEnum, v) + } +} + +func (o *StreamGetSwitchingProtocolsBody) validateStreamItemsEnum(path, location string, value string) error { + if err := validate.EnumCase(path, location, value, streamGetSwitchingProtocolsBodyStreamItemsEnum, true); err != nil { + return err + } + return nil +} + +func (o *StreamGetSwitchingProtocolsBody) validateStream(formats strfmt.Registry) error { + if swag.IsZero(o.Stream) { // not required + return nil + } + + for i := 0; i < len(o.Stream); i++ { + + // value enum + if err := o.validateStreamItemsEnum("streamGetSwitchingProtocols"+"."+"stream"+"."+strconv.Itoa(i), "body", o.Stream[i]); err != nil { + return err + } + + } + + return nil +} + +// ContextValidate validates this stream get switching protocols body based on context it is used +func (o *StreamGetSwitchingProtocolsBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (o *StreamGetSwitchingProtocolsBody) MarshalBinary() ([]byte, error) { + if o == nil { + return nil, nil + } + return swag.WriteJSON(o) +} + +// UnmarshalBinary interface implementation +func (o *StreamGetSwitchingProtocolsBody) UnmarshalBinary(b []byte) error { + var res StreamGetSwitchingProtocolsBody + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *o = res + return nil +} diff --git a/client/streaming/streaming_client.go b/client/streaming/streaming_client.go new file mode 100644 index 0000000..9c9f6a4 --- /dev/null +++ b/client/streaming/streaming_client.go @@ -0,0 +1,107 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package streaming + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new streaming API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new streaming API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new streaming API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for streaming API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + StreamGet(params *StreamGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error + + SetTransport(transport runtime.ClientTransport) +} + +/* + StreamGet initiates a websocket connection for live streaming of statuses and notifications + + The scheme used should *always* be `wss`. The streaming basepath can be viewed at `/api/v1/instance`. + +On a successful connection, a code `101` will be returned, which indicates that the connection is being upgraded to a secure websocket connection. + +As long as the connection is open, various message types will be streamed into it. + +GoToSocial will ping the connection every 30 seconds to check whether the client is still receiving. + +If the ping fails, or something else goes wrong during transmission, then the connection will be dropped, and the client will be expected to start it again. +*/ +func (a *Client) StreamGet(params *StreamGetParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) error { + // TODO: Validate the params before sending + if params == nil { + params = NewStreamGetParams() + } + op := &runtime.ClientOperation{ + ID: "streamGet", + Method: "GET", + PathPattern: "/api/v1/streaming", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https", "wss"}, + Params: params, + Reader: &StreamGetReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + _, err := a.transport.Submit(op) + if err != nil { + return err + } + return nil +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/timelines/home_timeline_parameters.go b/client/timelines/home_timeline_parameters.go new file mode 100644 index 0000000..f7affdf --- /dev/null +++ b/client/timelines/home_timeline_parameters.go @@ -0,0 +1,316 @@ +// 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 +} diff --git a/client/timelines/home_timeline_responses.go b/client/timelines/home_timeline_responses.go new file mode 100644 index 0000000..6dc2b05 --- /dev/null +++ b/client/timelines/home_timeline_responses.go @@ -0,0 +1,240 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// HomeTimelineReader is a Reader for the HomeTimeline structure. +type HomeTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *HomeTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewHomeTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewHomeTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewHomeTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/home] homeTimeline", response, response.Code()) + } +} + +// NewHomeTimelineOK creates a HomeTimelineOK with default headers values +func NewHomeTimelineOK() *HomeTimelineOK { + return &HomeTimelineOK{} +} + +/* +HomeTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type HomeTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this home timeline o k response has a 2xx status code +func (o *HomeTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this home timeline o k response has a 3xx status code +func (o *HomeTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this home timeline o k response has a 4xx status code +func (o *HomeTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this home timeline o k response has a 5xx status code +func (o *HomeTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this home timeline o k response a status code equal to that given +func (o *HomeTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the home timeline o k response +func (o *HomeTimelineOK) Code() int { + return 200 +} + +func (o *HomeTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineOK %s", 200, payload) +} + +func (o *HomeTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineOK %s", 200, payload) +} + +func (o *HomeTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *HomeTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewHomeTimelineBadRequest creates a HomeTimelineBadRequest with default headers values +func NewHomeTimelineBadRequest() *HomeTimelineBadRequest { + return &HomeTimelineBadRequest{} +} + +/* +HomeTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type HomeTimelineBadRequest struct { +} + +// IsSuccess returns true when this home timeline bad request response has a 2xx status code +func (o *HomeTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this home timeline bad request response has a 3xx status code +func (o *HomeTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this home timeline bad request response has a 4xx status code +func (o *HomeTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this home timeline bad request response has a 5xx status code +func (o *HomeTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this home timeline bad request response a status code equal to that given +func (o *HomeTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the home timeline bad request response +func (o *HomeTimelineBadRequest) Code() int { + return 400 +} + +func (o *HomeTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineBadRequest", 400) +} + +func (o *HomeTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineBadRequest", 400) +} + +func (o *HomeTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewHomeTimelineUnauthorized creates a HomeTimelineUnauthorized with default headers values +func NewHomeTimelineUnauthorized() *HomeTimelineUnauthorized { + return &HomeTimelineUnauthorized{} +} + +/* +HomeTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type HomeTimelineUnauthorized struct { +} + +// IsSuccess returns true when this home timeline unauthorized response has a 2xx status code +func (o *HomeTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this home timeline unauthorized response has a 3xx status code +func (o *HomeTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this home timeline unauthorized response has a 4xx status code +func (o *HomeTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this home timeline unauthorized response has a 5xx status code +func (o *HomeTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this home timeline unauthorized response a status code equal to that given +func (o *HomeTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the home timeline unauthorized response +func (o *HomeTimelineUnauthorized) Code() int { + return 401 +} + +func (o *HomeTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineUnauthorized", 401) +} + +func (o *HomeTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/home][%d] homeTimelineUnauthorized", 401) +} + +func (o *HomeTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/timelines/list_timeline_parameters.go b/client/timelines/list_timeline_parameters.go new file mode 100644 index 0000000..b01b033 --- /dev/null +++ b/client/timelines/list_timeline_parameters.go @@ -0,0 +1,301 @@ +// 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" +) + +// NewListTimelineParams creates a new ListTimelineParams 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 NewListTimelineParams() *ListTimelineParams { + return &ListTimelineParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewListTimelineParamsWithTimeout creates a new ListTimelineParams object +// with the ability to set a timeout on a request. +func NewListTimelineParamsWithTimeout(timeout time.Duration) *ListTimelineParams { + return &ListTimelineParams{ + timeout: timeout, + } +} + +// NewListTimelineParamsWithContext creates a new ListTimelineParams object +// with the ability to set a context for a request. +func NewListTimelineParamsWithContext(ctx context.Context) *ListTimelineParams { + return &ListTimelineParams{ + Context: ctx, + } +} + +// NewListTimelineParamsWithHTTPClient creates a new ListTimelineParams object +// with the ability to set a custom HTTPClient for a request. +func NewListTimelineParamsWithHTTPClient(client *http.Client) *ListTimelineParams { + return &ListTimelineParams{ + HTTPClient: client, + } +} + +/* +ListTimelineParams contains all the parameters to send to the API endpoint + + for the list timeline operation. + + Typically these are written to a http.Request. +*/ +type ListTimelineParams struct { + + /* ID. + + ID of the list + */ + ID string + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* 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 *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 list timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTimelineParams) WithDefaults() *ListTimelineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the list timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *ListTimelineParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := ListTimelineParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the list timeline params +func (o *ListTimelineParams) WithTimeout(timeout time.Duration) *ListTimelineParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the list timeline params +func (o *ListTimelineParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the list timeline params +func (o *ListTimelineParams) WithContext(ctx context.Context) *ListTimelineParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the list timeline params +func (o *ListTimelineParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the list timeline params +func (o *ListTimelineParams) WithHTTPClient(client *http.Client) *ListTimelineParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the list timeline params +func (o *ListTimelineParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithID adds the id to the list timeline params +func (o *ListTimelineParams) WithID(id string) *ListTimelineParams { + o.SetID(id) + return o +} + +// SetID adds the id to the list timeline params +func (o *ListTimelineParams) SetID(id string) { + o.ID = id +} + +// WithLimit adds the limit to the list timeline params +func (o *ListTimelineParams) WithLimit(limit *int64) *ListTimelineParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the list timeline params +func (o *ListTimelineParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the list timeline params +func (o *ListTimelineParams) WithMaxID(maxID *string) *ListTimelineParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the list timeline params +func (o *ListTimelineParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the list timeline params +func (o *ListTimelineParams) WithMinID(minID *string) *ListTimelineParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the list timeline params +func (o *ListTimelineParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the list timeline params +func (o *ListTimelineParams) WithSinceID(sinceID *string) *ListTimelineParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the list timeline params +func (o *ListTimelineParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *ListTimelineParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // path param id + if err := r.SetPathParam("id", o.ID); err != nil { + return err + } + + 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.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 +} diff --git a/client/timelines/list_timeline_responses.go b/client/timelines/list_timeline_responses.go new file mode 100644 index 0000000..ca26ab7 --- /dev/null +++ b/client/timelines/list_timeline_responses.go @@ -0,0 +1,240 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// ListTimelineReader is a Reader for the ListTimeline structure. +type ListTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *ListTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewListTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewListTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewListTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/list/{id}] listTimeline", response, response.Code()) + } +} + +// NewListTimelineOK creates a ListTimelineOK with default headers values +func NewListTimelineOK() *ListTimelineOK { + return &ListTimelineOK{} +} + +/* +ListTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type ListTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this list timeline o k response has a 2xx status code +func (o *ListTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this list timeline o k response has a 3xx status code +func (o *ListTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list timeline o k response has a 4xx status code +func (o *ListTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this list timeline o k response has a 5xx status code +func (o *ListTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this list timeline o k response a status code equal to that given +func (o *ListTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the list timeline o k response +func (o *ListTimelineOK) Code() int { + return 200 +} + +func (o *ListTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineOK %s", 200, payload) +} + +func (o *ListTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineOK %s", 200, payload) +} + +func (o *ListTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *ListTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewListTimelineBadRequest creates a ListTimelineBadRequest with default headers values +func NewListTimelineBadRequest() *ListTimelineBadRequest { + return &ListTimelineBadRequest{} +} + +/* +ListTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type ListTimelineBadRequest struct { +} + +// IsSuccess returns true when this list timeline bad request response has a 2xx status code +func (o *ListTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list timeline bad request response has a 3xx status code +func (o *ListTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list timeline bad request response has a 4xx status code +func (o *ListTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this list timeline bad request response has a 5xx status code +func (o *ListTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this list timeline bad request response a status code equal to that given +func (o *ListTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the list timeline bad request response +func (o *ListTimelineBadRequest) Code() int { + return 400 +} + +func (o *ListTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineBadRequest", 400) +} + +func (o *ListTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineBadRequest", 400) +} + +func (o *ListTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewListTimelineUnauthorized creates a ListTimelineUnauthorized with default headers values +func NewListTimelineUnauthorized() *ListTimelineUnauthorized { + return &ListTimelineUnauthorized{} +} + +/* +ListTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type ListTimelineUnauthorized struct { +} + +// IsSuccess returns true when this list timeline unauthorized response has a 2xx status code +func (o *ListTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this list timeline unauthorized response has a 3xx status code +func (o *ListTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this list timeline unauthorized response has a 4xx status code +func (o *ListTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this list timeline unauthorized response has a 5xx status code +func (o *ListTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this list timeline unauthorized response a status code equal to that given +func (o *ListTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the list timeline unauthorized response +func (o *ListTimelineUnauthorized) Code() int { + return 401 +} + +func (o *ListTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineUnauthorized", 401) +} + +func (o *ListTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/list/{id}][%d] listTimelineUnauthorized", 401) +} + +func (o *ListTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/timelines/public_timeline_parameters.go b/client/timelines/public_timeline_parameters.go new file mode 100644 index 0000000..5f92648 --- /dev/null +++ b/client/timelines/public_timeline_parameters.go @@ -0,0 +1,316 @@ +// 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" +) + +// NewPublicTimelineParams creates a new PublicTimelineParams 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 NewPublicTimelineParams() *PublicTimelineParams { + return &PublicTimelineParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewPublicTimelineParamsWithTimeout creates a new PublicTimelineParams object +// with the ability to set a timeout on a request. +func NewPublicTimelineParamsWithTimeout(timeout time.Duration) *PublicTimelineParams { + return &PublicTimelineParams{ + timeout: timeout, + } +} + +// NewPublicTimelineParamsWithContext creates a new PublicTimelineParams object +// with the ability to set a context for a request. +func NewPublicTimelineParamsWithContext(ctx context.Context) *PublicTimelineParams { + return &PublicTimelineParams{ + Context: ctx, + } +} + +// NewPublicTimelineParamsWithHTTPClient creates a new PublicTimelineParams object +// with the ability to set a custom HTTPClient for a request. +func NewPublicTimelineParamsWithHTTPClient(client *http.Client) *PublicTimelineParams { + return &PublicTimelineParams{ + HTTPClient: client, + } +} + +/* +PublicTimelineParams contains all the parameters to send to the API endpoint + + for the public timeline operation. + + Typically these are written to a http.Request. +*/ +type PublicTimelineParams 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 *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 public timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PublicTimelineParams) WithDefaults() *PublicTimelineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the public timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *PublicTimelineParams) SetDefaults() { + var ( + limitDefault = int64(20) + + localDefault = bool(false) + ) + + val := PublicTimelineParams{ + Limit: &limitDefault, + Local: &localDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the public timeline params +func (o *PublicTimelineParams) WithTimeout(timeout time.Duration) *PublicTimelineParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the public timeline params +func (o *PublicTimelineParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the public timeline params +func (o *PublicTimelineParams) WithContext(ctx context.Context) *PublicTimelineParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the public timeline params +func (o *PublicTimelineParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the public timeline params +func (o *PublicTimelineParams) WithHTTPClient(client *http.Client) *PublicTimelineParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the public timeline params +func (o *PublicTimelineParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the public timeline params +func (o *PublicTimelineParams) WithLimit(limit *int64) *PublicTimelineParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the public timeline params +func (o *PublicTimelineParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithLocal adds the local to the public timeline params +func (o *PublicTimelineParams) WithLocal(local *bool) *PublicTimelineParams { + o.SetLocal(local) + return o +} + +// SetLocal adds the local to the public timeline params +func (o *PublicTimelineParams) SetLocal(local *bool) { + o.Local = local +} + +// WithMaxID adds the maxID to the public timeline params +func (o *PublicTimelineParams) WithMaxID(maxID *string) *PublicTimelineParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the public timeline params +func (o *PublicTimelineParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the public timeline params +func (o *PublicTimelineParams) WithMinID(minID *string) *PublicTimelineParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the public timeline params +func (o *PublicTimelineParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the public timeline params +func (o *PublicTimelineParams) WithSinceID(sinceID *string) *PublicTimelineParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the public timeline params +func (o *PublicTimelineParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WriteToRequest writes these params to a swagger request +func (o *PublicTimelineParams) 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 +} diff --git a/client/timelines/public_timeline_responses.go b/client/timelines/public_timeline_responses.go new file mode 100644 index 0000000..e1e336c --- /dev/null +++ b/client/timelines/public_timeline_responses.go @@ -0,0 +1,240 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// PublicTimelineReader is a Reader for the PublicTimeline structure. +type PublicTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *PublicTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewPublicTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewPublicTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewPublicTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/public] publicTimeline", response, response.Code()) + } +} + +// NewPublicTimelineOK creates a PublicTimelineOK with default headers values +func NewPublicTimelineOK() *PublicTimelineOK { + return &PublicTimelineOK{} +} + +/* +PublicTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type PublicTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this public timeline o k response has a 2xx status code +func (o *PublicTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this public timeline o k response has a 3xx status code +func (o *PublicTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this public timeline o k response has a 4xx status code +func (o *PublicTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this public timeline o k response has a 5xx status code +func (o *PublicTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this public timeline o k response a status code equal to that given +func (o *PublicTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the public timeline o k response +func (o *PublicTimelineOK) Code() int { + return 200 +} + +func (o *PublicTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineOK %s", 200, payload) +} + +func (o *PublicTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineOK %s", 200, payload) +} + +func (o *PublicTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *PublicTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewPublicTimelineBadRequest creates a PublicTimelineBadRequest with default headers values +func NewPublicTimelineBadRequest() *PublicTimelineBadRequest { + return &PublicTimelineBadRequest{} +} + +/* +PublicTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type PublicTimelineBadRequest struct { +} + +// IsSuccess returns true when this public timeline bad request response has a 2xx status code +func (o *PublicTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this public timeline bad request response has a 3xx status code +func (o *PublicTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this public timeline bad request response has a 4xx status code +func (o *PublicTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this public timeline bad request response has a 5xx status code +func (o *PublicTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this public timeline bad request response a status code equal to that given +func (o *PublicTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the public timeline bad request response +func (o *PublicTimelineBadRequest) Code() int { + return 400 +} + +func (o *PublicTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineBadRequest", 400) +} + +func (o *PublicTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineBadRequest", 400) +} + +func (o *PublicTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewPublicTimelineUnauthorized creates a PublicTimelineUnauthorized with default headers values +func NewPublicTimelineUnauthorized() *PublicTimelineUnauthorized { + return &PublicTimelineUnauthorized{} +} + +/* +PublicTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type PublicTimelineUnauthorized struct { +} + +// IsSuccess returns true when this public timeline unauthorized response has a 2xx status code +func (o *PublicTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this public timeline unauthorized response has a 3xx status code +func (o *PublicTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this public timeline unauthorized response has a 4xx status code +func (o *PublicTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this public timeline unauthorized response has a 5xx status code +func (o *PublicTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this public timeline unauthorized response a status code equal to that given +func (o *PublicTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the public timeline unauthorized response +func (o *PublicTimelineUnauthorized) Code() int { + return 401 +} + +func (o *PublicTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineUnauthorized", 401) +} + +func (o *PublicTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/public][%d] publicTimelineUnauthorized", 401) +} + +func (o *PublicTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/timelines/tag_timeline_parameters.go b/client/timelines/tag_timeline_parameters.go new file mode 100644 index 0000000..f25f2a1 --- /dev/null +++ b/client/timelines/tag_timeline_parameters.go @@ -0,0 +1,301 @@ +// 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" +) + +// NewTagTimelineParams creates a new TagTimelineParams 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 NewTagTimelineParams() *TagTimelineParams { + return &TagTimelineParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewTagTimelineParamsWithTimeout creates a new TagTimelineParams object +// with the ability to set a timeout on a request. +func NewTagTimelineParamsWithTimeout(timeout time.Duration) *TagTimelineParams { + return &TagTimelineParams{ + timeout: timeout, + } +} + +// NewTagTimelineParamsWithContext creates a new TagTimelineParams object +// with the ability to set a context for a request. +func NewTagTimelineParamsWithContext(ctx context.Context) *TagTimelineParams { + return &TagTimelineParams{ + Context: ctx, + } +} + +// NewTagTimelineParamsWithHTTPClient creates a new TagTimelineParams object +// with the ability to set a custom HTTPClient for a request. +func NewTagTimelineParamsWithHTTPClient(client *http.Client) *TagTimelineParams { + return &TagTimelineParams{ + HTTPClient: client, + } +} + +/* +TagTimelineParams contains all the parameters to send to the API endpoint + + for the tag timeline operation. + + Typically these are written to a http.Request. +*/ +type TagTimelineParams struct { + + /* Limit. + + Number of statuses to return. + + Default: 20 + */ + Limit *int64 + + /* 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 + + /* TagName. + + Name of the tag + */ + TagName string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the tag timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TagTimelineParams) WithDefaults() *TagTimelineParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the tag timeline params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *TagTimelineParams) SetDefaults() { + var ( + limitDefault = int64(20) + ) + + val := TagTimelineParams{ + Limit: &limitDefault, + } + + val.timeout = o.timeout + val.Context = o.Context + val.HTTPClient = o.HTTPClient + *o = val +} + +// WithTimeout adds the timeout to the tag timeline params +func (o *TagTimelineParams) WithTimeout(timeout time.Duration) *TagTimelineParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the tag timeline params +func (o *TagTimelineParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the tag timeline params +func (o *TagTimelineParams) WithContext(ctx context.Context) *TagTimelineParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the tag timeline params +func (o *TagTimelineParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the tag timeline params +func (o *TagTimelineParams) WithHTTPClient(client *http.Client) *TagTimelineParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the tag timeline params +func (o *TagTimelineParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithLimit adds the limit to the tag timeline params +func (o *TagTimelineParams) WithLimit(limit *int64) *TagTimelineParams { + o.SetLimit(limit) + return o +} + +// SetLimit adds the limit to the tag timeline params +func (o *TagTimelineParams) SetLimit(limit *int64) { + o.Limit = limit +} + +// WithMaxID adds the maxID to the tag timeline params +func (o *TagTimelineParams) WithMaxID(maxID *string) *TagTimelineParams { + o.SetMaxID(maxID) + return o +} + +// SetMaxID adds the maxId to the tag timeline params +func (o *TagTimelineParams) SetMaxID(maxID *string) { + o.MaxID = maxID +} + +// WithMinID adds the minID to the tag timeline params +func (o *TagTimelineParams) WithMinID(minID *string) *TagTimelineParams { + o.SetMinID(minID) + return o +} + +// SetMinID adds the minId to the tag timeline params +func (o *TagTimelineParams) SetMinID(minID *string) { + o.MinID = minID +} + +// WithSinceID adds the sinceID to the tag timeline params +func (o *TagTimelineParams) WithSinceID(sinceID *string) *TagTimelineParams { + o.SetSinceID(sinceID) + return o +} + +// SetSinceID adds the sinceId to the tag timeline params +func (o *TagTimelineParams) SetSinceID(sinceID *string) { + o.SinceID = sinceID +} + +// WithTagName adds the tagName to the tag timeline params +func (o *TagTimelineParams) WithTagName(tagName string) *TagTimelineParams { + o.SetTagName(tagName) + return o +} + +// SetTagName adds the tagName to the tag timeline params +func (o *TagTimelineParams) SetTagName(tagName string) { + o.TagName = tagName +} + +// WriteToRequest writes these params to a swagger request +func (o *TagTimelineParams) 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.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 + } + } + } + + // path param tag_name + if err := r.SetPathParam("tag_name", o.TagName); err != nil { + return err + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/timelines/tag_timeline_responses.go b/client/timelines/tag_timeline_responses.go new file mode 100644 index 0000000..85f8799 --- /dev/null +++ b/client/timelines/tag_timeline_responses.go @@ -0,0 +1,240 @@ +// 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 ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// TagTimelineReader is a Reader for the TagTimeline structure. +type TagTimelineReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *TagTimelineReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewTagTimelineOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewTagTimelineBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewTagTimelineUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/timelines/tag/{tag_name}] tagTimeline", response, response.Code()) + } +} + +// NewTagTimelineOK creates a TagTimelineOK with default headers values +func NewTagTimelineOK() *TagTimelineOK { + return &TagTimelineOK{} +} + +/* +TagTimelineOK describes a response with status code 200, with default header values. + +Array of statuses. +*/ +type TagTimelineOK struct { + + /* Links to the next and previous queries. + */ + Link string + + Payload []*models.Status +} + +// IsSuccess returns true when this tag timeline o k response has a 2xx status code +func (o *TagTimelineOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this tag timeline o k response has a 3xx status code +func (o *TagTimelineOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tag timeline o k response has a 4xx status code +func (o *TagTimelineOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this tag timeline o k response has a 5xx status code +func (o *TagTimelineOK) IsServerError() bool { + return false +} + +// IsCode returns true when this tag timeline o k response a status code equal to that given +func (o *TagTimelineOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the tag timeline o k response +func (o *TagTimelineOK) Code() int { + return 200 +} + +func (o *TagTimelineOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineOK %s", 200, payload) +} + +func (o *TagTimelineOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineOK %s", 200, payload) +} + +func (o *TagTimelineOK) GetPayload() []*models.Status { + return o.Payload +} + +func (o *TagTimelineOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + // hydrates response header Link + hdrLink := response.GetHeader("Link") + + if hdrLink != "" { + o.Link = hdrLink + } + + // response payload + if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewTagTimelineBadRequest creates a TagTimelineBadRequest with default headers values +func NewTagTimelineBadRequest() *TagTimelineBadRequest { + return &TagTimelineBadRequest{} +} + +/* +TagTimelineBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type TagTimelineBadRequest struct { +} + +// IsSuccess returns true when this tag timeline bad request response has a 2xx status code +func (o *TagTimelineBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this tag timeline bad request response has a 3xx status code +func (o *TagTimelineBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tag timeline bad request response has a 4xx status code +func (o *TagTimelineBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this tag timeline bad request response has a 5xx status code +func (o *TagTimelineBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this tag timeline bad request response a status code equal to that given +func (o *TagTimelineBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the tag timeline bad request response +func (o *TagTimelineBadRequest) Code() int { + return 400 +} + +func (o *TagTimelineBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineBadRequest", 400) +} + +func (o *TagTimelineBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineBadRequest", 400) +} + +func (o *TagTimelineBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewTagTimelineUnauthorized creates a TagTimelineUnauthorized with default headers values +func NewTagTimelineUnauthorized() *TagTimelineUnauthorized { + return &TagTimelineUnauthorized{} +} + +/* +TagTimelineUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type TagTimelineUnauthorized struct { +} + +// IsSuccess returns true when this tag timeline unauthorized response has a 2xx status code +func (o *TagTimelineUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this tag timeline unauthorized response has a 3xx status code +func (o *TagTimelineUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this tag timeline unauthorized response has a 4xx status code +func (o *TagTimelineUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this tag timeline unauthorized response has a 5xx status code +func (o *TagTimelineUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this tag timeline unauthorized response a status code equal to that given +func (o *TagTimelineUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the tag timeline unauthorized response +func (o *TagTimelineUnauthorized) Code() int { + return 401 +} + +func (o *TagTimelineUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineUnauthorized", 401) +} + +func (o *TagTimelineUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/timelines/tag/{tag_name}][%d] tagTimelineUnauthorized", 401) +} + +func (o *TagTimelineUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/timelines/timelines_client.go b/client/timelines/timelines_client.go new file mode 100644 index 0000000..6ee741a --- /dev/null +++ b/client/timelines/timelines_client.go @@ -0,0 +1,269 @@ +// 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 ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new timelines API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new timelines API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new timelines API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for timelines API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// ClientService is the interface for Client methods +type ClientService interface { + HomeTimeline(params *HomeTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HomeTimelineOK, error) + + ListTimeline(params *ListTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTimelineOK, error) + + PublicTimeline(params *PublicTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PublicTimelineOK, error) + + TagTimeline(params *TagTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TagTimelineOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* + HomeTimeline sees statuses posts by accounts you follow + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) HomeTimeline(params *HomeTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*HomeTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewHomeTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "homeTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/home", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &HomeTimelineReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*HomeTimelineOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for homeTimeline: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + ListTimeline sees statuses posts from the given list timeline + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) ListTimeline(params *ListTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*ListTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewListTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "listTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/list/{id}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &ListTimelineReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*ListTimelineOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for listTimeline: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + PublicTimeline sees public statuses posts that your instance is aware of + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) PublicTimeline(params *PublicTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*PublicTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewPublicTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "publicTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/public", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &PublicTimelineReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*PublicTimelineOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for publicTimeline: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + TagTimeline sees public statuses that use the given hashtag case insensitive + + The statuses will be returned in descending chronological order (newest first), with sequential IDs (bigger = newer). + +The returned Link header can be used to generate the previous and next queries when scrolling up or down a timeline. + +Example: + +``` +; rel="next", ; rel="prev" +```` +*/ +func (a *Client) TagTimeline(params *TagTimelineParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*TagTimelineOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewTagTimelineParams() + } + op := &runtime.ClientOperation{ + ID: "tagTimeline", + Method: "GET", + PathPattern: "/api/v1/timelines/tag/{tag_name}", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &TagTimelineReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*TagTimelineOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for tagTimeline: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/user/get_user_parameters.go b/client/user/get_user_parameters.go new file mode 100644 index 0000000..31920e4 --- /dev/null +++ b/client/user/get_user_parameters.go @@ -0,0 +1,128 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewGetUserParams creates a new GetUserParams 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 NewGetUserParams() *GetUserParams { + return &GetUserParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewGetUserParamsWithTimeout creates a new GetUserParams object +// with the ability to set a timeout on a request. +func NewGetUserParamsWithTimeout(timeout time.Duration) *GetUserParams { + return &GetUserParams{ + timeout: timeout, + } +} + +// NewGetUserParamsWithContext creates a new GetUserParams object +// with the ability to set a context for a request. +func NewGetUserParamsWithContext(ctx context.Context) *GetUserParams { + return &GetUserParams{ + Context: ctx, + } +} + +// NewGetUserParamsWithHTTPClient creates a new GetUserParams object +// with the ability to set a custom HTTPClient for a request. +func NewGetUserParamsWithHTTPClient(client *http.Client) *GetUserParams { + return &GetUserParams{ + HTTPClient: client, + } +} + +/* +GetUserParams contains all the parameters to send to the API endpoint + + for the get user operation. + + Typically these are written to a http.Request. +*/ +type GetUserParams struct { + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserParams) WithDefaults() *GetUserParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the get user params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *GetUserParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the get user params +func (o *GetUserParams) WithTimeout(timeout time.Duration) *GetUserParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the get user params +func (o *GetUserParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the get user params +func (o *GetUserParams) WithContext(ctx context.Context) *GetUserParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the get user params +func (o *GetUserParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the get user params +func (o *GetUserParams) WithHTTPClient(client *http.Client) *GetUserParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the get user params +func (o *GetUserParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WriteToRequest writes these params to a swagger request +func (o *GetUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/get_user_responses.go b/client/user/get_user_responses.go new file mode 100644 index 0000000..c810c34 --- /dev/null +++ b/client/user/get_user_responses.go @@ -0,0 +1,416 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// GetUserReader is a Reader for the GetUser structure. +type GetUserReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *GetUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewGetUserOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewGetUserBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewGetUserUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewGetUserForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewGetUserNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewGetUserInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[GET /api/v1/user] getUser", response, response.Code()) + } +} + +// NewGetUserOK creates a GetUserOK with default headers values +func NewGetUserOK() *GetUserOK { + return &GetUserOK{} +} + +/* +GetUserOK describes a response with status code 200, with default header values. + +The requested user. +*/ +type GetUserOK struct { + Payload *models.User +} + +// IsSuccess returns true when this get user o k response has a 2xx status code +func (o *GetUserOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this get user o k response has a 3xx status code +func (o *GetUserOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user o k response has a 4xx status code +func (o *GetUserOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this get user o k response has a 5xx status code +func (o *GetUserOK) IsServerError() bool { + return false +} + +// IsCode returns true when this get user o k response a status code equal to that given +func (o *GetUserOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the get user o k response +func (o *GetUserOK) Code() int { + return 200 +} + +func (o *GetUserOK) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/user][%d] getUserOK %s", 200, payload) +} + +func (o *GetUserOK) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[GET /api/v1/user][%d] getUserOK %s", 200, payload) +} + +func (o *GetUserOK) GetPayload() *models.User { + return o.Payload +} + +func (o *GetUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.User) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewGetUserBadRequest creates a GetUserBadRequest with default headers values +func NewGetUserBadRequest() *GetUserBadRequest { + return &GetUserBadRequest{} +} + +/* +GetUserBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type GetUserBadRequest struct { +} + +// IsSuccess returns true when this get user bad request response has a 2xx status code +func (o *GetUserBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user bad request response has a 3xx status code +func (o *GetUserBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user bad request response has a 4xx status code +func (o *GetUserBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user bad request response has a 5xx status code +func (o *GetUserBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this get user bad request response a status code equal to that given +func (o *GetUserBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the get user bad request response +func (o *GetUserBadRequest) Code() int { + return 400 +} + +func (o *GetUserBadRequest) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserBadRequest", 400) +} + +func (o *GetUserBadRequest) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserBadRequest", 400) +} + +func (o *GetUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserUnauthorized creates a GetUserUnauthorized with default headers values +func NewGetUserUnauthorized() *GetUserUnauthorized { + return &GetUserUnauthorized{} +} + +/* +GetUserUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type GetUserUnauthorized struct { +} + +// IsSuccess returns true when this get user unauthorized response has a 2xx status code +func (o *GetUserUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user unauthorized response has a 3xx status code +func (o *GetUserUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user unauthorized response has a 4xx status code +func (o *GetUserUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user unauthorized response has a 5xx status code +func (o *GetUserUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this get user unauthorized response a status code equal to that given +func (o *GetUserUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the get user unauthorized response +func (o *GetUserUnauthorized) Code() int { + return 401 +} + +func (o *GetUserUnauthorized) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserUnauthorized", 401) +} + +func (o *GetUserUnauthorized) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserUnauthorized", 401) +} + +func (o *GetUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserForbidden creates a GetUserForbidden with default headers values +func NewGetUserForbidden() *GetUserForbidden { + return &GetUserForbidden{} +} + +/* +GetUserForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type GetUserForbidden struct { +} + +// IsSuccess returns true when this get user forbidden response has a 2xx status code +func (o *GetUserForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user forbidden response has a 3xx status code +func (o *GetUserForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user forbidden response has a 4xx status code +func (o *GetUserForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user forbidden response has a 5xx status code +func (o *GetUserForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this get user forbidden response a status code equal to that given +func (o *GetUserForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the get user forbidden response +func (o *GetUserForbidden) Code() int { + return 403 +} + +func (o *GetUserForbidden) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserForbidden", 403) +} + +func (o *GetUserForbidden) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserForbidden", 403) +} + +func (o *GetUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserNotAcceptable creates a GetUserNotAcceptable with default headers values +func NewGetUserNotAcceptable() *GetUserNotAcceptable { + return &GetUserNotAcceptable{} +} + +/* +GetUserNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type GetUserNotAcceptable struct { +} + +// IsSuccess returns true when this get user not acceptable response has a 2xx status code +func (o *GetUserNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user not acceptable response has a 3xx status code +func (o *GetUserNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user not acceptable response has a 4xx status code +func (o *GetUserNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this get user not acceptable response has a 5xx status code +func (o *GetUserNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this get user not acceptable response a status code equal to that given +func (o *GetUserNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the get user not acceptable response +func (o *GetUserNotAcceptable) Code() int { + return 406 +} + +func (o *GetUserNotAcceptable) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserNotAcceptable", 406) +} + +func (o *GetUserNotAcceptable) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserNotAcceptable", 406) +} + +func (o *GetUserNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewGetUserInternalServerError creates a GetUserInternalServerError with default headers values +func NewGetUserInternalServerError() *GetUserInternalServerError { + return &GetUserInternalServerError{} +} + +/* +GetUserInternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type GetUserInternalServerError struct { +} + +// IsSuccess returns true when this get user internal server error response has a 2xx status code +func (o *GetUserInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this get user internal server error response has a 3xx status code +func (o *GetUserInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this get user internal server error response has a 4xx status code +func (o *GetUserInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this get user internal server error response has a 5xx status code +func (o *GetUserInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this get user internal server error response a status code equal to that given +func (o *GetUserInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the get user internal server error response +func (o *GetUserInternalServerError) Code() int { + return 500 +} + +func (o *GetUserInternalServerError) Error() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserInternalServerError", 500) +} + +func (o *GetUserInternalServerError) String() string { + return fmt.Sprintf("[GET /api/v1/user][%d] getUserInternalServerError", 500) +} + +func (o *GetUserInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/user/user_client.go b/client/user/user_client.go new file mode 100644 index 0000000..30367b7 --- /dev/null +++ b/client/user/user_client.go @@ -0,0 +1,221 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + httptransport "github.com/go-openapi/runtime/client" + "github.com/go-openapi/strfmt" +) + +// New creates a new user API client. +func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { + return &Client{transport: transport, formats: formats} +} + +// New creates a new user API client with basic auth credentials. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - user: user for basic authentication header. +// - password: password for basic authentication header. +func NewClientWithBasicAuth(host, basePath, scheme, user, password string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BasicAuth(user, password) + return &Client{transport: transport, formats: strfmt.Default} +} + +// New creates a new user API client with a bearer token for authentication. +// It takes the following parameters: +// - host: http host (github.com). +// - basePath: any base path for the API client ("/v1", "/v3"). +// - scheme: http scheme ("http", "https"). +// - bearerToken: bearer token for Bearer authentication header. +func NewClientWithBearerToken(host, basePath, scheme, bearerToken string) ClientService { + transport := httptransport.New(host, basePath, []string{scheme}) + transport.DefaultAuthentication = httptransport.BearerToken(bearerToken) + return &Client{transport: transport, formats: strfmt.Default} +} + +/* +Client for user API +*/ +type Client struct { + transport runtime.ClientTransport + formats strfmt.Registry +} + +// ClientOption may be used to customize the behavior of Client methods. +type ClientOption func(*runtime.ClientOperation) + +// This client is generated with a few options you might find useful for your swagger spec. +// +// Feel free to add you own set of options. + +// WithContentType allows the client to force the Content-Type header +// to negotiate a specific Consumer from the server. +// +// You may use this option to set arbitrary extensions to your MIME media type. +func WithContentType(mime string) ClientOption { + return func(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{mime} + } +} + +// WithContentTypeApplicationJSON sets the Content-Type header to "application/json". +func WithContentTypeApplicationJSON(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/json"} +} + +// WithContentTypeApplicationxWwwFormUrlencoded sets the Content-Type header to "application/x-www-form-urlencoded". +func WithContentTypeApplicationxWwwFormUrlencoded(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/x-www-form-urlencoded"} +} + +// WithContentTypeApplicationXML sets the Content-Type header to "application/xml". +func WithContentTypeApplicationXML(r *runtime.ClientOperation) { + r.ConsumesMediaTypes = []string{"application/xml"} +} + +// ClientService is the interface for Client methods +type ClientService interface { + GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) + + UserEmailChange(params *UserEmailChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserEmailChangeAccepted, error) + + UserPasswordChange(params *UserPasswordChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserPasswordChangeOK, error) + + SetTransport(transport runtime.ClientTransport) +} + +/* +GetUser gets your own user model +*/ +func (a *Client) GetUser(params *GetUserParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*GetUserOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewGetUserParams() + } + op := &runtime.ClientOperation{ + ID: "getUser", + Method: "GET", + PathPattern: "/api/v1/user", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &GetUserReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*GetUserOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for getUser: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* +UserEmailChange requests changing the email address of authenticated user +*/ +func (a *Client) UserEmailChange(params *UserEmailChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserEmailChangeAccepted, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserEmailChangeParams() + } + op := &runtime.ClientOperation{ + ID: "userEmailChange", + Method: "POST", + PathPattern: "/api/v1/user/email_change", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserEmailChangeReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserEmailChangeAccepted) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for userEmailChange: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +/* + UserPasswordChange changes the password of authenticated user + + The parameters can also be given in the body of the request, as JSON, if the content-type is set to 'application/json'. + +The parameters can also be given in the body of the request, as XML, if the content-type is set to 'application/xml'. +*/ +func (a *Client) UserPasswordChange(params *UserPasswordChangeParams, authInfo runtime.ClientAuthInfoWriter, opts ...ClientOption) (*UserPasswordChangeOK, error) { + // TODO: Validate the params before sending + if params == nil { + params = NewUserPasswordChangeParams() + } + op := &runtime.ClientOperation{ + ID: "userPasswordChange", + Method: "POST", + PathPattern: "/api/v1/user/password_change", + ProducesMediaTypes: []string{"application/json"}, + ConsumesMediaTypes: []string{"application/json", "application/xml", "application/x-www-form-urlencoded"}, + Schemes: []string{"http", "https"}, + Params: params, + Reader: &UserPasswordChangeReader{formats: a.formats}, + AuthInfo: authInfo, + Context: params.Context, + Client: params.HTTPClient, + } + for _, opt := range opts { + opt(op) + } + + result, err := a.transport.Submit(op) + if err != nil { + return nil, err + } + success, ok := result.(*UserPasswordChangeOK) + if ok { + return success, nil + } + // unexpected success response + // safeguard: normally, absent a default response, unknown success responses return an error above: so this is a codegen issue + msg := fmt.Sprintf("unexpected success response for userPasswordChange: API contract not enforced by server. Client expected to get an error, but got: %T", result) + panic(msg) +} + +// SetTransport changes the transport on the client +func (a *Client) SetTransport(transport runtime.ClientTransport) { + a.transport = transport +} diff --git a/client/user/user_email_change_parameters.go b/client/user/user_email_change_parameters.go new file mode 100644 index 0000000..0809a4a --- /dev/null +++ b/client/user/user_email_change_parameters.go @@ -0,0 +1,181 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewUserEmailChangeParams creates a new UserEmailChangeParams 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 NewUserEmailChangeParams() *UserEmailChangeParams { + return &UserEmailChangeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserEmailChangeParamsWithTimeout creates a new UserEmailChangeParams object +// with the ability to set a timeout on a request. +func NewUserEmailChangeParamsWithTimeout(timeout time.Duration) *UserEmailChangeParams { + return &UserEmailChangeParams{ + timeout: timeout, + } +} + +// NewUserEmailChangeParamsWithContext creates a new UserEmailChangeParams object +// with the ability to set a context for a request. +func NewUserEmailChangeParamsWithContext(ctx context.Context) *UserEmailChangeParams { + return &UserEmailChangeParams{ + Context: ctx, + } +} + +// NewUserEmailChangeParamsWithHTTPClient creates a new UserEmailChangeParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserEmailChangeParamsWithHTTPClient(client *http.Client) *UserEmailChangeParams { + return &UserEmailChangeParams{ + HTTPClient: client, + } +} + +/* +UserEmailChangeParams contains all the parameters to send to the API endpoint + + for the user email change operation. + + Typically these are written to a http.Request. +*/ +type UserEmailChangeParams struct { + + /* NewEmail. + + Desired new email address. + */ + NewEmail string + + /* Password. + + User's current password, for verification. + */ + Password string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user email change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserEmailChangeParams) WithDefaults() *UserEmailChangeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user email change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserEmailChangeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user email change params +func (o *UserEmailChangeParams) WithTimeout(timeout time.Duration) *UserEmailChangeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user email change params +func (o *UserEmailChangeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user email change params +func (o *UserEmailChangeParams) WithContext(ctx context.Context) *UserEmailChangeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user email change params +func (o *UserEmailChangeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user email change params +func (o *UserEmailChangeParams) WithHTTPClient(client *http.Client) *UserEmailChangeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user email change params +func (o *UserEmailChangeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNewEmail adds the newEmail to the user email change params +func (o *UserEmailChangeParams) WithNewEmail(newEmail string) *UserEmailChangeParams { + o.SetNewEmail(newEmail) + return o +} + +// SetNewEmail adds the newEmail to the user email change params +func (o *UserEmailChangeParams) SetNewEmail(newEmail string) { + o.NewEmail = newEmail +} + +// WithPassword adds the password to the user email change params +func (o *UserEmailChangeParams) WithPassword(password string) *UserEmailChangeParams { + o.SetPassword(password) + return o +} + +// SetPassword adds the password to the user email change params +func (o *UserEmailChangeParams) SetPassword(password string) { + o.Password = password +} + +// WriteToRequest writes these params to a swagger request +func (o *UserEmailChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param new_email + frNewEmail := o.NewEmail + fNewEmail := frNewEmail + if fNewEmail != "" { + if err := r.SetFormParam("new_email", fNewEmail); err != nil { + return err + } + } + + // form param password + frPassword := o.Password + fPassword := frPassword + if fPassword != "" { + if err := r.SetFormParam("password", fPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/user_email_change_responses.go b/client/user/user_email_change_responses.go new file mode 100644 index 0000000..15ed8a5 --- /dev/null +++ b/client/user/user_email_change_responses.go @@ -0,0 +1,478 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" + + "git.coopcloud.tech/decentral1se/gtslib/models" +) + +// UserEmailChangeReader is a Reader for the UserEmailChange structure. +type UserEmailChangeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserEmailChangeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 202: + result := NewUserEmailChangeAccepted() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewUserEmailChangeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewUserEmailChangeUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewUserEmailChangeForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewUserEmailChangeNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 409: + result := NewUserEmailChangeConflict() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUserEmailChangeInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/user/email_change] userEmailChange", response, response.Code()) + } +} + +// NewUserEmailChangeAccepted creates a UserEmailChangeAccepted with default headers values +func NewUserEmailChangeAccepted() *UserEmailChangeAccepted { + return &UserEmailChangeAccepted{} +} + +/* +UserEmailChangeAccepted describes a response with status code 202, with default header values. + +Accepted: email change is processing; check your inbox to confirm new address. +*/ +type UserEmailChangeAccepted struct { + Payload *models.User +} + +// IsSuccess returns true when this user email change accepted response has a 2xx status code +func (o *UserEmailChangeAccepted) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user email change accepted response has a 3xx status code +func (o *UserEmailChangeAccepted) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change accepted response has a 4xx status code +func (o *UserEmailChangeAccepted) IsClientError() bool { + return false +} + +// IsServerError returns true when this user email change accepted response has a 5xx status code +func (o *UserEmailChangeAccepted) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change accepted response a status code equal to that given +func (o *UserEmailChangeAccepted) IsCode(code int) bool { + return code == 202 +} + +// Code gets the status code for the user email change accepted response +func (o *UserEmailChangeAccepted) Code() int { + return 202 +} + +func (o *UserEmailChangeAccepted) Error() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeAccepted %s", 202, payload) +} + +func (o *UserEmailChangeAccepted) String() string { + payload, _ := json.Marshal(o.Payload) + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeAccepted %s", 202, payload) +} + +func (o *UserEmailChangeAccepted) GetPayload() *models.User { + return o.Payload +} + +func (o *UserEmailChangeAccepted) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + o.Payload = new(models.User) + + // response payload + if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { + return err + } + + return nil +} + +// NewUserEmailChangeBadRequest creates a UserEmailChangeBadRequest with default headers values +func NewUserEmailChangeBadRequest() *UserEmailChangeBadRequest { + return &UserEmailChangeBadRequest{} +} + +/* +UserEmailChangeBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type UserEmailChangeBadRequest struct { +} + +// IsSuccess returns true when this user email change bad request response has a 2xx status code +func (o *UserEmailChangeBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change bad request response has a 3xx status code +func (o *UserEmailChangeBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change bad request response has a 4xx status code +func (o *UserEmailChangeBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change bad request response has a 5xx status code +func (o *UserEmailChangeBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change bad request response a status code equal to that given +func (o *UserEmailChangeBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the user email change bad request response +func (o *UserEmailChangeBadRequest) Code() int { + return 400 +} + +func (o *UserEmailChangeBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeBadRequest", 400) +} + +func (o *UserEmailChangeBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeBadRequest", 400) +} + +func (o *UserEmailChangeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeUnauthorized creates a UserEmailChangeUnauthorized with default headers values +func NewUserEmailChangeUnauthorized() *UserEmailChangeUnauthorized { + return &UserEmailChangeUnauthorized{} +} + +/* +UserEmailChangeUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type UserEmailChangeUnauthorized struct { +} + +// IsSuccess returns true when this user email change unauthorized response has a 2xx status code +func (o *UserEmailChangeUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change unauthorized response has a 3xx status code +func (o *UserEmailChangeUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change unauthorized response has a 4xx status code +func (o *UserEmailChangeUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change unauthorized response has a 5xx status code +func (o *UserEmailChangeUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change unauthorized response a status code equal to that given +func (o *UserEmailChangeUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the user email change unauthorized response +func (o *UserEmailChangeUnauthorized) Code() int { + return 401 +} + +func (o *UserEmailChangeUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeUnauthorized", 401) +} + +func (o *UserEmailChangeUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeUnauthorized", 401) +} + +func (o *UserEmailChangeUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeForbidden creates a UserEmailChangeForbidden with default headers values +func NewUserEmailChangeForbidden() *UserEmailChangeForbidden { + return &UserEmailChangeForbidden{} +} + +/* +UserEmailChangeForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type UserEmailChangeForbidden struct { +} + +// IsSuccess returns true when this user email change forbidden response has a 2xx status code +func (o *UserEmailChangeForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change forbidden response has a 3xx status code +func (o *UserEmailChangeForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change forbidden response has a 4xx status code +func (o *UserEmailChangeForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change forbidden response has a 5xx status code +func (o *UserEmailChangeForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change forbidden response a status code equal to that given +func (o *UserEmailChangeForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the user email change forbidden response +func (o *UserEmailChangeForbidden) Code() int { + return 403 +} + +func (o *UserEmailChangeForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeForbidden", 403) +} + +func (o *UserEmailChangeForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeForbidden", 403) +} + +func (o *UserEmailChangeForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeNotAcceptable creates a UserEmailChangeNotAcceptable with default headers values +func NewUserEmailChangeNotAcceptable() *UserEmailChangeNotAcceptable { + return &UserEmailChangeNotAcceptable{} +} + +/* +UserEmailChangeNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type UserEmailChangeNotAcceptable struct { +} + +// IsSuccess returns true when this user email change not acceptable response has a 2xx status code +func (o *UserEmailChangeNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change not acceptable response has a 3xx status code +func (o *UserEmailChangeNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change not acceptable response has a 4xx status code +func (o *UserEmailChangeNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change not acceptable response has a 5xx status code +func (o *UserEmailChangeNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change not acceptable response a status code equal to that given +func (o *UserEmailChangeNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the user email change not acceptable response +func (o *UserEmailChangeNotAcceptable) Code() int { + return 406 +} + +func (o *UserEmailChangeNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeNotAcceptable", 406) +} + +func (o *UserEmailChangeNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeNotAcceptable", 406) +} + +func (o *UserEmailChangeNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeConflict creates a UserEmailChangeConflict with default headers values +func NewUserEmailChangeConflict() *UserEmailChangeConflict { + return &UserEmailChangeConflict{} +} + +/* +UserEmailChangeConflict describes a response with status code 409, with default header values. + +Conflict: desired email address already in use +*/ +type UserEmailChangeConflict struct { +} + +// IsSuccess returns true when this user email change conflict response has a 2xx status code +func (o *UserEmailChangeConflict) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change conflict response has a 3xx status code +func (o *UserEmailChangeConflict) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change conflict response has a 4xx status code +func (o *UserEmailChangeConflict) IsClientError() bool { + return true +} + +// IsServerError returns true when this user email change conflict response has a 5xx status code +func (o *UserEmailChangeConflict) IsServerError() bool { + return false +} + +// IsCode returns true when this user email change conflict response a status code equal to that given +func (o *UserEmailChangeConflict) IsCode(code int) bool { + return code == 409 +} + +// Code gets the status code for the user email change conflict response +func (o *UserEmailChangeConflict) Code() int { + return 409 +} + +func (o *UserEmailChangeConflict) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeConflict", 409) +} + +func (o *UserEmailChangeConflict) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeConflict", 409) +} + +func (o *UserEmailChangeConflict) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserEmailChangeInternalServerError creates a UserEmailChangeInternalServerError with default headers values +func NewUserEmailChangeInternalServerError() *UserEmailChangeInternalServerError { + return &UserEmailChangeInternalServerError{} +} + +/* +UserEmailChangeInternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type UserEmailChangeInternalServerError struct { +} + +// IsSuccess returns true when this user email change internal server error response has a 2xx status code +func (o *UserEmailChangeInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user email change internal server error response has a 3xx status code +func (o *UserEmailChangeInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user email change internal server error response has a 4xx status code +func (o *UserEmailChangeInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this user email change internal server error response has a 5xx status code +func (o *UserEmailChangeInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this user email change internal server error response a status code equal to that given +func (o *UserEmailChangeInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the user email change internal server error response +func (o *UserEmailChangeInternalServerError) Code() int { + return 500 +} + +func (o *UserEmailChangeInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeInternalServerError", 500) +} + +func (o *UserEmailChangeInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/user/email_change][%d] userEmailChangeInternalServerError", 500) +} + +func (o *UserEmailChangeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/client/user/user_password_change_parameters.go b/client/user/user_password_change_parameters.go new file mode 100644 index 0000000..c88a43a --- /dev/null +++ b/client/user/user_password_change_parameters.go @@ -0,0 +1,183 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// 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" +) + +// NewUserPasswordChangeParams creates a new UserPasswordChangeParams 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 NewUserPasswordChangeParams() *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + timeout: cr.DefaultTimeout, + } +} + +// NewUserPasswordChangeParamsWithTimeout creates a new UserPasswordChangeParams object +// with the ability to set a timeout on a request. +func NewUserPasswordChangeParamsWithTimeout(timeout time.Duration) *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + timeout: timeout, + } +} + +// NewUserPasswordChangeParamsWithContext creates a new UserPasswordChangeParams object +// with the ability to set a context for a request. +func NewUserPasswordChangeParamsWithContext(ctx context.Context) *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + Context: ctx, + } +} + +// NewUserPasswordChangeParamsWithHTTPClient creates a new UserPasswordChangeParams object +// with the ability to set a custom HTTPClient for a request. +func NewUserPasswordChangeParamsWithHTTPClient(client *http.Client) *UserPasswordChangeParams { + return &UserPasswordChangeParams{ + HTTPClient: client, + } +} + +/* +UserPasswordChangeParams contains all the parameters to send to the API endpoint + + for the user password change operation. + + Typically these are written to a http.Request. +*/ +type UserPasswordChangeParams struct { + + /* NewPassword. + + Desired new password. + If the password does not have high enough entropy, it will be rejected. + See https://github.com/wagslane/go-password-validator + */ + NewPassword string + + /* OldPassword. + + User's previous password. + */ + OldPassword string + + timeout time.Duration + Context context.Context + HTTPClient *http.Client +} + +// WithDefaults hydrates default values in the user password change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserPasswordChangeParams) WithDefaults() *UserPasswordChangeParams { + o.SetDefaults() + return o +} + +// SetDefaults hydrates default values in the user password change params (not the query body). +// +// All values with no default are reset to their zero value. +func (o *UserPasswordChangeParams) SetDefaults() { + // no default values defined for this parameter +} + +// WithTimeout adds the timeout to the user password change params +func (o *UserPasswordChangeParams) WithTimeout(timeout time.Duration) *UserPasswordChangeParams { + o.SetTimeout(timeout) + return o +} + +// SetTimeout adds the timeout to the user password change params +func (o *UserPasswordChangeParams) SetTimeout(timeout time.Duration) { + o.timeout = timeout +} + +// WithContext adds the context to the user password change params +func (o *UserPasswordChangeParams) WithContext(ctx context.Context) *UserPasswordChangeParams { + o.SetContext(ctx) + return o +} + +// SetContext adds the context to the user password change params +func (o *UserPasswordChangeParams) SetContext(ctx context.Context) { + o.Context = ctx +} + +// WithHTTPClient adds the HTTPClient to the user password change params +func (o *UserPasswordChangeParams) WithHTTPClient(client *http.Client) *UserPasswordChangeParams { + o.SetHTTPClient(client) + return o +} + +// SetHTTPClient adds the HTTPClient to the user password change params +func (o *UserPasswordChangeParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client +} + +// WithNewPassword adds the newPassword to the user password change params +func (o *UserPasswordChangeParams) WithNewPassword(newPassword string) *UserPasswordChangeParams { + o.SetNewPassword(newPassword) + return o +} + +// SetNewPassword adds the newPassword to the user password change params +func (o *UserPasswordChangeParams) SetNewPassword(newPassword string) { + o.NewPassword = newPassword +} + +// WithOldPassword adds the oldPassword to the user password change params +func (o *UserPasswordChangeParams) WithOldPassword(oldPassword string) *UserPasswordChangeParams { + o.SetOldPassword(oldPassword) + return o +} + +// SetOldPassword adds the oldPassword to the user password change params +func (o *UserPasswordChangeParams) SetOldPassword(oldPassword string) { + o.OldPassword = oldPassword +} + +// WriteToRequest writes these params to a swagger request +func (o *UserPasswordChangeParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { + + if err := r.SetTimeout(o.timeout); err != nil { + return err + } + var res []error + + // form param new_password + frNewPassword := o.NewPassword + fNewPassword := frNewPassword + if fNewPassword != "" { + if err := r.SetFormParam("new_password", fNewPassword); err != nil { + return err + } + } + + // form param old_password + frOldPassword := o.OldPassword + fOldPassword := frOldPassword + if fOldPassword != "" { + if err := r.SetFormParam("old_password", fOldPassword); err != nil { + return err + } + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} diff --git a/client/user/user_password_change_responses.go b/client/user/user_password_change_responses.go new file mode 100644 index 0000000..22203bd --- /dev/null +++ b/client/user/user_password_change_responses.go @@ -0,0 +1,460 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package user + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "fmt" + + "github.com/go-openapi/runtime" + "github.com/go-openapi/strfmt" +) + +// UserPasswordChangeReader is a Reader for the UserPasswordChange structure. +type UserPasswordChangeReader struct { + formats strfmt.Registry +} + +// ReadResponse reads a server response into the received o. +func (o *UserPasswordChangeReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { + switch response.Code() { + case 200: + result := NewUserPasswordChangeOK() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return result, nil + case 400: + result := NewUserPasswordChangeBadRequest() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 401: + result := NewUserPasswordChangeUnauthorized() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 403: + result := NewUserPasswordChangeForbidden() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 406: + result := NewUserPasswordChangeNotAcceptable() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 422: + result := NewUserPasswordChangeUnprocessableEntity() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + case 500: + result := NewUserPasswordChangeInternalServerError() + if err := result.readResponse(response, consumer, o.formats); err != nil { + return nil, err + } + return nil, result + default: + return nil, runtime.NewAPIError("[POST /api/v1/user/password_change] userPasswordChange", response, response.Code()) + } +} + +// NewUserPasswordChangeOK creates a UserPasswordChangeOK with default headers values +func NewUserPasswordChangeOK() *UserPasswordChangeOK { + return &UserPasswordChangeOK{} +} + +/* +UserPasswordChangeOK describes a response with status code 200, with default header values. + +Change successful +*/ +type UserPasswordChangeOK struct { +} + +// IsSuccess returns true when this user password change o k response has a 2xx status code +func (o *UserPasswordChangeOK) IsSuccess() bool { + return true +} + +// IsRedirect returns true when this user password change o k response has a 3xx status code +func (o *UserPasswordChangeOK) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change o k response has a 4xx status code +func (o *UserPasswordChangeOK) IsClientError() bool { + return false +} + +// IsServerError returns true when this user password change o k response has a 5xx status code +func (o *UserPasswordChangeOK) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change o k response a status code equal to that given +func (o *UserPasswordChangeOK) IsCode(code int) bool { + return code == 200 +} + +// Code gets the status code for the user password change o k response +func (o *UserPasswordChangeOK) Code() int { + return 200 +} + +func (o *UserPasswordChangeOK) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeOK", 200) +} + +func (o *UserPasswordChangeOK) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeOK", 200) +} + +func (o *UserPasswordChangeOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeBadRequest creates a UserPasswordChangeBadRequest with default headers values +func NewUserPasswordChangeBadRequest() *UserPasswordChangeBadRequest { + return &UserPasswordChangeBadRequest{} +} + +/* +UserPasswordChangeBadRequest describes a response with status code 400, with default header values. + +bad request +*/ +type UserPasswordChangeBadRequest struct { +} + +// IsSuccess returns true when this user password change bad request response has a 2xx status code +func (o *UserPasswordChangeBadRequest) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change bad request response has a 3xx status code +func (o *UserPasswordChangeBadRequest) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change bad request response has a 4xx status code +func (o *UserPasswordChangeBadRequest) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change bad request response has a 5xx status code +func (o *UserPasswordChangeBadRequest) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change bad request response a status code equal to that given +func (o *UserPasswordChangeBadRequest) IsCode(code int) bool { + return code == 400 +} + +// Code gets the status code for the user password change bad request response +func (o *UserPasswordChangeBadRequest) Code() int { + return 400 +} + +func (o *UserPasswordChangeBadRequest) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeBadRequest", 400) +} + +func (o *UserPasswordChangeBadRequest) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeBadRequest", 400) +} + +func (o *UserPasswordChangeBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeUnauthorized creates a UserPasswordChangeUnauthorized with default headers values +func NewUserPasswordChangeUnauthorized() *UserPasswordChangeUnauthorized { + return &UserPasswordChangeUnauthorized{} +} + +/* +UserPasswordChangeUnauthorized describes a response with status code 401, with default header values. + +unauthorized +*/ +type UserPasswordChangeUnauthorized struct { +} + +// IsSuccess returns true when this user password change unauthorized response has a 2xx status code +func (o *UserPasswordChangeUnauthorized) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change unauthorized response has a 3xx status code +func (o *UserPasswordChangeUnauthorized) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change unauthorized response has a 4xx status code +func (o *UserPasswordChangeUnauthorized) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change unauthorized response has a 5xx status code +func (o *UserPasswordChangeUnauthorized) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change unauthorized response a status code equal to that given +func (o *UserPasswordChangeUnauthorized) IsCode(code int) bool { + return code == 401 +} + +// Code gets the status code for the user password change unauthorized response +func (o *UserPasswordChangeUnauthorized) Code() int { + return 401 +} + +func (o *UserPasswordChangeUnauthorized) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnauthorized", 401) +} + +func (o *UserPasswordChangeUnauthorized) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnauthorized", 401) +} + +func (o *UserPasswordChangeUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeForbidden creates a UserPasswordChangeForbidden with default headers values +func NewUserPasswordChangeForbidden() *UserPasswordChangeForbidden { + return &UserPasswordChangeForbidden{} +} + +/* +UserPasswordChangeForbidden describes a response with status code 403, with default header values. + +forbidden +*/ +type UserPasswordChangeForbidden struct { +} + +// IsSuccess returns true when this user password change forbidden response has a 2xx status code +func (o *UserPasswordChangeForbidden) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change forbidden response has a 3xx status code +func (o *UserPasswordChangeForbidden) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change forbidden response has a 4xx status code +func (o *UserPasswordChangeForbidden) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change forbidden response has a 5xx status code +func (o *UserPasswordChangeForbidden) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change forbidden response a status code equal to that given +func (o *UserPasswordChangeForbidden) IsCode(code int) bool { + return code == 403 +} + +// Code gets the status code for the user password change forbidden response +func (o *UserPasswordChangeForbidden) Code() int { + return 403 +} + +func (o *UserPasswordChangeForbidden) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeForbidden", 403) +} + +func (o *UserPasswordChangeForbidden) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeForbidden", 403) +} + +func (o *UserPasswordChangeForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeNotAcceptable creates a UserPasswordChangeNotAcceptable with default headers values +func NewUserPasswordChangeNotAcceptable() *UserPasswordChangeNotAcceptable { + return &UserPasswordChangeNotAcceptable{} +} + +/* +UserPasswordChangeNotAcceptable describes a response with status code 406, with default header values. + +not acceptable +*/ +type UserPasswordChangeNotAcceptable struct { +} + +// IsSuccess returns true when this user password change not acceptable response has a 2xx status code +func (o *UserPasswordChangeNotAcceptable) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change not acceptable response has a 3xx status code +func (o *UserPasswordChangeNotAcceptable) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change not acceptable response has a 4xx status code +func (o *UserPasswordChangeNotAcceptable) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change not acceptable response has a 5xx status code +func (o *UserPasswordChangeNotAcceptable) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change not acceptable response a status code equal to that given +func (o *UserPasswordChangeNotAcceptable) IsCode(code int) bool { + return code == 406 +} + +// Code gets the status code for the user password change not acceptable response +func (o *UserPasswordChangeNotAcceptable) Code() int { + return 406 +} + +func (o *UserPasswordChangeNotAcceptable) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeNotAcceptable", 406) +} + +func (o *UserPasswordChangeNotAcceptable) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeNotAcceptable", 406) +} + +func (o *UserPasswordChangeNotAcceptable) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeUnprocessableEntity creates a UserPasswordChangeUnprocessableEntity with default headers values +func NewUserPasswordChangeUnprocessableEntity() *UserPasswordChangeUnprocessableEntity { + return &UserPasswordChangeUnprocessableEntity{} +} + +/* +UserPasswordChangeUnprocessableEntity describes a response with status code 422, with default header values. + +unprocessable request because instance is running with OIDC backend +*/ +type UserPasswordChangeUnprocessableEntity struct { +} + +// IsSuccess returns true when this user password change unprocessable entity response has a 2xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change unprocessable entity response has a 3xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change unprocessable entity response has a 4xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsClientError() bool { + return true +} + +// IsServerError returns true when this user password change unprocessable entity response has a 5xx status code +func (o *UserPasswordChangeUnprocessableEntity) IsServerError() bool { + return false +} + +// IsCode returns true when this user password change unprocessable entity response a status code equal to that given +func (o *UserPasswordChangeUnprocessableEntity) IsCode(code int) bool { + return code == 422 +} + +// Code gets the status code for the user password change unprocessable entity response +func (o *UserPasswordChangeUnprocessableEntity) Code() int { + return 422 +} + +func (o *UserPasswordChangeUnprocessableEntity) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnprocessableEntity", 422) +} + +func (o *UserPasswordChangeUnprocessableEntity) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeUnprocessableEntity", 422) +} + +func (o *UserPasswordChangeUnprocessableEntity) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} + +// NewUserPasswordChangeInternalServerError creates a UserPasswordChangeInternalServerError with default headers values +func NewUserPasswordChangeInternalServerError() *UserPasswordChangeInternalServerError { + return &UserPasswordChangeInternalServerError{} +} + +/* +UserPasswordChangeInternalServerError describes a response with status code 500, with default header values. + +internal error +*/ +type UserPasswordChangeInternalServerError struct { +} + +// IsSuccess returns true when this user password change internal server error response has a 2xx status code +func (o *UserPasswordChangeInternalServerError) IsSuccess() bool { + return false +} + +// IsRedirect returns true when this user password change internal server error response has a 3xx status code +func (o *UserPasswordChangeInternalServerError) IsRedirect() bool { + return false +} + +// IsClientError returns true when this user password change internal server error response has a 4xx status code +func (o *UserPasswordChangeInternalServerError) IsClientError() bool { + return false +} + +// IsServerError returns true when this user password change internal server error response has a 5xx status code +func (o *UserPasswordChangeInternalServerError) IsServerError() bool { + return true +} + +// IsCode returns true when this user password change internal server error response a status code equal to that given +func (o *UserPasswordChangeInternalServerError) IsCode(code int) bool { + return code == 500 +} + +// Code gets the status code for the user password change internal server error response +func (o *UserPasswordChangeInternalServerError) Code() int { + return 500 +} + +func (o *UserPasswordChangeInternalServerError) Error() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeInternalServerError", 500) +} + +func (o *UserPasswordChangeInternalServerError) String() string { + return fmt.Sprintf("[POST /api/v1/user/password_change][%d] userPasswordChangeInternalServerError", 500) +} + +func (o *UserPasswordChangeInternalServerError) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { + + return nil +} diff --git a/filter-context.diff b/filter-context.diff new file mode 100644 index 0000000..6f74a3e --- /dev/null +++ b/filter-context.diff @@ -0,0 +1,204 @@ +diff --git a/client/filters/filter_v1_post_parameters.go b/client/filters/filter_v1_post_parameters.go +index 1d42920..bb93786 100644 +--- a/client/filters/filter_v1_post_parameters.go ++++ b/client/filters/filter_v1_post_parameters.go +@@ -62,13 +62,13 @@ FilterV1PostParams contains all the parameters to send to the API endpoint + */ + type FilterV1PostParams struct { + +- /* Context. ++ /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ +- Context []string ++ FilterContext []string + + /* ExpiresIn. + +@@ -169,15 +169,15 @@ func (o *FilterV1PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client + } + +-// WithContext adds the context to the filter v1 post params +-func (o *FilterV1PostParams) WithContext(context []string) *FilterV1PostParams { +- o.SetContext(context) ++// WithFilterContext adds the filter context to the filter v1 post params ++func (o *FilterV1PostParams) WithFilterContext(context []string) *FilterV1PostParams { ++ o.SetFilterContext(context) + return o + } + +-// SetContext adds the context to the filter v1 post params +-func (o *FilterV1PostParams) SetContext(context []string) { +- o.Context = context ++// SetFilterContext adds the filter context to the filter v1 post params ++func (o *FilterV1PostParams) SetFilterContext(context []string) { ++ o.FilterContext = context + } + + // WithExpiresIn adds the expiresIn to the filter v1 post params +@@ -305,7 +305,7 @@ func (o *FilterV1PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. + + // bindParamFilterV1Post binds the parameter context[] + func (o *FilterV1PostParams) bindParamContext(formats strfmt.Registry) []string { +- contextIR := o.Context ++ contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string +diff --git a/client/filters/filter_v1_put_parameters.go b/client/filters/filter_v1_put_parameters.go +index 66d7a1f..5e03a61 100644 +--- a/client/filters/filter_v1_put_parameters.go ++++ b/client/filters/filter_v1_put_parameters.go +@@ -62,13 +62,13 @@ FilterV1PutParams contains all the parameters to send to the API endpoint + */ + type FilterV1PutParams struct { + +- /* Context. ++ /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ +- Context []string ++ FilterContext []string + + /* ExpiresIn. + +@@ -175,15 +175,15 @@ func (o *FilterV1PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client + } + +-// WithContext adds the context to the filter v1 put params +-func (o *FilterV1PutParams) WithContext(context []string) *FilterV1PutParams { +- o.SetContext(context) ++// WithFilterContext adds the filter context to the filter v1 put params ++func (o *FilterV1PutParams) WithFilterContext(context []string) *FilterV1PutParams { ++ o.SetFilterContext(context) + return o + } + +-// SetContext adds the context to the filter v1 put params +-func (o *FilterV1PutParams) SetContext(context []string) { +- o.Context = context ++// SetFilterContext adds the filter context to the filter v1 put params ++func (o *FilterV1PutParams) SetFilterContext(context []string) { ++ o.FilterContext = context + } + + // WithExpiresIn adds the expiresIn to the filter v1 put params +@@ -327,7 +327,7 @@ func (o *FilterV1PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R + + // bindParamFilterV1Put binds the parameter context[] + func (o *FilterV1PutParams) bindParamContext(formats strfmt.Registry) []string { +- contextIR := o.Context ++ contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string +diff --git a/client/filters/filter_v2_post_parameters.go b/client/filters/filter_v2_post_parameters.go +index c9a7901..7bda5aa 100644 +--- a/client/filters/filter_v2_post_parameters.go ++++ b/client/filters/filter_v2_post_parameters.go +@@ -62,13 +62,13 @@ FilterV2PostParams contains all the parameters to send to the API endpoint + */ + type FilterV2PostParams struct { + +- /* Context. ++ /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ +- Context []string ++ FilterContext []string + + /* ExpiresIn. + +@@ -160,15 +160,15 @@ func (o *FilterV2PostParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client + } + +-// WithContext adds the context to the filter v2 post params +-func (o *FilterV2PostParams) WithContext(context []string) *FilterV2PostParams { +- o.SetContext(context) ++// WithFilterContext adds the filter context to the filter v2 post params ++func (o *FilterV2PostParams) WithFilterContext(context []string) *FilterV2PostParams { ++ o.SetFilterContext(context) + return o + } + +-// SetContext adds the context to the filter v2 post params +-func (o *FilterV2PostParams) SetContext(context []string) { +- o.Context = context ++// SetFilterContext adds the filter context to the filter v2 post params ++func (o *FilterV2PostParams) SetFilterContext(context []string) { ++ o.FilterContext = context + } + + // WithExpiresIn adds the expiresIn to the filter v2 post params +@@ -270,7 +270,7 @@ func (o *FilterV2PostParams) WriteToRequest(r runtime.ClientRequest, reg strfmt. + + // bindParamFilterV2Post binds the parameter context[] + func (o *FilterV2PostParams) bindParamContext(formats strfmt.Registry) []string { +- contextIR := o.Context ++ contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string +diff --git a/client/filters/filter_v2_put_parameters.go b/client/filters/filter_v2_put_parameters.go +index f188025..3312d61 100644 +--- a/client/filters/filter_v2_put_parameters.go ++++ b/client/filters/filter_v2_put_parameters.go +@@ -62,13 +62,13 @@ FilterV2PutParams contains all the parameters to send to the API endpoint + */ + type FilterV2PutParams struct { + +- /* Context. ++ /* FilterContext. + + The contexts in which the filter should be applied. + + Sample: home, public + */ +- Context []string ++ FilterContext []string + + /* ExpiresIn. + +@@ -145,15 +145,15 @@ func (o *FilterV2PutParams) SetHTTPClient(client *http.Client) { + o.HTTPClient = client + } + +-// WithContext adds the context to the filter v2 put params +-func (o *FilterV2PutParams) WithContext(context []string) *FilterV2PutParams { +- o.SetContext(context) ++// WithFilterContext adds the filter context to the filter v2 put params ++func (o *FilterV2PutParams) WithFilterContext(context []string) *FilterV2PutParams { ++ o.SetFilterContext(context) + return o + } + +-// SetContext adds the context to the filter v2 put params +-func (o *FilterV2PutParams) SetContext(context []string) { +- o.Context = context ++// SetFilterContext adds the filter context to the filter v2 put params ++func (o *FilterV2PutParams) SetFilterContext(context []string) { ++ o.FilterContext = context + } + + // WithExpiresIn adds the expiresIn to the filter v2 put params +@@ -245,7 +245,7 @@ func (o *FilterV2PutParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.R + + // bindParamFilterV2Put binds the parameter context[] + func (o *FilterV2PutParams) bindParamContext(formats strfmt.Registry) []string { +- contextIR := o.Context ++ contextIR := o.FilterContext + + var contextIC []string + for _, contextIIR := range contextIR { // explode []string diff --git a/generate.go b/generate.go new file mode 100644 index 0000000..10c1703 --- /dev/null +++ b/generate.go @@ -0,0 +1,8 @@ +package main + +//go:generate go run github.com/go-swagger/go-swagger/cmd/swagger generate client --spec https://raw.githubusercontent.com/superseriousbusiness/gotosocial/main/docs/api/swagger.yaml + +func main() { + // NOTE(d1): to avoid strange build error + // runtime.main_main·f: function main is undeclared in the main package +} diff --git a/go.mod b/go.mod new file mode 100644 index 0000000..e3e0c60 --- /dev/null +++ b/go.mod @@ -0,0 +1,38 @@ +module git.coopcloud.tech/decentral1se/gtslib + +go 1.21.1 + +require ( + github.com/go-openapi/errors v0.22.0 + github.com/go-openapi/runtime v0.28.0 + github.com/go-openapi/strfmt v0.23.0 + github.com/go-openapi/swag v0.23.0 + github.com/go-openapi/validate v0.24.0 +) + +require ( + github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect + github.com/go-logr/logr v1.4.1 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-openapi/analysis v0.23.0 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.21.0 // indirect + github.com/go-openapi/loads v0.22.0 // indirect + github.com/go-openapi/spec v0.21.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/oklog/ulid v1.3.1 // indirect + github.com/opentracing/opentracing-go v1.2.0 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect + go.mongodb.org/mongo-driver v1.14.0 // indirect + go.opentelemetry.io/otel v1.24.0 // indirect + go.opentelemetry.io/otel/metric v1.24.0 // indirect + go.opentelemetry.io/otel/trace v1.24.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.20.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect +) diff --git a/go.sum b/go.sum new file mode 100644 index 0000000..27ebb6b --- /dev/null +++ b/go.sum @@ -0,0 +1,76 @@ +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 h1:DklsrG3dyBCFEj5IhUbnKptjxatkF07cF2ak3yi77so= +github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2/go.mod h1:WaHUgvxTVq04UNunO+XhnAqY/wQc+bxr74GqbsZ/Jqw= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-openapi/analysis v0.23.0 h1:aGday7OWupfMs+LbmLZG4k0MYXIANxcuBTYUC03zFCU= +github.com/go-openapi/analysis v0.23.0/go.mod h1:9mz9ZWaSlV8TvjQHLl2mUW2PbZtemkE8yA5v22ohupo= +github.com/go-openapi/errors v0.22.0 h1:c4xY/OLxUBSTiepAg3j/MHuAv5mJhnf53LLMWFB+u/w= +github.com/go-openapi/errors v0.22.0/go.mod h1:J3DmZScxCDufmIMsdOuDHxJbdOGC0xtUynjIx092vXE= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.21.0 h1:Rs+Y7hSXT83Jacb7kFyjn4ijOuVGSvOdF2+tg1TRrwQ= +github.com/go-openapi/jsonreference v0.21.0/go.mod h1:LmZmgsrTkVg9LG4EaHeY8cBDslNPMo06cago5JNLkm4= +github.com/go-openapi/loads v0.22.0 h1:ECPGd4jX1U6NApCGG1We+uEozOAvXvJSF4nnwHZ8Aco= +github.com/go-openapi/loads v0.22.0/go.mod h1:yLsaTCS92mnSAZX5WWoxszLj0u+Ojl+Zs5Stn1oF+rs= +github.com/go-openapi/runtime v0.28.0 h1:gpPPmWSNGo214l6n8hzdXYhPuJcGtziTOgUpvsFWGIQ= +github.com/go-openapi/runtime v0.28.0/go.mod h1:QN7OzcS+XuYmkQLw05akXk0jRH/eZ3kb18+1KwW9gyc= +github.com/go-openapi/spec v0.21.0 h1:LTVzPc3p/RzRnkQqLRndbAzjY0d0BCL72A6j3CdL9ZY= +github.com/go-openapi/spec v0.21.0/go.mod h1:78u6VdPw81XU44qEWGhtr982gJ5BWg2c0I5XwVMotYk= +github.com/go-openapi/strfmt v0.23.0 h1:nlUS6BCqcnAk0pyhi9Y+kdDVZdZMHfEKQiS4HaMgO/c= +github.com/go-openapi/strfmt v0.23.0/go.mod h1:NrtIpfKtWIygRkKVsxh7XQMDQW5HKQl6S5ik2elW+K4= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/validate v0.24.0 h1:LdfDKwNbpB6Vn40xhTdNZAnfLECL81w+VX3BumrGD58= +github.com/go-openapi/validate v0.24.0/go.mod h1:iyeX1sEufmv3nPbBdX3ieNviWnOZaJ1+zquzJEf2BAQ= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= +github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/oklog/ulid v1.3.1 h1:EGfNDEx6MqHz8B3uNV6QAib1UR2Lm97sHi3ocA6ESJ4= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +go.mongodb.org/mongo-driver v1.14.0 h1:P98w8egYRjYe3XDjxhYJagTokP/H6HzlsnojRgZRd80= +go.mongodb.org/mongo-driver v1.14.0/go.mod h1:Vzb0Mk/pa7e6cWw85R4F/endUC3u0U9jGcNU603k65c= +go.opentelemetry.io/otel v1.24.0 h1:0LAOdjNmQeSTzGBzduGe/rU4tZhMwL5rWgtp9Ku5Jfo= +go.opentelemetry.io/otel v1.24.0/go.mod h1:W7b9Ozg4nkF5tWI5zsXkaKKDjdVjpD4oAt9Qi/MArHo= +go.opentelemetry.io/otel/metric v1.24.0 h1:6EhoGWWK28x1fbpA4tYTOWBkPefTDQnb8WSGXlc88kI= +go.opentelemetry.io/otel/metric v1.24.0/go.mod h1:VYhLe1rFfxuTXLgj4CBiyz+9WYBA8pNGJgDcSFRKBco= +go.opentelemetry.io/otel/sdk v1.24.0 h1:YMPPDNymmQN3ZgczicBY3B6sf9n62Dlj9pWD3ucgoDw= +go.opentelemetry.io/otel/sdk v1.24.0/go.mod h1:KVrIYw6tEubO9E96HQpcmpTKDVn9gdv35HoYiQWGDFg= +go.opentelemetry.io/otel/trace v1.24.0 h1:CsKnnL4dUAr/0llH9FKuc698G04IrpWV0MQA/Y1YELI= +go.opentelemetry.io/otel/trace v1.24.0/go.mod h1:HPc3Xr/cOApsBI154IU0OI0HJexz+aw5uPdbs3UCjNU= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/models/account.go b/models/account.go new file mode 100644 index 0000000..4f0c420 --- /dev/null +++ b/models/account.go @@ -0,0 +1,433 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Account Account models a fediverse account. +// +// The modelled account can be either a remote account, or one on this instance. +// +// swagger:model Account +type Account struct { + + // The account URI as discovered via webfinger. + // Equal to username for local users, or username@domain for remote users. + // Example: some_user@example.org + Acct string `json:"acct,omitempty"` + + // Web location of the account's avatar. + // Example: https://example.org/media/some_user/avatar/original/avatar.jpeg + Avatar string `json:"avatar,omitempty"` + + // Description of this account's avatar, for alt text. + // Example: A cute drawing of a smiling sloth. + AvatarDescription string `json:"avatar_description,omitempty"` + + // Web location of a static version of the account's avatar. + // Only relevant when the account's main avatar is a video or a gif. + // Example: https://example.org/media/some_user/avatar/static/avatar.png + AvatarStatic string `json:"avatar_static,omitempty"` + + // Account identifies as a bot. + Bot bool `json:"bot,omitempty"` + + // When the account was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // CustomCSS to include when rendering this account's profile or statuses. + CustomCSS string `json:"custom_css,omitempty"` + + // Account has opted into discovery features. + Discoverable bool `json:"discoverable,omitempty"` + + // The account's display name. + // Example: big jeff (he/him) + DisplayName string `json:"display_name,omitempty"` + + // Array of custom emojis used in this account's note or display name. + // Empty for blocked accounts. + Emojis []*Emoji `json:"emojis"` + + // Account has enabled RSS feed. + // Key/value omitted if false. + EnableRSS bool `json:"enable_rss,omitempty"` + + // Additional metadata attached to this account's profile. + // Empty for blocked accounts. + Fields []*Field `json:"fields"` + + // Number of accounts following this account, according to our instance. + FollowersCount int64 `json:"followers_count,omitempty"` + + // Number of account's followed by this account, according to our instance. + FollowingCount int64 `json:"following_count,omitempty"` + + // Web location of the account's header image. + // Example: https://example.org/media/some_user/header/original/header.jpeg + Header string `json:"header,omitempty"` + + // Description of this account's header, for alt text. + // Example: A sunlit field with purple flowers. + HeaderDescription string `json:"header_description,omitempty"` + + // Web location of a static version of the account's header. + // Only relevant when the account's main header is a video or a gif. + // Example: https://example.org/media/some_user/header/static/header.png + HeaderStatic string `json:"header_static,omitempty"` + + // Account has opted to hide their followers/following collections. + // Key/value omitted if false. + HideCollections bool `json:"hide_collections,omitempty"` + + // The account id. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // When the account's most recent status was posted (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + LastStatusAt string `json:"last_status_at,omitempty"` + + // Account manually approves follow requests. + Locked bool `json:"locked,omitempty"` + + // Bio/description of this account. + Note string `json:"note,omitempty"` + + // Number of statuses posted by this account, according to our instance. + StatusesCount int64 `json:"statuses_count,omitempty"` + + // Account has been suspended by our instance. + Suspended bool `json:"suspended,omitempty"` + + // Filename of user-selected CSS theme to include when rendering this account's profile or statuses. Eg., `blurple-light.css`. + Theme string `json:"theme,omitempty"` + + // Web location of the account's profile page. + // Example: https://example.org/@some_user + URL string `json:"url,omitempty"` + + // The username of the account, not including domain. + // Example: some_user + Username string `json:"username,omitempty"` + + // moved + Moved *Account `json:"moved,omitempty"` + + // role + Role *AccountRole `json:"role,omitempty"` + + // source + Source *Source `json:"source,omitempty"` +} + +// Validate validates this account +func (m *Account) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoved(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Account) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) validateFields(formats strfmt.Registry) error { + if swag.IsZero(m.Fields) { // not required + return nil + } + + for i := 0; i < len(m.Fields); i++ { + if swag.IsZero(m.Fields[i]) { // not required + continue + } + + if m.Fields[i] != nil { + if err := m.Fields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) validateMoved(formats strfmt.Registry) error { + if swag.IsZero(m.Moved) { // not required + return nil + } + + if m.Moved != nil { + if err := m.Moved.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *Account) validateRole(formats strfmt.Registry) error { + if swag.IsZero(m.Role) { // not required + return nil + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *Account) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this account based on the context it is used +func (m *Account) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMoved(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Account) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) contextValidateFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Fields); i++ { + + if m.Fields[i] != nil { + + if swag.IsZero(m.Fields[i]) { // not required + return nil + } + + if err := m.Fields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Account) contextValidateMoved(ctx context.Context, formats strfmt.Registry) error { + + if m.Moved != nil { + + if swag.IsZero(m.Moved) { // not required + return nil + } + + if err := m.Moved.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if swag.IsZero(m.Role) { // not required + return nil + } + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *Account) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Account) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Account) UnmarshalBinary(b []byte) error { + var res Account + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/account_role.go b/models/account_role.go new file mode 100644 index 0000000..6020d6d --- /dev/null +++ b/models/account_role.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AccountRole AccountRole models the role of an account. +// +// swagger:model AccountRole +type AccountRole struct { + + // name + Name string `json:"name,omitempty"` +} + +// Validate validates this account role +func (m *AccountRole) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this account role based on context it is used +func (m *AccountRole) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AccountRole) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AccountRole) UnmarshalBinary(b []byte) error { + var res AccountRole + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/admin_account_info.go b/models/admin_account_info.go new file mode 100644 index 0000000..6476605 --- /dev/null +++ b/models/admin_account_info.go @@ -0,0 +1,223 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminAccountInfo AdminAccountInfo models the admin view of an account's details. +// +// swagger:model AdminAccountInfo +type AdminAccountInfo struct { + + // Whether the account is currently approved. + Approved bool `json:"approved,omitempty"` + + // Whether the account has confirmed their email address. + Confirmed bool `json:"confirmed,omitempty"` + + // When the account was first discovered. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // The ID of the application that created this account. + CreatedByApplicationID string `json:"created_by_application_id,omitempty"` + + // Whether the account is currently disabled. + Disabled bool `json:"disabled,omitempty"` + + // The domain of the account. + // Null for local accounts. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // The email address associated with the account. + // Empty string for remote accounts or accounts with + // no known email address. + // Example: someone@somewhere.com + Email string `json:"email,omitempty"` + + // The ID of the account in the database. + // Example: 01GQ4PHNT622DQ9X95XQX4KKNR + ID string `json:"id,omitempty"` + + // The IP address last used to login to this account. + // Null if not known. + // Example: 192.0.2.1 + IP string `json:"ip,omitempty"` + + // All known IP addresses associated with this account. + // NOT IMPLEMENTED (will always be empty array). + // Example: [] + IPs []interface{} `json:"ips"` + + // The reason given when signing up. + // Null if no reason / remote account. + // Example: Pleaaaaaaaaaaaaaaase!! + InviteRequest string `json:"invite_request,omitempty"` + + // The ID of the account that invited this user + InvitedByAccountID string `json:"invited_by_account_id,omitempty"` + + // The locale of the account. (ISO 639 Part 1 two-letter language code) + // Example: en + Locale string `json:"locale,omitempty"` + + // Whether the account is currently silenced + Silenced bool `json:"silenced,omitempty"` + + // Whether the account is currently suspended. + Suspended bool `json:"suspended,omitempty"` + + // The username of the account. + // Example: dril + Username string `json:"username,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // role + Role *AccountRole `json:"role,omitempty"` +} + +// Validate validates this admin account info +func (m *AdminAccountInfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminAccountInfo) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminAccountInfo) validateRole(formats strfmt.Registry) error { + if swag.IsZero(m.Role) { // not required + return nil + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// ContextValidate validate this admin account info based on the context it is used +func (m *AdminAccountInfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminAccountInfo) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminAccountInfo) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if swag.IsZero(m.Role) { // not required + return nil + } + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AdminAccountInfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminAccountInfo) UnmarshalBinary(b []byte) error { + var res AdminAccountInfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/admin_action_response.go b/models/admin_action_response.go new file mode 100644 index 0000000..dbcd36d --- /dev/null +++ b/models/admin_action_response.go @@ -0,0 +1,52 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminActionResponse AdminActionResponse models the server +// response to an admin action. +// +// swagger:model AdminActionResponse +type AdminActionResponse struct { + + // Internal ID of the action. + // Example: 01H9QG6TZ9W5P0402VFRVM17TH + ActionID string `json:"action_id,omitempty"` +} + +// Validate validates this admin action response +func (m *AdminActionResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this admin action response based on context it is used +func (m *AdminActionResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AdminActionResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminActionResponse) UnmarshalBinary(b []byte) error { + var res AdminActionResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/admin_emoji.go b/models/admin_emoji.go new file mode 100644 index 0000000..66f29ae --- /dev/null +++ b/models/admin_emoji.go @@ -0,0 +1,95 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminEmoji AdminEmoji models the admin view of a custom emoji. +// +// swagger:model AdminEmoji +type AdminEmoji struct { + + // Used for sorting custom emoji in the picker. + // Example: blobcats + Category string `json:"category,omitempty"` + + // The MIME content type of the emoji. + // Example: image/png + ContentType string `json:"content_type,omitempty"` + + // True if this emoji has been disabled by an admin action. + // Example: false + Disabled bool `json:"disabled,omitempty"` + + // The domain from which the emoji originated. Only defined for remote domains, otherwise key will not be set. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // The ID of the emoji. + // Example: 01GEM7SFDZ7GZNRXFVZ3X4E4N1 + ID string `json:"id,omitempty"` + + // The name of the custom emoji. + // Example: blobcat_uwu + Shortcode string `json:"shortcode,omitempty"` + + // A link to a static copy of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.png + StaticURL string `json:"static_url,omitempty"` + + // The total file size taken up by the emoji in bytes, including static and animated versions. + // Example: 69420 + TotalFileSize int64 `json:"total_file_size,omitempty"` + + // The ActivityPub URI of the emoji. + // Example: https://example.org/emojis/016T5Q3SQKBT337DAKVSKNXXW1 + URI string `json:"uri,omitempty"` + + // Web URL of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.gif + URL string `json:"url,omitempty"` + + // Time when the emoji image was last updated. + // Example: 2022-10-05T09:21:26.419Z + UpdatedAt string `json:"updated_at,omitempty"` + + // Emoji is visible in the emoji picker of the instance. + // Example: true + VisibleInPicker bool `json:"visible_in_picker,omitempty"` +} + +// Validate validates this admin emoji +func (m *AdminEmoji) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this admin emoji based on context it is used +func (m *AdminEmoji) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *AdminEmoji) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminEmoji) UnmarshalBinary(b []byte) error { + var res AdminEmoji + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/admin_report.go b/models/admin_report.go new file mode 100644 index 0000000..b483c03 --- /dev/null +++ b/models/admin_report.go @@ -0,0 +1,428 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// AdminReport AdminReport models the admin view of a report. +// +// swagger:model AdminReport +type AdminReport struct { + + // Whether an action has been taken by an admin in response to this report. + // Example: false + ActionTaken bool `json:"action_taken,omitempty"` + + // If an action was taken, at what time was this done? (ISO 8601 Datetime) + // Will be null if not set / no action yet taken. + // Example: 2021-07-30T09:20:25+00:00 + ActionTakenAt string `json:"action_taken_at,omitempty"` + + // If an action was taken, what comment was made by the admin on the taken action? + // Will be null if not set / no action yet taken. + // Example: Account was suspended. + ActionTakenComment string `json:"action_taken_comment,omitempty"` + + // Under what category was this report created? + // Example: spam + Category string `json:"category,omitempty"` + + // Comment submitted when the report was created. + // Will be empty if no comment was submitted. + // Example: This person has been harassing me. + Comment string `json:"comment,omitempty"` + + // The date when this report was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Bool to indicate that report should be federated to remote instance. + // Example: true + Forwarded bool `json:"forwarded,omitempty"` + + // ID of the report. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Array of rules that were broken according to this report. + // Will be empty if no rule IDs were submitted with the report. + Rules []*InstanceRule `json:"rules"` + + // Array of statuses that were submitted along with this report. + // Will be empty if no status IDs were submitted with the report. + Statuses []*Status `json:"statuses"` + + // Time of last action on this report (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + UpdatedAt string `json:"updated_at,omitempty"` + + // account + Account *AdminAccountInfo `json:"account,omitempty"` + + // action taken by account + ActionTakenByAccount *AdminAccountInfo `json:"action_taken_by_account,omitempty"` + + // assigned account + AssignedAccount *AdminAccountInfo `json:"assigned_account,omitempty"` + + // target account + TargetAccount *AdminAccountInfo `json:"target_account,omitempty"` +} + +// Validate validates this admin report +func (m *AdminReport) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateActionTakenByAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAssignedAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTargetAccount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminReport) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + for i := 0; i < len(m.Statuses); i++ { + if swag.IsZero(m.Statuses[i]) { // not required + continue + } + + if m.Statuses[i] != nil { + if err := m.Statuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) validateActionTakenByAccount(formats strfmt.Registry) error { + if swag.IsZero(m.ActionTakenByAccount) { // not required + return nil + } + + if m.ActionTakenByAccount != nil { + if err := m.ActionTakenByAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("action_taken_by_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("action_taken_by_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) validateAssignedAccount(formats strfmt.Registry) error { + if swag.IsZero(m.AssignedAccount) { // not required + return nil + } + + if m.AssignedAccount != nil { + if err := m.AssignedAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assigned_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("assigned_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) validateTargetAccount(formats strfmt.Registry) error { + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if m.TargetAccount != nil { + if err := m.TargetAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// ContextValidate validate this admin report based on the context it is used +func (m *AdminReport) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateActionTakenByAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAssignedAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTargetAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *AdminReport) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Statuses); i++ { + + if m.Statuses[i] != nil { + + if swag.IsZero(m.Statuses[i]) { // not required + return nil + } + + if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *AdminReport) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) contextValidateActionTakenByAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.ActionTakenByAccount != nil { + + if swag.IsZero(m.ActionTakenByAccount) { // not required + return nil + } + + if err := m.ActionTakenByAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("action_taken_by_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("action_taken_by_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) contextValidateAssignedAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.AssignedAccount != nil { + + if swag.IsZero(m.AssignedAccount) { // not required + return nil + } + + if err := m.AssignedAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("assigned_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("assigned_account") + } + return err + } + } + + return nil +} + +func (m *AdminReport) contextValidateTargetAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.TargetAccount != nil { + + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if err := m.TargetAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *AdminReport) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *AdminReport) UnmarshalBinary(b []byte) error { + var res AdminReport + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/application.go b/models/application.go new file mode 100644 index 0000000..73cf1ca --- /dev/null +++ b/models/application.go @@ -0,0 +1,72 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Application Application models an api application. +// +// swagger:model Application +type Application struct { + + // Client ID associated with this application. + ClientID string `json:"client_id,omitempty"` + + // Client secret associated with this application. + ClientSecret string `json:"client_secret,omitempty"` + + // The ID of the application. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // The name of the application. + // Example: Tusky + Name string `json:"name,omitempty"` + + // Post-authorization redirect URI for the application (OAuth2). + // Example: https://example.org/callback?some=query + RedirectURI string `json:"redirect_uri,omitempty"` + + // Push API key for this application. + VapidKey string `json:"vapid_key,omitempty"` + + // The website associated with the application (url) + // Example: https://tusky.app + Website string `json:"website,omitempty"` +} + +// Validate validates this application +func (m *Application) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this application based on context it is used +func (m *Application) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Application) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Application) UnmarshalBinary(b []byte) error { + var res Application + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/attachment.go b/models/attachment.go new file mode 100644 index 0000000..ff49da6 --- /dev/null +++ b/models/attachment.go @@ -0,0 +1,147 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Attachment Attachment models a media attachment. +// +// swagger:model Attachment +type Attachment struct { + + // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. + // See https://github.com/woltapp/blurhash + Blurhash string `json:"blurhash,omitempty"` + + // Alt text that describes what is in the media attachment. + // Example: This is a picture of a kitten. + Description string `json:"description,omitempty"` + + // The ID of the attachment. + // Example: 01FC31DZT1AYWDZ8XTCRWRBYRK + ID string `json:"id,omitempty"` + + // The location of a scaled-down preview of the attachment on the remote server. + // Only defined for instances other than our own. + // Example: https://some-other-server.org/attachments/small/ahhhhh.jpeg + PreviewRemoteURL string `json:"preview_remote_url,omitempty"` + + // The location of a scaled-down preview of the attachment. + // Example: https://example.org/fileserver/some_id/attachments/some_id/small/attachment.jpeg + PreviewURL string `json:"preview_url,omitempty"` + + // The location of the full-size original attachment on the remote server. + // Only defined for instances other than our own. + // Example: https://some-other-server.org/attachments/original/ahhhhh.jpeg + RemoteURL string `json:"remote_url,omitempty"` + + // A shorter URL for the attachment. + // In our case, we just give the URL again since we don't create smaller URLs. + TextURL string `json:"text_url,omitempty"` + + // The type of the attachment. + // Example: image + Type string `json:"type,omitempty"` + + // The location of the original full-size attachment. + // Example: https://example.org/fileserver/some_id/attachments/some_id/original/attachment.jpeg + URL string `json:"url,omitempty"` + + // meta + Meta *MediaMeta `json:"meta,omitempty"` +} + +// Validate validates this attachment +func (m *Attachment) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateMeta(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Attachment) validateMeta(formats strfmt.Registry) error { + if swag.IsZero(m.Meta) { // not required + return nil + } + + if m.Meta != nil { + if err := m.Meta.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("meta") + } + return err + } + } + + return nil +} + +// ContextValidate validate this attachment based on the context it is used +func (m *Attachment) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateMeta(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Attachment) contextValidateMeta(ctx context.Context, formats strfmt.Registry) error { + + if m.Meta != nil { + + if swag.IsZero(m.Meta) { // not required + return nil + } + + if err := m.Meta.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("meta") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("meta") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Attachment) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Attachment) UnmarshalBinary(b []byte) error { + var res Attachment + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/card.go b/models/card.go new file mode 100644 index 0000000..1e0be9e --- /dev/null +++ b/models/card.go @@ -0,0 +1,98 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Card Card represents a rich preview card that is generated using OpenGraph tags from a URL. +// +// swagger:model Card +type Card struct { + + // The author of the original resource. + // Example: weewee@buzzfeed.com + AuthorName string `json:"author_name,omitempty"` + + // A link to the author of the original resource. + // Example: https://buzzfeed.com/authors/weewee + AuthorURL string `json:"author_url,omitempty"` + + // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. + Blurhash string `json:"blurhash,omitempty"` + + // Description of preview. + // Example: Is water wet? We're not sure. In this article, we ask an expert... + Description string `json:"description,omitempty"` + + // Used for photo embeds, instead of custom html. + EmbedURL string `json:"embed_url,omitempty"` + + // HTML to be used for generating the preview card. + HTML string `json:"html,omitempty"` + + // Height of preview, in pixels. + Height int64 `json:"height,omitempty"` + + // Preview thumbnail. + // Example: https://example.org/fileserver/preview/thumb.jpg + Image string `json:"image,omitempty"` + + // The provider of the original resource. + // Example: Buzzfeed + ProviderName string `json:"provider_name,omitempty"` + + // A link to the provider of the original resource. + // Example: https://buzzfeed.com + ProviderURL string `json:"provider_url,omitempty"` + + // Title of linked resource. + // Example: Buzzfeed - Is Water Wet? + Title string `json:"title,omitempty"` + + // The type of the preview card. + // Example: link + Type string `json:"type,omitempty"` + + // Location of linked resource. + // Example: https://buzzfeed.com/some/fuckin/buzzfeed/article + URL string `json:"url,omitempty"` + + // Width of preview, in pixels. + Width int64 `json:"width,omitempty"` +} + +// Validate validates this card +func (m *Card) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this card based on context it is used +func (m *Card) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Card) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Card) UnmarshalBinary(b []byte) error { + var res Card + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/conversation.go b/models/conversation.go new file mode 100644 index 0000000..1b18f88 --- /dev/null +++ b/models/conversation.go @@ -0,0 +1,179 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Conversation Conversation represents a conversation +// with "direct message" visibility. +// +// swagger:model Conversation +type Conversation struct { + + // Participants in the conversation. + Accounts []*Account `json:"accounts"` + + // Local database ID of the conversation. + ID string `json:"id,omitempty"` + + // Is the conversation currently marked as unread? + Unread bool `json:"unread,omitempty"` + + // last status + LastStatus *Status `json:"last_status,omitempty"` +} + +// Validate validates this conversation +func (m *Conversation) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLastStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Conversation) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + for i := 0; i < len(m.Accounts); i++ { + if swag.IsZero(m.Accounts[i]) { // not required + continue + } + + if m.Accounts[i] != nil { + if err := m.Accounts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Conversation) validateLastStatus(formats strfmt.Registry) error { + if swag.IsZero(m.LastStatus) { // not required + return nil + } + + if m.LastStatus != nil { + if err := m.LastStatus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last_status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this conversation based on the context it is used +func (m *Conversation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLastStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Conversation) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Accounts); i++ { + + if m.Accounts[i] != nil { + + if swag.IsZero(m.Accounts[i]) { // not required + return nil + } + + if err := m.Accounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Conversation) contextValidateLastStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.LastStatus != nil { + + if swag.IsZero(m.LastStatus) { // not required + return nil + } + + if err := m.LastStatus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last_status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last_status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Conversation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Conversation) UnmarshalBinary(b []byte) error { + var res Conversation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/debug_a_p_url_response.go b/models/debug_a_p_url_response.go new file mode 100644 index 0000000..a23eefb --- /dev/null +++ b/models/debug_a_p_url_response.go @@ -0,0 +1,65 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DebugAPURLResponse DebugAPUrlResponse provides detailed debug +// information for an AP URL dereference request. +// +// swagger:model DebugAPUrlResponse +type DebugAPURLResponse struct { + + // HTTP headers used in the outgoing request. + RequestHeaders map[string][]string `json:"request_headers,omitempty"` + + // Remote AP URL that was requested. + RequestURL string `json:"request_url,omitempty"` + + // Body returned from the remote instance. + // Will be stringified bytes; may be JSON, + // may be an error, may be both! + ResponseBody string `json:"response_body,omitempty"` + + // HTTP response code returned from the remote instance. + ResponseCode int64 `json:"response_code,omitempty"` + + // HTTP headers returned from the remote instance. + ResponseHeaders map[string][]string `json:"response_headers,omitempty"` +} + +// Validate validates this debug a p Url response +func (m *DebugAPURLResponse) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this debug a p Url response based on context it is used +func (m *DebugAPURLResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *DebugAPURLResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DebugAPURLResponse) UnmarshalBinary(b []byte) error { + var res DebugAPURLResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/default_policies.go b/models/default_policies.go new file mode 100644 index 0000000..d07a417 --- /dev/null +++ b/models/default_policies.go @@ -0,0 +1,262 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// DefaultPolicies Default interaction policies to use for new statuses by requesting account. +// +// swagger:model DefaultPolicies +type DefaultPolicies struct { + + // direct + Direct *InteractionPolicy `json:"direct,omitempty"` + + // private + Private *InteractionPolicy `json:"private,omitempty"` + + // public + Public *InteractionPolicy `json:"public,omitempty"` + + // unlisted + Unlisted *InteractionPolicy `json:"unlisted,omitempty"` +} + +// Validate validates this default policies +func (m *DefaultPolicies) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateDirect(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePrivate(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePublic(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUnlisted(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DefaultPolicies) validateDirect(formats strfmt.Registry) error { + if swag.IsZero(m.Direct) { // not required + return nil + } + + if m.Direct != nil { + if err := m.Direct.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("direct") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("direct") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) validatePrivate(formats strfmt.Registry) error { + if swag.IsZero(m.Private) { // not required + return nil + } + + if m.Private != nil { + if err := m.Private.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("private") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("private") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) validatePublic(formats strfmt.Registry) error { + if swag.IsZero(m.Public) { // not required + return nil + } + + if m.Public != nil { + if err := m.Public.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("public") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("public") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) validateUnlisted(formats strfmt.Registry) error { + if swag.IsZero(m.Unlisted) { // not required + return nil + } + + if m.Unlisted != nil { + if err := m.Unlisted.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unlisted") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unlisted") + } + return err + } + } + + return nil +} + +// ContextValidate validate this default policies based on the context it is used +func (m *DefaultPolicies) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateDirect(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePrivate(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePublic(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUnlisted(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DefaultPolicies) contextValidateDirect(ctx context.Context, formats strfmt.Registry) error { + + if m.Direct != nil { + + if swag.IsZero(m.Direct) { // not required + return nil + } + + if err := m.Direct.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("direct") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("direct") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) contextValidatePrivate(ctx context.Context, formats strfmt.Registry) error { + + if m.Private != nil { + + if swag.IsZero(m.Private) { // not required + return nil + } + + if err := m.Private.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("private") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("private") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) contextValidatePublic(ctx context.Context, formats strfmt.Registry) error { + + if m.Public != nil { + + if swag.IsZero(m.Public) { // not required + return nil + } + + if err := m.Public.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("public") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("public") + } + return err + } + } + + return nil +} + +func (m *DefaultPolicies) contextValidateUnlisted(ctx context.Context, formats strfmt.Registry) error { + + if m.Unlisted != nil { + + if swag.IsZero(m.Unlisted) { // not required + return nil + } + + if err := m.Unlisted.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("unlisted") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("unlisted") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DefaultPolicies) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DefaultPolicies) UnmarshalBinary(b []byte) error { + var res DefaultPolicies + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/domain.go b/models/domain.go new file mode 100644 index 0000000..8d9ec88 --- /dev/null +++ b/models/domain.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Domain Domain represents a remote domain +// +// swagger:model Domain +type Domain struct { + + // The hostname of the domain. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // If the domain is blocked, what's the publicly-stated reason for the block. + // Example: they smell + PublicComment string `json:"public_comment,omitempty"` + + // Time at which this domain was silenced. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SilencedAt string `json:"silenced_at,omitempty"` + + // Time at which this domain was suspended. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SuspendedAt string `json:"suspended_at,omitempty"` +} + +// Validate validates this domain +func (m *Domain) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this domain based on context it is used +func (m *Domain) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Domain) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Domain) UnmarshalBinary(b []byte) error { + var res Domain + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/domain_permission.go b/models/domain_permission.go new file mode 100644 index 0000000..f2af5f3 --- /dev/null +++ b/models/domain_permission.go @@ -0,0 +1,108 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// DomainPermission DomainPermission represents a permission applied to one domain (explicit block/allow). +// +// swagger:model DomainPermission +type DomainPermission struct { + + // Time at which the permission entry was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // ID of the account that created this domain permission entry. + // Example: 01FBW2758ZB6PBR200YPDDJK4C + CreatedBy string `json:"created_by,omitempty"` + + // The hostname of the domain. + // Example: example.org + Domain string `json:"domain,omitempty"` + + // The ID of the domain permission entry. + // Example: 01FBW21XJA09XYX51KV5JVBW0F + // Read Only: true + ID string `json:"id,omitempty"` + + // Obfuscate the domain name when serving this domain permission entry publicly. + // Example: false + Obfuscate bool `json:"obfuscate,omitempty"` + + // Private comment for this permission entry, visible to this instance's admins only. + // Example: they are poopoo + PrivateComment string `json:"private_comment,omitempty"` + + // If the domain is blocked, what's the publicly-stated reason for the block. + // Example: they smell + PublicComment string `json:"public_comment,omitempty"` + + // Time at which this domain was silenced. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SilencedAt string `json:"silenced_at,omitempty"` + + // If applicable, the ID of the subscription that caused this domain permission entry to be created. + // Example: 01FBW25TF5J67JW3HFHZCSD23K + SubscriptionID string `json:"subscription_id,omitempty"` + + // Time at which this domain was suspended. Key will not be present on open domains. + // Example: 2021-07-30T09:20:25+00:00 + SuspendedAt string `json:"suspended_at,omitempty"` +} + +// Validate validates this domain permission +func (m *DomainPermission) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this domain permission based on the context it is used +func (m *DomainPermission) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *DomainPermission) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *DomainPermission) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *DomainPermission) UnmarshalBinary(b []byte) error { + var res DomainPermission + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/emoji.go b/models/emoji.go new file mode 100644 index 0000000..94a2a61 --- /dev/null +++ b/models/emoji.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Emoji Emoji represents a custom emoji. +// +// swagger:model Emoji +type Emoji struct { + + // Used for sorting custom emoji in the picker. + // Example: blobcats + Category string `json:"category,omitempty"` + + // The name of the custom emoji. + // Example: blobcat_uwu + Shortcode string `json:"shortcode,omitempty"` + + // A link to a static copy of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.png + StaticURL string `json:"static_url,omitempty"` + + // Web URL of the custom emoji. + // Example: https://example.org/fileserver/emojis/blogcat_uwu.gif + URL string `json:"url,omitempty"` + + // Emoji is visible in the emoji picker of the instance. + // Example: true + VisibleInPicker bool `json:"visible_in_picker,omitempty"` +} + +// Validate validates this emoji +func (m *Emoji) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this emoji based on context it is used +func (m *Emoji) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Emoji) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Emoji) UnmarshalBinary(b []byte) error { + var res Emoji + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/emoji_category.go b/models/emoji_category.go new file mode 100644 index 0000000..ce6138f --- /dev/null +++ b/models/emoji_category.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// EmojiCategory EmojiCategory represents a custom emoji category. +// +// swagger:model EmojiCategory +type EmojiCategory struct { + + // The ID of the custom emoji category. + ID string `json:"id,omitempty"` + + // The name of the custom emoji category. + Name string `json:"name,omitempty"` +} + +// Validate validates this emoji category +func (m *EmojiCategory) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this emoji category based on context it is used +func (m *EmojiCategory) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *EmojiCategory) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *EmojiCategory) UnmarshalBinary(b []byte) error { + var res EmojiCategory + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/field.go b/models/field.go new file mode 100644 index 0000000..4ed8336 --- /dev/null +++ b/models/field.go @@ -0,0 +1,59 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Field Field represents a name/value pair to display on an account's profile. +// +// swagger:model Field +type Field struct { + + // The key/name of this field. + // Example: pronouns + Name string `json:"name,omitempty"` + + // The value of this field. + // Example: they/them + Value string `json:"value,omitempty"` + + // If this field has been verified, when did this occur? (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + VerifiedAt string `json:"verified_at,omitempty"` +} + +// Validate validates this field +func (m *Field) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this field based on context it is used +func (m *Field) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Field) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Field) UnmarshalBinary(b []byte) error { + var res Field + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/filter_action.go b/models/filter_action.go new file mode 100644 index 0000000..b0c3545 --- /dev/null +++ b/models/filter_action.go @@ -0,0 +1,27 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// FilterAction FilterAction is the action to apply to statuses matching a filter. +// +// swagger:model FilterAction +type FilterAction string + +// Validate validates this filter action +func (m FilterAction) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter action based on context it is used +func (m FilterAction) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/filter_context.go b/models/filter_context.go new file mode 100644 index 0000000..0c7c840 --- /dev/null +++ b/models/filter_context.go @@ -0,0 +1,29 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// FilterContext FilterContext represents the context in which to apply a filter. +// +// v1 and v2 filter APIs use the same set of contexts. +// +// swagger:model FilterContext +type FilterContext string + +// Validate validates this filter context +func (m FilterContext) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter context based on context it is used +func (m FilterContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/filter_keyword.go b/models/filter_keyword.go new file mode 100644 index 0000000..951a4a7 --- /dev/null +++ b/models/filter_keyword.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// FilterKeyword FilterKeyword represents text to filter within a v2 filter. +// +// swagger:model FilterKeyword +type FilterKeyword struct { + + // The ID of the filter keyword entry in the database. + ID string `json:"id,omitempty"` + + // The text to be filtered. + // Example: fnord + Keyword string `json:"keyword,omitempty"` + + // Should the filter keyword consider word boundaries? + // Example: true + WholeWord bool `json:"whole_word,omitempty"` +} + +// Validate validates this filter keyword +func (m *FilterKeyword) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter keyword based on context it is used +func (m *FilterKeyword) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *FilterKeyword) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterKeyword) UnmarshalBinary(b []byte) error { + var res FilterKeyword + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/filter_result.go b/models/filter_result.go new file mode 100644 index 0000000..883abe2 --- /dev/null +++ b/models/filter_result.go @@ -0,0 +1,115 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// FilterResult FilterResult is returned along with a filtered status to explain why it was filtered. +// +// swagger:model FilterResult +type FilterResult struct { + + // The keywords within the filter that were matched. + KeywordMatches []string `json:"keyword_matches"` + + // The status IDs within the filter that were matched. + StatusMatches []string `json:"status_matches"` + + // filter + Filter *FilterV2 `json:"filter,omitempty"` +} + +// Validate validates this filter result +func (m *FilterResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFilter(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterResult) validateFilter(formats strfmt.Registry) error { + if swag.IsZero(m.Filter) { // not required + return nil + } + + if m.Filter != nil { + if err := m.Filter.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter") + } + return err + } + } + + return nil +} + +// ContextValidate validate this filter result based on the context it is used +func (m *FilterResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFilter(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterResult) contextValidateFilter(ctx context.Context, formats strfmt.Registry) error { + + if m.Filter != nil { + + if swag.IsZero(m.Filter) { // not required + return nil + } + + if err := m.Filter.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *FilterResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterResult) UnmarshalBinary(b []byte) error { + var res FilterResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/filter_status.go b/models/filter_status.go new file mode 100644 index 0000000..5578893 --- /dev/null +++ b/models/filter_status.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// FilterStatus FilterStatus represents a single status to filter within a v2 filter. +// +// swagger:model FilterStatus +type FilterStatus struct { + + // The ID of the filter status entry in the database. + ID string `json:"id,omitempty"` + + // The status ID to be filtered. + StatusID string `json:"phrase,omitempty"` +} + +// Validate validates this filter status +func (m *FilterStatus) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this filter status based on context it is used +func (m *FilterStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *FilterStatus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterStatus) UnmarshalBinary(b []byte) error { + var res FilterStatus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/filter_v1.go b/models/filter_v1.go new file mode 100644 index 0000000..400bc28 --- /dev/null +++ b/models/filter_v1.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// FilterV1 FilterV1 represents a user-defined filter for determining which statuses should not be shown to the user. +// +// Note that v1 filters are mapped to v2 filters and v2 filter keywords internally. +// If whole_word is true, client app should do: +// Define ‘word constituent character’ for your app. In the official implementation, it’s [A-Za-z0-9_] in JavaScript, and [[:word:]] in Ruby. +// Ruby uses the POSIX character class (Letter | Mark | Decimal_Number | Connector_Punctuation). +// If the phrase starts with a word character, and if the previous character before matched range is a word character, its matched range should be treated to not match. +// If the phrase ends with a word character, and if the next character after matched range is a word character, its matched range should be treated to not match. +// Please check app/javascript/mastodon/selectors/index.js and app/lib/feed_manager.rb in the Mastodon source code for more details. +// +// swagger:model FilterV1 +type FilterV1 struct { + + // The contexts in which the filter should be applied. + // Example: ["home","public"] + // Min Items: 1 + // Unique: true + Context []FilterContext `json:"context"` + + // When the filter should no longer be applied. Null if the filter does not expire. + // Example: 2024-02-01T02:57:49Z + ExpiresAt string `json:"expires_at,omitempty"` + + // The ID of the filter in the database. + ID string `json:"id,omitempty"` + + // Should matching entities be removed from the user's timelines/views, instead of hidden? + // Example: false + Irreversible bool `json:"irreversible,omitempty"` + + // The text to be filtered. + // Example: fnord + Phrase string `json:"phrase,omitempty"` + + // Should the filter consider word boundaries? + // Example: true + WholeWord bool `json:"whole_word,omitempty"` +} + +// Validate validates this filter v1 +func (m *FilterV1) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContext(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV1) validateContext(formats strfmt.Registry) error { + if swag.IsZero(m.Context) { // not required + return nil + } + + iContextSize := int64(len(m.Context)) + + if err := validate.MinItems("context", "body", iContextSize, 1); err != nil { + return err + } + + if err := validate.UniqueItems("context", "body", m.Context); err != nil { + return err + } + + for i := 0; i < len(m.Context); i++ { + + if err := m.Context[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// ContextValidate validate this filter v1 based on the context it is used +func (m *FilterV1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateContext(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV1) contextValidateContext(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Context); i++ { + + if swag.IsZero(m.Context[i]) { // not required + return nil + } + + if err := m.Context[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *FilterV1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterV1) UnmarshalBinary(b []byte) error { + var res FilterV1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/filter_v2.go b/models/filter_v2.go new file mode 100644 index 0000000..9733aff --- /dev/null +++ b/models/filter_v2.go @@ -0,0 +1,310 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// FilterV2 FilterV2 represents a user-defined filter for determining which statuses should not be shown to the user. +// +// v2 filters have names and can include multiple phrases and status IDs to filter. +// +// swagger:model FilterV2 +type FilterV2 struct { + + // The contexts in which the filter should be applied. + // Example: ["home","public"] + // Min Items: 1 + // Unique: true + Context []FilterContext `json:"context"` + + // When the filter should no longer be applied. Null if the filter does not expire. + // Example: 2024-02-01T02:57:49Z + ExpiresAt string `json:"expires_at,omitempty"` + + // The ID of the filter in the database. + ID string `json:"id,omitempty"` + + // The keywords grouped under this filter. + Keywords []*FilterKeyword `json:"keywords"` + + // The statuses grouped under this filter. + Statuses []*FilterStatus `json:"statuses"` + + // The name of the filter. + // Example: Linux Words + Title string `json:"title,omitempty"` + + // filter action + FilterAction FilterAction `json:"filter_action,omitempty"` +} + +// Validate validates this filter v2 +func (m *FilterV2) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateContext(formats); err != nil { + res = append(res, err) + } + + if err := m.validateKeywords(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFilterAction(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV2) validateContext(formats strfmt.Registry) error { + if swag.IsZero(m.Context) { // not required + return nil + } + + iContextSize := int64(len(m.Context)) + + if err := validate.MinItems("context", "body", iContextSize, 1); err != nil { + return err + } + + if err := validate.UniqueItems("context", "body", m.Context); err != nil { + return err + } + + for i := 0; i < len(m.Context); i++ { + + if err := m.Context[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *FilterV2) validateKeywords(formats strfmt.Registry) error { + if swag.IsZero(m.Keywords) { // not required + return nil + } + + for i := 0; i < len(m.Keywords); i++ { + if swag.IsZero(m.Keywords[i]) { // not required + continue + } + + if m.Keywords[i] != nil { + if err := m.Keywords[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keywords" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keywords" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + for i := 0; i < len(m.Statuses); i++ { + if swag.IsZero(m.Statuses[i]) { // not required + continue + } + + if m.Statuses[i] != nil { + if err := m.Statuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) validateFilterAction(formats strfmt.Registry) error { + if swag.IsZero(m.FilterAction) { // not required + return nil + } + + if err := m.FilterAction.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter_action") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter_action") + } + return err + } + + return nil +} + +// ContextValidate validate this filter v2 based on the context it is used +func (m *FilterV2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateContext(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateKeywords(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFilterAction(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *FilterV2) contextValidateContext(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Context); i++ { + + if swag.IsZero(m.Context[i]) { // not required + return nil + } + + if err := m.Context[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("context" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("context" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *FilterV2) contextValidateKeywords(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Keywords); i++ { + + if m.Keywords[i] != nil { + + if swag.IsZero(m.Keywords[i]) { // not required + return nil + } + + if err := m.Keywords[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("keywords" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("keywords" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Statuses); i++ { + + if m.Statuses[i] != nil { + + if swag.IsZero(m.Statuses[i]) { // not required + return nil + } + + if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *FilterV2) contextValidateFilterAction(ctx context.Context, formats strfmt.Registry) error { + + if swag.IsZero(m.FilterAction) { // not required + return nil + } + + if err := m.FilterAction.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filter_action") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filter_action") + } + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *FilterV2) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *FilterV2) UnmarshalBinary(b []byte) error { + var res FilterV2 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/header_filter.go b/models/header_filter.go new file mode 100644 index 0000000..d73b718 --- /dev/null +++ b/models/header_filter.go @@ -0,0 +1,116 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" + "github.com/go-openapi/validate" +) + +// HeaderFilter HeaderFilter represents a regex value filter applied to one particular HTTP header (allow / block). +// +// swagger:model HeaderFilter +type HeaderFilter struct { + + // Time at which the header filter was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + // Read Only: true + CreatedAt string `json:"created_at,omitempty"` + + // The ID of the admin account that created this header filter. + // Example: 01FBW2758ZB6PBR200YPDDJK4C + // Read Only: true + CreatedBy string `json:"created_by,omitempty"` + + // The HTTP header to match against. + // Example: User-Agent + Header string `json:"header,omitempty"` + + // The ID of the header filter. + // Example: 01FBW21XJA09XYX51KV5JVBW0F + // Read Only: true + ID string `json:"id,omitempty"` + + // The header value matching regular expression. + // Example: .*Firefox.* + Regex string `json:"regex,omitempty"` +} + +// Validate validates this header filter +func (m *HeaderFilter) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validate this header filter based on the context it is used +func (m *HeaderFilter) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCreatedAt(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCreatedBy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateID(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HeaderFilter) contextValidateCreatedAt(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created_at", "body", string(m.CreatedAt)); err != nil { + return err + } + + return nil +} + +func (m *HeaderFilter) contextValidateCreatedBy(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "created_by", "body", string(m.CreatedBy)); err != nil { + return err + } + + return nil +} + +func (m *HeaderFilter) contextValidateID(ctx context.Context, formats strfmt.Registry) error { + + if err := validate.ReadOnly(ctx, "id", "body", string(m.ID)); err != nil { + return err + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HeaderFilter) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HeaderFilter) UnmarshalBinary(b []byte) error { + var res HeaderFilter + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/host_meta.go b/models/host_meta.go new file mode 100644 index 0000000..6e64627 --- /dev/null +++ b/models/host_meta.go @@ -0,0 +1,129 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// HostMeta HostMeta represents a hostmeta document. +// +// See: https://www.rfc-editor.org/rfc/rfc6415.html#section-3 +// +// swagger:model HostMeta +type HostMeta struct { + + // link + Link []*Link `json:"Link"` + + // XML n s + XMLNS string `json:"XMLNS,omitempty"` + + // XML name + XMLName interface{} `json:"XMLName,omitempty"` +} + +// Validate validates this host meta +func (m *HostMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLink(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostMeta) validateLink(formats strfmt.Registry) error { + if swag.IsZero(m.Link) { // not required + return nil + } + + for i := 0; i < len(m.Link); i++ { + if swag.IsZero(m.Link[i]) { // not required + continue + } + + if m.Link[i] != nil { + if err := m.Link[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Link" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Link" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this host meta based on the context it is used +func (m *HostMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLink(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *HostMeta) contextValidateLink(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Link); i++ { + + if m.Link[i] != nil { + + if swag.IsZero(m.Link[i]) { // not required + return nil + } + + if err := m.Link[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("Link" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("Link" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *HostMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *HostMeta) UnmarshalBinary(b []byte) error { + var res HostMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_configuration_accounts.go b/models/instance_configuration_accounts.go new file mode 100644 index 0000000..3f9430a --- /dev/null +++ b/models/instance_configuration_accounts.go @@ -0,0 +1,59 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationAccounts InstanceConfigurationAccounts models instance account config parameters. +// +// swagger:model InstanceConfigurationAccounts +type InstanceConfigurationAccounts struct { + + // Whether or not accounts on this instance are allowed to upload custom CSS for profiles and statuses. + // Example: false + AllowCustomCSS bool `json:"allow_custom_css,omitempty"` + + // The maximum number of featured tags allowed for each account. + // Currently not implemented, so this is hardcoded to 10. + MaxFeaturedTags int64 `json:"max_featured_tags,omitempty"` + + // The maximum number of profile fields allowed for each account. + // Currently not configurable, so this is hardcoded to 6. (https://github.com/superseriousbusiness/gotosocial/issues/1876) + MaxProfileFields int64 `json:"max_profile_fields,omitempty"` +} + +// Validate validates this instance configuration accounts +func (m *InstanceConfigurationAccounts) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration accounts based on context it is used +func (m *InstanceConfigurationAccounts) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationAccounts) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationAccounts) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationAccounts + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_configuration_emojis.go b/models/instance_configuration_emojis.go new file mode 100644 index 0000000..192664c --- /dev/null +++ b/models/instance_configuration_emojis.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationEmojis InstanceConfigurationEmojis models instance emoji config parameters. +// +// swagger:model InstanceConfigurationEmojis +type InstanceConfigurationEmojis struct { + + // Max allowed emoji image size in bytes. + // Example: 51200 + EmojiSizeLimit int64 `json:"emoji_size_limit,omitempty"` +} + +// Validate validates this instance configuration emojis +func (m *InstanceConfigurationEmojis) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration emojis based on context it is used +func (m *InstanceConfigurationEmojis) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationEmojis) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationEmojis) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationEmojis + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_configuration_media_attachments.go b/models/instance_configuration_media_attachments.go new file mode 100644 index 0000000..9c0d713 --- /dev/null +++ b/models/instance_configuration_media_attachments.go @@ -0,0 +1,77 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationMediaAttachments InstanceConfigurationMediaAttachments models instance media attachment config parameters. +// +// swagger:model InstanceConfigurationMediaAttachments +type InstanceConfigurationMediaAttachments struct { + + // Max allowed image size in pixels as height*width. + // + // GtS doesn't set a limit on this, but for compatibility + // we give Mastodon's 4096x4096px value here. + // Example: 16777216 + ImageMatrixLimit int64 `json:"image_matrix_limit,omitempty"` + + // Max allowed image size in bytes + // Example: 2097152 + ImageSizeLimit int64 `json:"image_size_limit,omitempty"` + + // List of mime types that it's possible to upload to this instance. + // Example: ["image/jpeg","image/gif"] + SupportedMimeTypes []string `json:"supported_mime_types"` + + // Max allowed video frame rate. + // Example: 60 + VideoFrameRateLimit int64 `json:"video_frame_rate_limit,omitempty"` + + // Max allowed video size in pixels as height*width. + // + // GtS doesn't set a limit on this, but for compatibility + // we give Mastodon's 4096x4096px value here. + // Example: 16777216 + VideoMatrixLimit int64 `json:"video_matrix_limit,omitempty"` + + // Max allowed video size in bytes + // Example: 10485760 + VideoSizeLimit int64 `json:"video_size_limit,omitempty"` +} + +// Validate validates this instance configuration media attachments +func (m *InstanceConfigurationMediaAttachments) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration media attachments based on context it is used +func (m *InstanceConfigurationMediaAttachments) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationMediaAttachments) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationMediaAttachments) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationMediaAttachments + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_configuration_polls.go b/models/instance_configuration_polls.go new file mode 100644 index 0000000..5362ebb --- /dev/null +++ b/models/instance_configuration_polls.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationPolls InstanceConfigurationPolls models instance poll config parameters. +// +// swagger:model InstanceConfigurationPolls +type InstanceConfigurationPolls struct { + + // Number of characters allowed per option in the poll. + // Example: 50 + MaxCharactersPerOption int64 `json:"max_characters_per_option,omitempty"` + + // Maximum expiration time of the poll in seconds. + // Example: 2629746 + MaxExpiration int64 `json:"max_expiration,omitempty"` + + // Number of options permitted in a poll on this instance. + // Example: 4 + MaxOptions int64 `json:"max_options,omitempty"` + + // Minimum expiration time of the poll in seconds. + // Example: 300 + MinExpiration int64 `json:"min_expiration,omitempty"` +} + +// Validate validates this instance configuration polls +func (m *InstanceConfigurationPolls) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration polls based on context it is used +func (m *InstanceConfigurationPolls) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationPolls) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationPolls) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationPolls + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_configuration_statuses.go b/models/instance_configuration_statuses.go new file mode 100644 index 0000000..f64019f --- /dev/null +++ b/models/instance_configuration_statuses.go @@ -0,0 +1,63 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceConfigurationStatuses InstanceConfigurationStatuses models instance status config parameters. +// +// swagger:model InstanceConfigurationStatuses +type InstanceConfigurationStatuses struct { + + // Amount of characters clients should assume a url takes up. + // Example: 25 + CharactersReservedPerURL int64 `json:"characters_reserved_per_url,omitempty"` + + // Maximum allowed length of a post on this instance, in characters. + // Example: 5000 + MaxCharacters int64 `json:"max_characters,omitempty"` + + // Max number of attachments allowed on a status. + // Example: 4 + MaxMediaAttachments int64 `json:"max_media_attachments,omitempty"` + + // List of mime types that it's possible to use for statuses on this instance. + // Example: ["text/plain","text/markdown"] + SupportedMimeTypes []string `json:"supported_mime_types"` +} + +// Validate validates this instance configuration statuses +func (m *InstanceConfigurationStatuses) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance configuration statuses based on context it is used +func (m *InstanceConfigurationStatuses) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceConfigurationStatuses) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceConfigurationStatuses) UnmarshalBinary(b []byte) error { + var res InstanceConfigurationStatuses + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_rule.go b/models/instance_rule.go new file mode 100644 index 0000000..10cbe54 --- /dev/null +++ b/models/instance_rule.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceRule InstanceRule represents a single instance rule. +// +// swagger:model InstanceRule +type InstanceRule struct { + + // ID + ID string `json:"id,omitempty"` + + // text + Text string `json:"text,omitempty"` +} + +// Validate validates this instance rule +func (m *InstanceRule) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance rule based on context it is used +func (m *InstanceRule) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceRule) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceRule) UnmarshalBinary(b []byte) error { + var res InstanceRule + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v1.go b/models/instance_v1.go new file mode 100644 index 0000000..5ecb922 --- /dev/null +++ b/models/instance_v1.go @@ -0,0 +1,373 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV1 InstanceV1 models information about this instance. +// +// swagger:model InstanceV1 +type InstanceV1 struct { + + // The domain of accounts on this instance. + // This will not necessarily be the same as + // simply the Host part of the URI. + // Example: example.org + AccountDomain string `json:"account_domain,omitempty"` + + // New account registrations require admin approval. + ApprovalRequired bool `json:"approval_required,omitempty"` + + // Whether or not instance is running in DEBUG mode. Omitted if false. + Debug bool `json:"debug,omitempty"` + + // Description of the instance. + // + // Should be HTML formatted, but might be plaintext. + // + // This should be displayed on the 'about' page for an instance. + Description string `json:"description,omitempty"` + + // Raw (unparsed) version of description. + DescriptionText string `json:"description_text,omitempty"` + + // An email address that may be used for inquiries. + // Example: admin@example.org + Email string `json:"email,omitempty"` + + // Invites are enabled on this instance. + InvitesEnabled bool `json:"invites_enabled,omitempty"` + + // Primary language of the instance. + // Example: ["en"] + Languages []string `json:"languages"` + + // Maximum allowed length of a post on this instance, in characters. + // + // This is provided for compatibility with Tusky and other apps. + // Example: 5000 + MaxTootChars uint64 `json:"max_toot_chars,omitempty"` + + // New account registrations are enabled on this instance. + Registrations bool `json:"registrations,omitempty"` + + // An itemized list of rules for this instance. + Rules []*InstanceRule `json:"rules"` + + // A shorter description of the instance. + // + // Should be HTML formatted, but might be plaintext. + // + // This should be displayed on the instance splash/landing page. + ShortDescription string `json:"short_description,omitempty"` + + // Raw (unparsed) version of short description. + ShortDescriptionText string `json:"short_description_text,omitempty"` + + // Statistics about the instance: number of posts, accounts, etc. + // Values are pointers because we don't want to skip 0 values when + // rendering stats via web templates. + Stats map[string]int64 `json:"stats,omitempty"` + + // Terms and conditions for accounts on this instance. + Terms string `json:"terms,omitempty"` + + // Raw (unparsed) version of terms. + TermsRaw string `json:"terms_text,omitempty"` + + // URL of the instance avatar/banner image. + // Example: https://example.org/files/instance/thumbnail.jpeg + Thumbnail string `json:"thumbnail,omitempty"` + + // Description of the instance thumbnail. + // Example: picture of a cute lil' friendly sloth + ThumbnailDescription string `json:"thumbnail_description,omitempty"` + + // URL of the static instance avatar/banner image. + // Example: https://example.org/files/instance/static/thumbnail.webp + ThumbnailStatic string `json:"thumbnail_static,omitempty"` + + // MIME type of the static instance thumbnail. + // Example: image/webp + ThumbnailStaticType string `json:"thumbnail_static_type,omitempty"` + + // MIME type of the instance thumbnail. + // Example: image/png + ThumbnailType string `json:"thumbnail_type,omitempty"` + + // The title of the instance. + // Example: GoToSocial Example Instance + Title string `json:"title,omitempty"` + + // The URI of the instance. + // Example: https://gts.example.org + URI string `json:"uri,omitempty"` + + // The version of GoToSocial installed on the instance. + // + // This will contain at least a semantic version number. + // + // It may also contain, after a space, the short git commit ID of the running software. + // Example: 0.1.1 cb85f65 + Version string `json:"version,omitempty"` + + // configuration + Configuration *InstanceV1Configuration `json:"configuration,omitempty"` + + // contact account + ContactAccount *Account `json:"contact_account,omitempty"` + + // urls + Urls *InstanceV1URLs `json:"urls,omitempty"` +} + +// Validate validates this instance v1 +func (m *InstanceV1) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if err := m.validateConfiguration(formats); err != nil { + res = append(res, err) + } + + if err := m.validateContactAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUrls(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV1) validateConfiguration(formats strfmt.Registry) error { + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if m.Configuration != nil { + if err := m.Configuration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) validateContactAccount(formats strfmt.Registry) error { + if swag.IsZero(m.ContactAccount) { // not required + return nil + } + + if m.ContactAccount != nil { + if err := m.ContactAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact_account") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) validateUrls(formats strfmt.Registry) error { + if swag.IsZero(m.Urls) { // not required + return nil + } + + if m.Urls != nil { + if err := m.Urls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v1 based on the context it is used +func (m *InstanceV1) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContactAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUrls(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV1) contextValidateConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.Configuration != nil { + + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if err := m.Configuration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) contextValidateContactAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.ContactAccount != nil { + + if swag.IsZero(m.ContactAccount) { // not required + return nil + } + + if err := m.ContactAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact_account") + } + return err + } + } + + return nil +} + +func (m *InstanceV1) contextValidateUrls(ctx context.Context, formats strfmt.Registry) error { + + if m.Urls != nil { + + if swag.IsZero(m.Urls) { // not required + return nil + } + + if err := m.Urls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV1) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV1) UnmarshalBinary(b []byte) error { + var res InstanceV1 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v1_configuration.go b/models/instance_v1_configuration.go new file mode 100644 index 0000000..24875b0 --- /dev/null +++ b/models/instance_v1_configuration.go @@ -0,0 +1,316 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV1Configuration InstanceV1Configuration models instance configuration parameters. +// +// swagger:model InstanceV1Configuration +type InstanceV1Configuration struct { + + // True if instance is running with OIDC as auth/identity backend, else omitted. + OIDCEnabled bool `json:"oidc_enabled,omitempty"` + + // accounts + Accounts *InstanceConfigurationAccounts `json:"accounts,omitempty"` + + // emojis + Emojis *InstanceConfigurationEmojis `json:"emojis,omitempty"` + + // media attachments + MediaAttachments *InstanceConfigurationMediaAttachments `json:"media_attachments,omitempty"` + + // polls + Polls *InstanceConfigurationPolls `json:"polls,omitempty"` + + // statuses + Statuses *InstanceConfigurationStatuses `json:"statuses,omitempty"` +} + +// Validate validates this instance v1 configuration +func (m *InstanceV1Configuration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolls(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1Configuration) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if m.Accounts != nil { + if err := m.Accounts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if m.Emojis != nil { + if err := m.Emojis.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if m.MediaAttachments != nil { + if err := m.MediaAttachments.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validatePolls(formats strfmt.Registry) error { + if swag.IsZero(m.Polls) { // not required + return nil + } + + if m.Polls != nil { + if err := m.Polls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if m.Statuses != nil { + if err := m.Statuses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v1 configuration based on the context it is used +func (m *InstanceV1Configuration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePolls(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV1Configuration) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + if m.Accounts != nil { + + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if err := m.Accounts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + if m.Emojis != nil { + + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if err := m.Emojis.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + if m.MediaAttachments != nil { + + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if err := m.MediaAttachments.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidatePolls(ctx context.Context, formats strfmt.Registry) error { + + if m.Polls != nil { + + if swag.IsZero(m.Polls) { // not required + return nil + } + + if err := m.Polls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV1Configuration) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + if m.Statuses != nil { + + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if err := m.Statuses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV1Configuration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV1Configuration) UnmarshalBinary(b []byte) error { + var res InstanceV1Configuration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v1_u_r_ls.go b/models/instance_v1_u_r_ls.go new file mode 100644 index 0000000..6917194 --- /dev/null +++ b/models/instance_v1_u_r_ls.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV1URLs InstanceV1URLs models instance-relevant URLs for client application consumption. +// +// swagger:model InstanceV1URLs +type InstanceV1URLs struct { + + // Websockets address for status and notification streaming. + // Example: wss://example.org + StreamingAPI string `json:"streaming_api,omitempty"` +} + +// Validate validates this instance v1 u r ls +func (m *InstanceV1URLs) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v1 u r ls based on context it is used +func (m *InstanceV1URLs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV1URLs) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV1URLs) UnmarshalBinary(b []byte) error { + var res InstanceV1URLs + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2.go b/models/instance_v2.go new file mode 100644 index 0000000..e56bcfe --- /dev/null +++ b/models/instance_v2.go @@ -0,0 +1,425 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2 InstanceV2 models information about this instance. +// +// swagger:model InstanceV2 +type InstanceV2 struct { + + // The domain of accounts on this instance. + // This will not necessarily be the same as + // domain. + // Example: example.org + AccountDomain string `json:"account_domain,omitempty"` + + // Whether or not instance is running in DEBUG mode. Omitted if false. + Debug bool `json:"debug,omitempty"` + + // Description of the instance. + // + // Should be HTML formatted, but might be plaintext. + // + // This should be displayed on the 'about' page for an instance. + Description string `json:"description,omitempty"` + + // Raw (unparsed) version of description. + DescriptionText string `json:"description_text,omitempty"` + + // The domain of the instance. + // Example: gts.example.org + Domain string `json:"domain,omitempty"` + + // Primary languages of the instance + moderators/admins. + // Example: ["en"] + Languages []string `json:"languages"` + + // An itemized list of rules for this instance. + Rules []*InstanceRule `json:"rules"` + + // The URL for the source code of the software running on this instance, in keeping with AGPL license requirements. + // Example: https://github.com/superseriousbusiness/gotosocial + SourceURL string `json:"source_url,omitempty"` + + // Terms and conditions for accounts on this instance. + Terms string `json:"terms,omitempty"` + + // Raw (unparsed) version of terms. + TermsText string `json:"terms_text,omitempty"` + + // The title of the instance. + // Example: GoToSocial Example Instance + Title string `json:"title,omitempty"` + + // The version of GoToSocial installed on the instance. + // + // This will contain at least a semantic version number. + // + // It may also contain, after a space, the short git commit ID of the running software. + // Example: 0.1.1 cb85f65 + Version string `json:"version,omitempty"` + + // configuration + Configuration *InstanceV2Configuration `json:"configuration,omitempty"` + + // contact + Contact *InstanceV2Contact `json:"contact,omitempty"` + + // registrations + Registrations *InstanceV2Registrations `json:"registrations,omitempty"` + + // thumbnail + Thumbnail *InstanceV2Thumbnail `json:"thumbnail,omitempty"` + + // usage + Usage *InstanceV2Usage `json:"usage,omitempty"` +} + +// Validate validates this instance v2 +func (m *InstanceV2) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateRules(formats); err != nil { + res = append(res, err) + } + + if err := m.validateConfiguration(formats); err != nil { + res = append(res, err) + } + + if err := m.validateContact(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRegistrations(formats); err != nil { + res = append(res, err) + } + + if err := m.validateThumbnail(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2) validateRules(formats strfmt.Registry) error { + if swag.IsZero(m.Rules) { // not required + return nil + } + + for i := 0; i < len(m.Rules); i++ { + if swag.IsZero(m.Rules[i]) { // not required + continue + } + + if m.Rules[i] != nil { + if err := m.Rules[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV2) validateConfiguration(formats strfmt.Registry) error { + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if m.Configuration != nil { + if err := m.Configuration.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateContact(formats strfmt.Registry) error { + if swag.IsZero(m.Contact) { // not required + return nil + } + + if m.Contact != nil { + if err := m.Contact.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateRegistrations(formats strfmt.Registry) error { + if swag.IsZero(m.Registrations) { // not required + return nil + } + + if m.Registrations != nil { + if err := m.Registrations.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("registrations") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("registrations") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateThumbnail(formats strfmt.Registry) error { + if swag.IsZero(m.Thumbnail) { // not required + return nil + } + + if m.Thumbnail != nil { + if err := m.Thumbnail.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("thumbnail") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("thumbnail") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) validateUsage(formats strfmt.Registry) error { + if swag.IsZero(m.Usage) { // not required + return nil + } + + if m.Usage != nil { + if err := m.Usage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 based on the context it is used +func (m *InstanceV2) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateRules(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateConfiguration(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateContact(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRegistrations(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateThumbnail(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2) contextValidateRules(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Rules); i++ { + + if m.Rules[i] != nil { + + if swag.IsZero(m.Rules[i]) { // not required + return nil + } + + if err := m.Rules[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("rules" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("rules" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *InstanceV2) contextValidateConfiguration(ctx context.Context, formats strfmt.Registry) error { + + if m.Configuration != nil { + + if swag.IsZero(m.Configuration) { // not required + return nil + } + + if err := m.Configuration.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("configuration") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("configuration") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateContact(ctx context.Context, formats strfmt.Registry) error { + + if m.Contact != nil { + + if swag.IsZero(m.Contact) { // not required + return nil + } + + if err := m.Contact.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("contact") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("contact") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateRegistrations(ctx context.Context, formats strfmt.Registry) error { + + if m.Registrations != nil { + + if swag.IsZero(m.Registrations) { // not required + return nil + } + + if err := m.Registrations.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("registrations") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("registrations") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateThumbnail(ctx context.Context, formats strfmt.Registry) error { + + if m.Thumbnail != nil { + + if swag.IsZero(m.Thumbnail) { // not required + return nil + } + + if err := m.Thumbnail.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("thumbnail") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("thumbnail") + } + return err + } + } + + return nil +} + +func (m *InstanceV2) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { + + if m.Usage != nil { + + if swag.IsZero(m.Usage) { // not required + return nil + } + + if err := m.Usage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2) UnmarshalBinary(b []byte) error { + var res InstanceV2 + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_configuration.go b/models/instance_v2_configuration.go new file mode 100644 index 0000000..9e05189 --- /dev/null +++ b/models/instance_v2_configuration.go @@ -0,0 +1,418 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Configuration Configured values and limits for this instance. +// +// swagger:model InstanceV2Configuration +type InstanceV2Configuration struct { + + // True if instance is running with OIDC as auth/identity backend, else omitted. + OIDCEnabled bool `json:"oidc_enabled,omitempty"` + + // accounts + Accounts *InstanceConfigurationAccounts `json:"accounts,omitempty"` + + // emojis + Emojis *InstanceConfigurationEmojis `json:"emojis,omitempty"` + + // media attachments + MediaAttachments *InstanceConfigurationMediaAttachments `json:"media_attachments,omitempty"` + + // polls + Polls *InstanceConfigurationPolls `json:"polls,omitempty"` + + // statuses + Statuses *InstanceConfigurationStatuses `json:"statuses,omitempty"` + + // translation + Translation *InstanceV2ConfigurationTranslation `json:"translation,omitempty"` + + // urls + Urls *InstanceV2URLs `json:"urls,omitempty"` +} + +// Validate validates this instance v2 configuration +func (m *InstanceV2Configuration) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePolls(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTranslation(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUrls(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Configuration) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if m.Accounts != nil { + if err := m.Accounts.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if m.Emojis != nil { + if err := m.Emojis.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if m.MediaAttachments != nil { + if err := m.MediaAttachments.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validatePolls(formats strfmt.Registry) error { + if swag.IsZero(m.Polls) { // not required + return nil + } + + if m.Polls != nil { + if err := m.Polls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if m.Statuses != nil { + if err := m.Statuses.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateTranslation(formats strfmt.Registry) error { + if swag.IsZero(m.Translation) { // not required + return nil + } + + if m.Translation != nil { + if err := m.Translation.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("translation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("translation") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) validateUrls(formats strfmt.Registry) error { + if swag.IsZero(m.Urls) { // not required + return nil + } + + if m.Urls != nil { + if err := m.Urls.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 configuration based on the context it is used +func (m *InstanceV2Configuration) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePolls(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTranslation(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUrls(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Configuration) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + if m.Accounts != nil { + + if swag.IsZero(m.Accounts) { // not required + return nil + } + + if err := m.Accounts.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + if m.Emojis != nil { + + if swag.IsZero(m.Emojis) { // not required + return nil + } + + if err := m.Emojis.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + if m.MediaAttachments != nil { + + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + if err := m.MediaAttachments.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidatePolls(ctx context.Context, formats strfmt.Registry) error { + + if m.Polls != nil { + + if swag.IsZero(m.Polls) { // not required + return nil + } + + if err := m.Polls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("polls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("polls") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + if m.Statuses != nil { + + if swag.IsZero(m.Statuses) { // not required + return nil + } + + if err := m.Statuses.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateTranslation(ctx context.Context, formats strfmt.Registry) error { + + if m.Translation != nil { + + if swag.IsZero(m.Translation) { // not required + return nil + } + + if err := m.Translation.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("translation") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("translation") + } + return err + } + } + + return nil +} + +func (m *InstanceV2Configuration) contextValidateUrls(ctx context.Context, formats strfmt.Registry) error { + + if m.Urls != nil { + + if swag.IsZero(m.Urls) { // not required + return nil + } + + if err := m.Urls.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("urls") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("urls") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Configuration) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Configuration) UnmarshalBinary(b []byte) error { + var res InstanceV2Configuration + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_configuration_translation.go b/models/instance_v2_configuration_translation.go new file mode 100644 index 0000000..5cefd7b --- /dev/null +++ b/models/instance_v2_configuration_translation.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2ConfigurationTranslation Hints related to translation. +// +// swagger:model InstanceV2ConfigurationTranslation +type InstanceV2ConfigurationTranslation struct { + + // Whether the Translations API is available on this instance. + // Not implemented so this value is always false. + Enabled bool `json:"enabled,omitempty"` +} + +// Validate validates this instance v2 configuration translation +func (m *InstanceV2ConfigurationTranslation) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 configuration translation based on context it is used +func (m *InstanceV2ConfigurationTranslation) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2ConfigurationTranslation) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2ConfigurationTranslation) UnmarshalBinary(b []byte) error { + var res InstanceV2ConfigurationTranslation + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_contact.go b/models/instance_v2_contact.go new file mode 100644 index 0000000..ae8316c --- /dev/null +++ b/models/instance_v2_contact.go @@ -0,0 +1,114 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Contact Hints related to contacting a representative of the instance. +// +// swagger:model InstanceV2Contact +type InstanceV2Contact struct { + + // An email address that can be messaged regarding inquiries or issues. + // Empty string if no email address set. + // Example: someone@example.org + Email string `json:"email,omitempty"` + + // account + Account *Account `json:"account,omitempty"` +} + +// Validate validates this instance v2 contact +func (m *InstanceV2Contact) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Contact) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 contact based on the context it is used +func (m *InstanceV2Contact) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Contact) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Contact) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Contact) UnmarshalBinary(b []byte) error { + var res InstanceV2Contact + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_registrations.go b/models/instance_v2_registrations.go new file mode 100644 index 0000000..8694cf8 --- /dev/null +++ b/models/instance_v2_registrations.go @@ -0,0 +1,60 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Registrations Information about registering for this instance. +// +// swagger:model InstanceV2Registrations +type InstanceV2Registrations struct { + + // Whether registrations require moderator approval. + // Example: true + ApprovalRequired bool `json:"approval_required,omitempty"` + + // Whether registrations are enabled. + // Example: false + Enabled bool `json:"enabled,omitempty"` + + // A custom message (html string) to be shown when registrations are closed. + // Value will be null if no message is set. + // Example: \u003cp\u003eRegistrations are currently closed on example.org because of spam bots!\u003c/p\u003e + Message string `json:"message,omitempty"` +} + +// Validate validates this instance v2 registrations +func (m *InstanceV2Registrations) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 registrations based on context it is used +func (m *InstanceV2Registrations) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Registrations) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Registrations) UnmarshalBinary(b []byte) error { + var res InstanceV2Registrations + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_thumbnail.go b/models/instance_v2_thumbnail.go new file mode 100644 index 0000000..9b25964 --- /dev/null +++ b/models/instance_v2_thumbnail.go @@ -0,0 +1,137 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Thumbnail An image used to represent this instance. +// +// swagger:model InstanceV2Thumbnail +type InstanceV2Thumbnail struct { + + // A hash computed by the BlurHash algorithm, for generating colorful preview thumbnails when media has not been downloaded yet. + // Key/value not set if no blurhash available. + // Example: UeKUpFxuo~R%0nW;WCnhF6RjaJt757oJodS$ + Blurhash string `json:"blurhash,omitempty"` + + // Description of the instance thumbnail. + // Key/value not set if no description available. + // Example: picture of a cute lil' friendly sloth + Description string `json:"thumbnail_description,omitempty"` + + // MIME type of the instance thumbnail. + // Key/value not set if thumbnail image type unknown. + // Example: image/png + StaticType string `json:"thumbnail_static_type,omitempty"` + + // StaticURL version of the thumbnail image. + // Example: https://example.org/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/static/01H88X0KQ2DFYYDSWYP93VDJZA.webp + StaticURL string `json:"static_url,omitempty"` + + // MIME type of the instance thumbnail. + // Key/value not set if thumbnail image type unknown. + // Example: image/png + Type string `json:"thumbnail_type,omitempty"` + + // The URL for the thumbnail image. + // Example: https://example.org/fileserver/01BPSX2MKCRVMD4YN4D71G9CP5/attachment/original/01H88X0KQ2DFYYDSWYP93VDJZA.png + URL string `json:"url,omitempty"` + + // versions + Versions *InstanceV2ThumbnailVersions `json:"versions,omitempty"` +} + +// Validate validates this instance v2 thumbnail +func (m *InstanceV2Thumbnail) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateVersions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Thumbnail) validateVersions(formats strfmt.Registry) error { + if swag.IsZero(m.Versions) { // not required + return nil + } + + if m.Versions != nil { + if err := m.Versions.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 thumbnail based on the context it is used +func (m *InstanceV2Thumbnail) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateVersions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Thumbnail) contextValidateVersions(ctx context.Context, formats strfmt.Registry) error { + + if m.Versions != nil { + + if swag.IsZero(m.Versions) { // not required + return nil + } + + if err := m.Versions.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("versions") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("versions") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Thumbnail) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Thumbnail) UnmarshalBinary(b []byte) error { + var res InstanceV2Thumbnail + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_thumbnail_versions.go b/models/instance_v2_thumbnail_versions.go new file mode 100644 index 0000000..81b1e69 --- /dev/null +++ b/models/instance_v2_thumbnail_versions.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2ThumbnailVersions Links to scaled resolution images, for high DPI screens. +// +// swagger:model InstanceV2ThumbnailVersions +type InstanceV2ThumbnailVersions struct { + + // The URL for the thumbnail image at 1x resolution. + // Key/value not set if scaled versions not available. + Size1URL string `json:"@1x,omitempty"` + + // The URL for the thumbnail image at 2x resolution. + // Key/value not set if scaled versions not available. + Size2URL string `json:"@2x,omitempty"` +} + +// Validate validates this instance v2 thumbnail versions +func (m *InstanceV2ThumbnailVersions) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 thumbnail versions based on context it is used +func (m *InstanceV2ThumbnailVersions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2ThumbnailVersions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2ThumbnailVersions) UnmarshalBinary(b []byte) error { + var res InstanceV2ThumbnailVersions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_u_r_ls.go b/models/instance_v2_u_r_ls.go new file mode 100644 index 0000000..69ecc41 --- /dev/null +++ b/models/instance_v2_u_r_ls.go @@ -0,0 +1,51 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2URLs InstanceV2URLs models instance-relevant URLs for client application consumption. +// +// swagger:model InstanceV2URLs +type InstanceV2URLs struct { + + // Websockets address for status and notification streaming. + // Example: wss://example.org + Streaming string `json:"streaming,omitempty"` +} + +// Validate validates this instance v2 u r ls +func (m *InstanceV2URLs) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 u r ls based on context it is used +func (m *InstanceV2URLs) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2URLs) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2URLs) UnmarshalBinary(b []byte) error { + var res InstanceV2URLs + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_usage.go b/models/instance_v2_usage.go new file mode 100644 index 0000000..767744e --- /dev/null +++ b/models/instance_v2_usage.go @@ -0,0 +1,109 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Usage Usage data for this instance. +// +// swagger:model InstanceV2Usage +type InstanceV2Usage struct { + + // users + Users *InstanceV2Users `json:"users,omitempty"` +} + +// Validate validates this instance v2 usage +func (m *InstanceV2Usage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUsers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Usage) validateUsers(formats strfmt.Registry) error { + if swag.IsZero(m.Users) { // not required + return nil + } + + if m.Users != nil { + if err := m.Users.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// ContextValidate validate this instance v2 usage based on the context it is used +func (m *InstanceV2Usage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InstanceV2Usage) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + if m.Users != nil { + + if swag.IsZero(m.Users) { // not required + return nil + } + + if err := m.Users.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Usage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Usage) UnmarshalBinary(b []byte) error { + var res InstanceV2Usage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/instance_v2_users.go b/models/instance_v2_users.go new file mode 100644 index 0000000..c7fddd6 --- /dev/null +++ b/models/instance_v2_users.go @@ -0,0 +1,52 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InstanceV2Users Usage data related to users on this instance. +// +// swagger:model InstanceV2Users +type InstanceV2Users struct { + + // The number of active users in the past 4 weeks. + // Currently not implemented: will always be 0. + // Example: 0 + ActiveMonth int64 `json:"active_month,omitempty"` +} + +// Validate validates this instance v2 users +func (m *InstanceV2Users) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this instance v2 users based on context it is used +func (m *InstanceV2Users) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *InstanceV2Users) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InstanceV2Users) UnmarshalBinary(b []byte) error { + var res InstanceV2Users + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/interaction_policy.go b/models/interaction_policy.go new file mode 100644 index 0000000..a9f971b --- /dev/null +++ b/models/interaction_policy.go @@ -0,0 +1,211 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// InteractionPolicy Interaction policy of a status. +// +// swagger:model InteractionPolicy +type InteractionPolicy struct { + + // can favourite + CanFavourite *PolicyRules `json:"can_favourite,omitempty"` + + // can reblog + CanReblog *PolicyRules `json:"can_reblog,omitempty"` + + // can reply + CanReply *PolicyRules `json:"can_reply,omitempty"` +} + +// Validate validates this interaction policy +func (m *InteractionPolicy) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateCanFavourite(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCanReblog(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCanReply(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InteractionPolicy) validateCanFavourite(formats strfmt.Registry) error { + if swag.IsZero(m.CanFavourite) { // not required + return nil + } + + if m.CanFavourite != nil { + if err := m.CanFavourite.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_favourite") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_favourite") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) validateCanReblog(formats strfmt.Registry) error { + if swag.IsZero(m.CanReblog) { // not required + return nil + } + + if m.CanReblog != nil { + if err := m.CanReblog.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reblog") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) validateCanReply(formats strfmt.Registry) error { + if swag.IsZero(m.CanReply) { // not required + return nil + } + + if m.CanReply != nil { + if err := m.CanReply.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reply") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reply") + } + return err + } + } + + return nil +} + +// ContextValidate validate this interaction policy based on the context it is used +func (m *InteractionPolicy) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateCanFavourite(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCanReblog(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCanReply(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *InteractionPolicy) contextValidateCanFavourite(ctx context.Context, formats strfmt.Registry) error { + + if m.CanFavourite != nil { + + if swag.IsZero(m.CanFavourite) { // not required + return nil + } + + if err := m.CanFavourite.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_favourite") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_favourite") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) contextValidateCanReblog(ctx context.Context, formats strfmt.Registry) error { + + if m.CanReblog != nil { + + if swag.IsZero(m.CanReblog) { // not required + return nil + } + + if err := m.CanReblog.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reblog") + } + return err + } + } + + return nil +} + +func (m *InteractionPolicy) contextValidateCanReply(ctx context.Context, formats strfmt.Registry) error { + + if m.CanReply != nil { + + if swag.IsZero(m.CanReply) { // not required + return nil + } + + if err := m.CanReply.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("can_reply") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("can_reply") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *InteractionPolicy) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *InteractionPolicy) UnmarshalBinary(b []byte) error { + var res InteractionPolicy + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/link.go b/models/link.go new file mode 100644 index 0000000..307ba7d --- /dev/null +++ b/models/link.go @@ -0,0 +1,61 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Link Link represents one 'link' in a slice of links returned from a lookup request. +// +// See https://webfinger.net/ and https://www.rfc-editor.org/rfc/rfc6415.html#section-3.1 +// +// swagger:model Link +type Link struct { + + // href + Href string `json:"href,omitempty"` + + // rel + Rel string `json:"rel,omitempty"` + + // template + Template string `json:"template,omitempty"` + + // type + Type string `json:"type,omitempty"` +} + +// Validate validates this link +func (m *Link) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this link based on context it is used +func (m *Link) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Link) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Link) UnmarshalBinary(b []byte) error { + var res Link + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/list.go b/models/list.go new file mode 100644 index 0000000..205b8b1 --- /dev/null +++ b/models/list.go @@ -0,0 +1,59 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// List List represents a user-created list of accounts that the user follows. +// +// swagger:model List +type List struct { + + // The ID of the list. + ID string `json:"id,omitempty"` + + // 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 + RepliesPolicy string `json:"replies_policy,omitempty"` + + // The user-defined title of the list. + Title string `json:"title,omitempty"` +} + +// Validate validates this list +func (m *List) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this list based on context it is used +func (m *List) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *List) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *List) UnmarshalBinary(b []byte) error { + var res List + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/marker.go b/models/marker.go new file mode 100644 index 0000000..26dc075 --- /dev/null +++ b/models/marker.go @@ -0,0 +1,160 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Marker Marker represents the last read position within a user's timelines. +// +// swagger:model Marker +type Marker struct { + + // home + Home *TimelineMarker `json:"home,omitempty"` + + // notifications + Notifications *TimelineMarker `json:"notifications,omitempty"` +} + +// Validate validates this marker +func (m *Marker) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateHome(formats); err != nil { + res = append(res, err) + } + + if err := m.validateNotifications(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Marker) validateHome(formats strfmt.Registry) error { + if swag.IsZero(m.Home) { // not required + return nil + } + + if m.Home != nil { + if err := m.Home.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("home") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("home") + } + return err + } + } + + return nil +} + +func (m *Marker) validateNotifications(formats strfmt.Registry) error { + if swag.IsZero(m.Notifications) { // not required + return nil + } + + if m.Notifications != nil { + if err := m.Notifications.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("notifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("notifications") + } + return err + } + } + + return nil +} + +// ContextValidate validate this marker based on the context it is used +func (m *Marker) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateHome(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateNotifications(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Marker) contextValidateHome(ctx context.Context, formats strfmt.Registry) error { + + if m.Home != nil { + + if swag.IsZero(m.Home) { // not required + return nil + } + + if err := m.Home.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("home") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("home") + } + return err + } + } + + return nil +} + +func (m *Marker) contextValidateNotifications(ctx context.Context, formats strfmt.Registry) error { + + if m.Notifications != nil { + + if swag.IsZero(m.Notifications) { // not required + return nil + } + + if err := m.Notifications.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("notifications") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("notifications") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Marker) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Marker) UnmarshalBinary(b []byte) error { + var res Marker + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/media_dimensions.go b/models/media_dimensions.go new file mode 100644 index 0000000..d5c9354 --- /dev/null +++ b/models/media_dimensions.go @@ -0,0 +1,81 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MediaDimensions MediaDimensions models detailed properties of a piece of media. +// +// swagger:model MediaDimensions +type MediaDimensions struct { + + // Aspect ratio of the media. + // Equal to width / height. + // Example: 1.777777778 + Aspect float32 `json:"aspect,omitempty"` + + // Bitrate of the media in bits per second. + // Example: 1000000 + Bitrate int64 `json:"bitrate,omitempty"` + + // Duration of the media in seconds. + // Only set for video and audio. + // Example: 5.43 + Duration float32 `json:"duration,omitempty"` + + // Framerate of the media. + // Only set for video and gifs. + // Example: 30 + FrameRate string `json:"frame_rate,omitempty"` + + // Height of the media in pixels. + // Not set for audio. + // Example: 1080 + Height int64 `json:"height,omitempty"` + + // Size of the media, in the format `[width]x[height]`. + // Not set for audio. + // Example: 1920x1080 + Size string `json:"size,omitempty"` + + // Width of the media in pixels. + // Not set for audio. + // Example: 1920 + Width int64 `json:"width,omitempty"` +} + +// Validate validates this media dimensions +func (m *MediaDimensions) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this media dimensions based on context it is used +func (m *MediaDimensions) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MediaDimensions) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MediaDimensions) UnmarshalBinary(b []byte) error { + var res MediaDimensions + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/media_focus.go b/models/media_focus.go new file mode 100644 index 0000000..00b77ac --- /dev/null +++ b/models/media_focus.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MediaFocus MediaFocus models the focal point of a piece of media. +// +// swagger:model MediaFocus +type MediaFocus struct { + + // x position of the focus + // should be between -1 and 1 + X float32 `json:"x,omitempty"` + + // y position of the focus + // should be between -1 and 1 + Y float32 `json:"y,omitempty"` +} + +// Validate validates this media focus +func (m *MediaFocus) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this media focus based on context it is used +func (m *MediaFocus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *MediaFocus) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MediaFocus) UnmarshalBinary(b []byte) error { + var res MediaFocus + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/media_meta.go b/models/media_meta.go new file mode 100644 index 0000000..15257e3 --- /dev/null +++ b/models/media_meta.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MediaMeta MediaMeta models media metadata. +// +// This can be metadata about an image, an audio file, video, etc. +// +// swagger:model MediaMeta +type MediaMeta struct { + + // focus + Focus *MediaFocus `json:"focus,omitempty"` + + // original + Original *MediaDimensions `json:"original,omitempty"` + + // small + Small *MediaDimensions `json:"small,omitempty"` +} + +// Validate validates this media meta +func (m *MediaMeta) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFocus(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOriginal(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSmall(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MediaMeta) validateFocus(formats strfmt.Registry) error { + if swag.IsZero(m.Focus) { // not required + return nil + } + + if m.Focus != nil { + if err := m.Focus.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("focus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("focus") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) validateOriginal(formats strfmt.Registry) error { + if swag.IsZero(m.Original) { // not required + return nil + } + + if m.Original != nil { + if err := m.Original.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("original") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("original") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) validateSmall(formats strfmt.Registry) error { + if swag.IsZero(m.Small) { // not required + return nil + } + + if m.Small != nil { + if err := m.Small.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("small") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("small") + } + return err + } + } + + return nil +} + +// ContextValidate validate this media meta based on the context it is used +func (m *MediaMeta) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFocus(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOriginal(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSmall(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MediaMeta) contextValidateFocus(ctx context.Context, formats strfmt.Registry) error { + + if m.Focus != nil { + + if swag.IsZero(m.Focus) { // not required + return nil + } + + if err := m.Focus.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("focus") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("focus") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) contextValidateOriginal(ctx context.Context, formats strfmt.Registry) error { + + if m.Original != nil { + + if swag.IsZero(m.Original) { // not required + return nil + } + + if err := m.Original.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("original") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("original") + } + return err + } + } + + return nil +} + +func (m *MediaMeta) contextValidateSmall(ctx context.Context, formats strfmt.Registry) error { + + if m.Small != nil { + + if swag.IsZero(m.Small) { // not required + return nil + } + + if err := m.Small.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("small") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("small") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MediaMeta) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MediaMeta) UnmarshalBinary(b []byte) error { + var res MediaMeta + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/mention.go b/models/mention.go new file mode 100644 index 0000000..d1ea81a --- /dev/null +++ b/models/mention.go @@ -0,0 +1,64 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Mention Mention represents a mention of another account. +// +// swagger:model Mention +type Mention struct { + + // The account URI as discovered via webfinger. + // Equal to username for local users, or username@domain for remote users. + // Example: some_user@example.org + Acct string `json:"acct,omitempty"` + + // The ID of the mentioned account. + // Example: 01FBYJHQWQZAVWFRK9PDYTKGMB + ID string `json:"id,omitempty"` + + // The web URL of the mentioned account's profile. + // Example: https://example.org/@some_user + URL string `json:"url,omitempty"` + + // The username of the mentioned account. + // Example: some_user + Username string `json:"username,omitempty"` +} + +// Validate validates this mention +func (m *Mention) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this mention based on context it is used +func (m *Mention) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Mention) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Mention) UnmarshalBinary(b []byte) error { + var res Mention + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/muted_account.go b/models/muted_account.go new file mode 100644 index 0000000..71ae0d2 --- /dev/null +++ b/models/muted_account.go @@ -0,0 +1,436 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// MutedAccount MutedAccount extends Account with a field used only by the muted user list. +// +// swagger:model MutedAccount +type MutedAccount struct { + + // The account URI as discovered via webfinger. + // Equal to username for local users, or username@domain for remote users. + // Example: some_user@example.org + Acct string `json:"acct,omitempty"` + + // Web location of the account's avatar. + // Example: https://example.org/media/some_user/avatar/original/avatar.jpeg + Avatar string `json:"avatar,omitempty"` + + // Description of this account's avatar, for alt text. + // Example: A cute drawing of a smiling sloth. + AvatarDescription string `json:"avatar_description,omitempty"` + + // Web location of a static version of the account's avatar. + // Only relevant when the account's main avatar is a video or a gif. + // Example: https://example.org/media/some_user/avatar/static/avatar.png + AvatarStatic string `json:"avatar_static,omitempty"` + + // Account identifies as a bot. + Bot bool `json:"bot,omitempty"` + + // When the account was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // CustomCSS to include when rendering this account's profile or statuses. + CustomCSS string `json:"custom_css,omitempty"` + + // Account has opted into discovery features. + Discoverable bool `json:"discoverable,omitempty"` + + // The account's display name. + // Example: big jeff (he/him) + DisplayName string `json:"display_name,omitempty"` + + // Array of custom emojis used in this account's note or display name. + // Empty for blocked accounts. + Emojis []*Emoji `json:"emojis"` + + // Account has enabled RSS feed. + // Key/value omitted if false. + EnableRSS bool `json:"enable_rss,omitempty"` + + // Additional metadata attached to this account's profile. + // Empty for blocked accounts. + Fields []*Field `json:"fields"` + + // Number of accounts following this account, according to our instance. + FollowersCount int64 `json:"followers_count,omitempty"` + + // Number of account's followed by this account, according to our instance. + FollowingCount int64 `json:"following_count,omitempty"` + + // Web location of the account's header image. + // Example: https://example.org/media/some_user/header/original/header.jpeg + Header string `json:"header,omitempty"` + + // Description of this account's header, for alt text. + // Example: A sunlit field with purple flowers. + HeaderDescription string `json:"header_description,omitempty"` + + // Web location of a static version of the account's header. + // Only relevant when the account's main header is a video or a gif. + // Example: https://example.org/media/some_user/header/static/header.png + HeaderStatic string `json:"header_static,omitempty"` + + // Account has opted to hide their followers/following collections. + // Key/value omitted if false. + HideCollections bool `json:"hide_collections,omitempty"` + + // The account id. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // When the account's most recent status was posted (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + LastStatusAt string `json:"last_status_at,omitempty"` + + // Account manually approves follow requests. + Locked bool `json:"locked,omitempty"` + + // If this account has been muted, when will the mute expire (ISO 8601 Datetime). + // If the mute is indefinite, this will be null. + // Example: 2021-07-30T09:20:25+00:00 + MuteExpiresAt string `json:"mute_expires_at,omitempty"` + + // Bio/description of this account. + Note string `json:"note,omitempty"` + + // Number of statuses posted by this account, according to our instance. + StatusesCount int64 `json:"statuses_count,omitempty"` + + // Account has been suspended by our instance. + Suspended bool `json:"suspended,omitempty"` + + // Filename of user-selected CSS theme to include when rendering this account's profile or statuses. Eg., `blurple-light.css`. + Theme string `json:"theme,omitempty"` + + // Web location of the account's profile page. + // Example: https://example.org/@some_user + URL string `json:"url,omitempty"` + + // The username of the account, not including domain. + // Example: some_user + Username string `json:"username,omitempty"` + + // moved + Moved *Account `json:"moved,omitempty"` + + // role + Role *AccountRole `json:"role,omitempty"` + + // source + Source *Source `json:"source,omitempty"` +} + +// Validate validates this muted account +func (m *MutedAccount) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFields(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMoved(formats); err != nil { + res = append(res, err) + } + + if err := m.validateRole(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSource(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MutedAccount) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) validateFields(formats strfmt.Registry) error { + if swag.IsZero(m.Fields) { // not required + return nil + } + + for i := 0; i < len(m.Fields); i++ { + if swag.IsZero(m.Fields[i]) { // not required + continue + } + + if m.Fields[i] != nil { + if err := m.Fields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) validateMoved(formats strfmt.Registry) error { + if swag.IsZero(m.Moved) { // not required + return nil + } + + if m.Moved != nil { + if err := m.Moved.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) validateRole(formats strfmt.Registry) error { + if swag.IsZero(m.Role) { // not required + return nil + } + + if m.Role != nil { + if err := m.Role.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) validateSource(formats strfmt.Registry) error { + if swag.IsZero(m.Source) { // not required + return nil + } + + if m.Source != nil { + if err := m.Source.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// ContextValidate validate this muted account based on the context it is used +func (m *MutedAccount) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFields(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMoved(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateRole(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSource(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *MutedAccount) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) contextValidateFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Fields); i++ { + + if m.Fields[i] != nil { + + if swag.IsZero(m.Fields[i]) { // not required + return nil + } + + if err := m.Fields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *MutedAccount) contextValidateMoved(ctx context.Context, formats strfmt.Registry) error { + + if m.Moved != nil { + + if swag.IsZero(m.Moved) { // not required + return nil + } + + if err := m.Moved.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("moved") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("moved") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) contextValidateRole(ctx context.Context, formats strfmt.Registry) error { + + if m.Role != nil { + + if swag.IsZero(m.Role) { // not required + return nil + } + + if err := m.Role.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("role") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("role") + } + return err + } + } + + return nil +} + +func (m *MutedAccount) contextValidateSource(ctx context.Context, formats strfmt.Registry) error { + + if m.Source != nil { + + if swag.IsZero(m.Source) { // not required + return nil + } + + if err := m.Source.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("source") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("source") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *MutedAccount) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *MutedAccount) UnmarshalBinary(b []byte) error { + var res MutedAccount + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/node_info_services.go b/models/node_info_services.go new file mode 100644 index 0000000..c3d85a2 --- /dev/null +++ b/models/node_info_services.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoServices NodeInfoServices represents inbound and outbound services that this node offers connections to. +// +// swagger:model NodeInfoServices +type NodeInfoServices struct { + + // inbound + Inbound []string `json:"inbound"` + + // outbound + Outbound []string `json:"outbound"` +} + +// Validate validates this node info services +func (m *NodeInfoServices) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this node info services based on context it is used +func (m *NodeInfoServices) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoServices) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoServices) UnmarshalBinary(b []byte) error { + var res NodeInfoServices + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/node_info_software.go b/models/node_info_software.go new file mode 100644 index 0000000..9413171 --- /dev/null +++ b/models/node_info_software.go @@ -0,0 +1,55 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoSoftware NodeInfoSoftware represents the name and version number of the software of this node. +// +// swagger:model NodeInfoSoftware +type NodeInfoSoftware struct { + + // name + // Example: gotosocial + Name string `json:"name,omitempty"` + + // version + // Example: 0.1.2 1234567 + Version string `json:"version,omitempty"` +} + +// Validate validates this node info software +func (m *NodeInfoSoftware) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this node info software based on context it is used +func (m *NodeInfoSoftware) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoSoftware) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoSoftware) UnmarshalBinary(b []byte) error { + var res NodeInfoSoftware + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/node_info_usage.go b/models/node_info_usage.go new file mode 100644 index 0000000..f29fd32 --- /dev/null +++ b/models/node_info_usage.go @@ -0,0 +1,112 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoUsage NodeInfoUsage represents usage information about this server, such as number of users. +// +// swagger:model NodeInfoUsage +type NodeInfoUsage struct { + + // local posts + LocalPosts int64 `json:"localPosts,omitempty"` + + // users + Users *NodeInfoUsers `json:"users,omitempty"` +} + +// Validate validates this node info usage +func (m *NodeInfoUsage) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateUsers(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NodeInfoUsage) validateUsers(formats strfmt.Registry) error { + if swag.IsZero(m.Users) { // not required + return nil + } + + if m.Users != nil { + if err := m.Users.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// ContextValidate validate this node info usage based on the context it is used +func (m *NodeInfoUsage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateUsers(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *NodeInfoUsage) contextValidateUsers(ctx context.Context, formats strfmt.Registry) error { + + if m.Users != nil { + + if swag.IsZero(m.Users) { // not required + return nil + } + + if err := m.Users.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("users") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("users") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoUsage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoUsage) UnmarshalBinary(b []byte) error { + var res NodeInfoUsage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/node_info_users.go b/models/node_info_users.go new file mode 100644 index 0000000..c2f53e6 --- /dev/null +++ b/models/node_info_users.go @@ -0,0 +1,50 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// NodeInfoUsers NodeInfoUsers represents aggregate information about the users on the server. +// +// swagger:model NodeInfoUsers +type NodeInfoUsers struct { + + // total + Total int64 `json:"total,omitempty"` +} + +// Validate validates this node info users +func (m *NodeInfoUsers) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this node info users based on context it is used +func (m *NodeInfoUsers) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *NodeInfoUsers) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *NodeInfoUsers) UnmarshalBinary(b []byte) error { + var res NodeInfoUsers + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/nodeinfo.go b/models/nodeinfo.go new file mode 100644 index 0000000..ffaea38 --- /dev/null +++ b/models/nodeinfo.go @@ -0,0 +1,227 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Nodeinfo Nodeinfo represents a version 2.1 or version 2.0 nodeinfo schema. +// +// See: https://nodeinfo.diaspora.software/schema.html +// +// swagger:model Nodeinfo +type Nodeinfo struct { + + // Free form key value pairs for software specific values. Clients should not rely on any specific key present. + Metadata map[string]interface{} `json:"metadata,omitempty"` + + // Whether this server allows open self-registration. + // Example: false + OpenRegistrations bool `json:"openRegistrations,omitempty"` + + // The protocols supported on this server. + Protocols []string `json:"protocols"` + + // The schema version + // Example: 2.0 + Version string `json:"version,omitempty"` + + // services + Services *NodeInfoServices `json:"services,omitempty"` + + // software + Software *NodeInfoSoftware `json:"software,omitempty"` + + // usage + Usage *NodeInfoUsage `json:"usage,omitempty"` +} + +// Validate validates this nodeinfo +func (m *Nodeinfo) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateServices(formats); err != nil { + res = append(res, err) + } + + if err := m.validateSoftware(formats); err != nil { + res = append(res, err) + } + + if err := m.validateUsage(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Nodeinfo) validateServices(formats strfmt.Registry) error { + if swag.IsZero(m.Services) { // not required + return nil + } + + if m.Services != nil { + if err := m.Services.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) validateSoftware(formats strfmt.Registry) error { + if swag.IsZero(m.Software) { // not required + return nil + } + + if m.Software != nil { + if err := m.Software.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("software") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("software") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) validateUsage(formats strfmt.Registry) error { + if swag.IsZero(m.Usage) { // not required + return nil + } + + if m.Usage != nil { + if err := m.Usage.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// ContextValidate validate this nodeinfo based on the context it is used +func (m *Nodeinfo) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateServices(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateSoftware(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateUsage(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Nodeinfo) contextValidateServices(ctx context.Context, formats strfmt.Registry) error { + + if m.Services != nil { + + if swag.IsZero(m.Services) { // not required + return nil + } + + if err := m.Services.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("services") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("services") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) contextValidateSoftware(ctx context.Context, formats strfmt.Registry) error { + + if m.Software != nil { + + if swag.IsZero(m.Software) { // not required + return nil + } + + if err := m.Software.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("software") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("software") + } + return err + } + } + + return nil +} + +func (m *Nodeinfo) contextValidateUsage(ctx context.Context, formats strfmt.Registry) error { + + if m.Usage != nil { + + if swag.IsZero(m.Usage) { // not required + return nil + } + + if err := m.Usage.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("usage") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("usage") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Nodeinfo) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Nodeinfo) UnmarshalBinary(b []byte) error { + var res Nodeinfo + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/notification.go b/models/notification.go new file mode 100644 index 0000000..f3f94ea --- /dev/null +++ b/models/notification.go @@ -0,0 +1,177 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Notification Notification represents a notification of an event relevant to the user. +// +// swagger:model Notification +type Notification struct { + + // The timestamp of the notification (ISO 8601 Datetime) + CreatedAt string `json:"created_at,omitempty"` + + // The id of the notification in the database. + ID string `json:"id,omitempty"` + + // The type of event that resulted in the notification. + // follow = Someone followed you. `account` will be set. + // follow_request = Someone requested to follow you. `account` will be set. + // mention = Someone mentioned you in their status. `status` will be set. `account` will be set. + // reblog = Someone boosted one of your statuses. `status` will be set. `account` will be set. + // favourite = Someone favourited one of your statuses. `status` will be set. `account` will be set. + // poll = A poll you have voted in or created has ended. `status` will be set. `account` will be set. + // status = Someone you enabled notifications for has posted a status. `status` will be set. `account` will be set. + // admin.sign_up = Someone has signed up for a new account on the instance. `account` will be set. + Type string `json:"type,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // status + Status *Status `json:"status,omitempty"` +} + +// Validate validates this notification +func (m *Notification) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatus(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Notification) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Notification) validateStatus(formats strfmt.Registry) error { + if swag.IsZero(m.Status) { // not required + return nil + } + + if m.Status != nil { + if err := m.Status.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// ContextValidate validate this notification based on the context it is used +func (m *Notification) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatus(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Notification) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Notification) contextValidateStatus(ctx context.Context, formats strfmt.Registry) error { + + if m.Status != nil { + + if swag.IsZero(m.Status) { // not required + return nil + } + + if err := m.Status.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("status") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("status") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Notification) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Notification) UnmarshalBinary(b []byte) error { + var res Notification + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/policy_rules.go b/models/policy_rules.go new file mode 100644 index 0000000..4449b07 --- /dev/null +++ b/models/policy_rules.go @@ -0,0 +1,167 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PolicyRules Rules for one interaction type. +// +// swagger:model PolicyRules +type PolicyRules struct { + + // Policy entries for accounts that can always do this type of interaction. + Always []PolicyValue `json:"always"` + + // Policy entries for accounts that require approval to do this type of interaction. + WithApproval []PolicyValue `json:"with_approval"` +} + +// Validate validates this policy rules +func (m *PolicyRules) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAlways(formats); err != nil { + res = append(res, err) + } + + if err := m.validateWithApproval(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyRules) validateAlways(formats strfmt.Registry) error { + if swag.IsZero(m.Always) { // not required + return nil + } + + for i := 0; i < len(m.Always); i++ { + + if err := m.Always[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("always" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("always" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *PolicyRules) validateWithApproval(formats strfmt.Registry) error { + if swag.IsZero(m.WithApproval) { // not required + return nil + } + + for i := 0; i < len(m.WithApproval); i++ { + + if err := m.WithApproval[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// ContextValidate validate this policy rules based on the context it is used +func (m *PolicyRules) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAlways(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateWithApproval(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *PolicyRules) contextValidateAlways(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Always); i++ { + + if swag.IsZero(m.Always[i]) { // not required + return nil + } + + if err := m.Always[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("always" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("always" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +func (m *PolicyRules) contextValidateWithApproval(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.WithApproval); i++ { + + if swag.IsZero(m.WithApproval[i]) { // not required + return nil + } + + if err := m.WithApproval[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("with_approval" + "." + strconv.Itoa(i)) + } + return err + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *PolicyRules) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PolicyRules) UnmarshalBinary(b []byte) error { + var res PolicyRules + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/policy_value.go b/models/policy_value.go new file mode 100644 index 0000000..ee7aa6a --- /dev/null +++ b/models/policy_value.go @@ -0,0 +1,39 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" +) + +// PolicyValue One interaction policy entry for a status. +// +// It can be EITHER one of the internal keywords listed below, OR a full-fledged ActivityPub URI of an Actor, like "https://example.org/users/some_user". +// +// Internal keywords: +// +// public - Public, aka anyone who can see the status according to its visibility level. +// followers - Followers of the status author. +// following - People followed by the status author. +// mutuals - Mutual follows of the status author (reserved, unused). +// mentioned - Accounts mentioned in, or replied-to by, the status. +// author - The status author themself. +// me - If request was made with an authorized user, "me" represents the user who made the request and is now looking at this interaction policy. +// +// swagger:model PolicyValue +type PolicyValue string + +// Validate validates this policy value +func (m PolicyValue) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this policy value based on context it is used +func (m PolicyValue) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} diff --git a/models/poll.go b/models/poll.go new file mode 100644 index 0000000..b18f84b --- /dev/null +++ b/models/poll.go @@ -0,0 +1,213 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Poll Poll represents a poll attached to a status. +// +// swagger:model Poll +type Poll struct { + + // Custom emoji to be used for rendering poll options. + Emojis []*Emoji `json:"emojis"` + + // Is the poll currently expired? + Expired bool `json:"expired,omitempty"` + + // When the poll ends. (ISO 8601 Datetime). + ExpiresAt string `json:"expires_at,omitempty"` + + // The ID of the poll in the database. + // Example: 01FBYKMD1KBMJ0W6JF1YZ3VY5D + ID string `json:"id,omitempty"` + + // Does the poll allow multiple-choice answers? + Multiple bool `json:"multiple,omitempty"` + + // Possible answers for the poll. + Options []*PollOption `json:"options"` + + // When called with a user token, which options has the authorized + // user chosen? Contains an array of index values for options. + // + // Omitted when no user token provided. + OwnVotes []int64 `json:"own_votes"` + + // When called with a user token, has the authorized user voted? + // + // Omitted when no user token provided. + Voted bool `json:"voted,omitempty"` + + // How many unique accounts have voted on a multiple-choice poll. + VotersCount int64 `json:"voters_count,omitempty"` + + // How many votes have been received. + VotesCount int64 `json:"votes_count,omitempty"` +} + +// Validate validates this poll +func (m *Poll) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateOptions(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Poll) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Poll) validateOptions(formats strfmt.Registry) error { + if swag.IsZero(m.Options) { // not required + return nil + } + + for i := 0; i < len(m.Options); i++ { + if swag.IsZero(m.Options[i]) { // not required + continue + } + + if m.Options[i] != nil { + if err := m.Options[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("options" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this poll based on the context it is used +func (m *Poll) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateOptions(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Poll) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Poll) contextValidateOptions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Options); i++ { + + if m.Options[i] != nil { + + if swag.IsZero(m.Options[i]) { // not required + return nil + } + + if err := m.Options[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("options" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("options" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Poll) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Poll) UnmarshalBinary(b []byte) error { + var res Poll + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/poll_option.go b/models/poll_option.go new file mode 100644 index 0000000..711a969 --- /dev/null +++ b/models/poll_option.go @@ -0,0 +1,53 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// PollOption PollOption represents the current vote counts for different poll options. +// +// swagger:model PollOption +type PollOption struct { + + // The text value of the poll option. String. + Title string `json:"title,omitempty"` + + // The number of received votes for this option. + VotesCount int64 `json:"votes_count,omitempty"` +} + +// Validate validates this poll option +func (m *PollOption) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this poll option based on context it is used +func (m *PollOption) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *PollOption) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *PollOption) UnmarshalBinary(b []byte) error { + var res PollOption + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/relationship.go b/models/relationship.go new file mode 100644 index 0000000..775bbe8 --- /dev/null +++ b/models/relationship.go @@ -0,0 +1,90 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Relationship Relationship represents a relationship between accounts. +// +// swagger:model Relationship +type Relationship struct { + + // This account is blocking you. + BlockedBy bool `json:"blocked_by,omitempty"` + + // You are blocking this account. + Blocking bool `json:"blocking,omitempty"` + + // You are blocking this account's domain. + DomainBlocking bool `json:"domain_blocking,omitempty"` + + // You are featuring this account on your profile. + Endorsed bool `json:"endorsed,omitempty"` + + // This account follows you. + FollowedBy bool `json:"followed_by,omitempty"` + + // You are following this account. + Following bool `json:"following,omitempty"` + + // The account id. + // Example: 01FBW9XGEP7G6K88VY4S9MPE1R + ID string `json:"id,omitempty"` + + // You are muting this account. + Muting bool `json:"muting,omitempty"` + + // You are muting notifications from this account. + MutingNotifications bool `json:"muting_notifications,omitempty"` + + // Your note on this account. + Note string `json:"note,omitempty"` + + // You are seeing notifications when this account posts. + Notifying bool `json:"notifying,omitempty"` + + // You have requested to follow this account, and the request is pending. + Requested bool `json:"requested,omitempty"` + + // This account has requested to follow you, and the request is pending. + RequestedBy bool `json:"requested_by,omitempty"` + + // You are seeing reblogs/boosts from this account in your home timeline. + ShowingReblogs bool `json:"showing_reblogs,omitempty"` +} + +// Validate validates this relationship +func (m *Relationship) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this relationship based on context it is used +func (m *Relationship) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Relationship) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Relationship) UnmarshalBinary(b []byte) error { + var res Relationship + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/report.go b/models/report.go new file mode 100644 index 0000000..5b405fb --- /dev/null +++ b/models/report.go @@ -0,0 +1,154 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Report Report models a moderation report submitted to the instance, either via the client API or via the federated API. +// +// swagger:model Report +type Report struct { + + // Whether an action has been taken by an admin in response to this report. + // Example: false + ActionTaken bool `json:"action_taken,omitempty"` + + // If an action was taken, at what time was this done? (ISO 8601 Datetime) + // Will be null if not set / no action yet taken. + // Example: 2021-07-30T09:20:25+00:00 + ActionTakenAt string `json:"action_taken_at,omitempty"` + + // If an action was taken, what comment was made by the admin on the taken action? + // Will be null if not set / no action yet taken. + // Example: Account was suspended. + ActionTakenComment string `json:"action_taken_comment,omitempty"` + + // Under what category was this report created? + // Example: spam + Category string `json:"category,omitempty"` + + // Comment submitted when the report was created. + // Will be empty if no comment was submitted. + // Example: This person has been harassing me. + Comment string `json:"comment,omitempty"` + + // The date when this report was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Bool to indicate that report should be federated to remote instance. + // Example: true + Forwarded bool `json:"forwarded,omitempty"` + + // ID of the report. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Array of rule IDs that were submitted along with this report. + // Will be empty if no rule IDs were submitted. + // Example: ["01GPBN5YDY6JKBWE44H7YQBDCQ","01GPBN65PDWSBPWVDD0SQCFFY3"] + RuleIDs []string `json:"rule_ids"` + + // Array of IDs of statuses that were submitted along with this report. + // Will be empty if no status IDs were submitted. + // Example: ["01GPBN5YDY6JKBWE44H7YQBDCQ","01GPBN65PDWSBPWVDD0SQCFFY3"] + StatusIDs []string `json:"status_ids"` + + // target account + TargetAccount *Account `json:"target_account,omitempty"` +} + +// Validate validates this report +func (m *Report) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateTargetAccount(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Report) validateTargetAccount(formats strfmt.Registry) error { + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if m.TargetAccount != nil { + if err := m.TargetAccount.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// ContextValidate validate this report based on the context it is used +func (m *Report) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateTargetAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Report) contextValidateTargetAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.TargetAccount != nil { + + if swag.IsZero(m.TargetAccount) { // not required + return nil + } + + if err := m.TargetAccount.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("target_account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("target_account") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Report) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Report) UnmarshalBinary(b []byte) error { + var res Report + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/search_result.go b/models/search_result.go new file mode 100644 index 0000000..f8ebaf6 --- /dev/null +++ b/models/search_result.go @@ -0,0 +1,186 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SearchResult SearchResult models a search result. +// +// swagger:model SearchResult +type SearchResult struct { + + // accounts + Accounts []*Account `json:"accounts"` + + // Slice of strings if api v1, slice of tags if api v2. + Hashtags []interface{} `json:"hashtags"` + + // statuses + Statuses []*Status `json:"statuses"` +} + +// Validate validates this search result +func (m *SearchResult) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAccounts(formats); err != nil { + res = append(res, err) + } + + if err := m.validateStatuses(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SearchResult) validateAccounts(formats strfmt.Registry) error { + if swag.IsZero(m.Accounts) { // not required + return nil + } + + for i := 0; i < len(m.Accounts); i++ { + if swag.IsZero(m.Accounts[i]) { // not required + continue + } + + if m.Accounts[i] != nil { + if err := m.Accounts[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SearchResult) validateStatuses(formats strfmt.Registry) error { + if swag.IsZero(m.Statuses) { // not required + return nil + } + + for i := 0; i < len(m.Statuses); i++ { + if swag.IsZero(m.Statuses[i]) { // not required + continue + } + + if m.Statuses[i] != nil { + if err := m.Statuses[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this search result based on the context it is used +func (m *SearchResult) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAccounts(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateStatuses(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SearchResult) contextValidateAccounts(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Accounts); i++ { + + if m.Accounts[i] != nil { + + if swag.IsZero(m.Accounts[i]) { // not required + return nil + } + + if err := m.Accounts[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("accounts" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("accounts" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *SearchResult) contextValidateStatuses(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Statuses); i++ { + + if m.Statuses[i] != nil { + + if swag.IsZero(m.Statuses[i]) { // not required + return nil + } + + if err := m.Statuses[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("statuses" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("statuses" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SearchResult) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SearchResult) UnmarshalBinary(b []byte) error { + var res SearchResult + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/source.go b/models/source.go new file mode 100644 index 0000000..2e5e72a --- /dev/null +++ b/models/source.go @@ -0,0 +1,151 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Source Source represents display or publishing preferences of user's own account. +// +// Returned as an additional entity when verifying and updated credentials, as an attribute of Account. +// +// swagger:model Source +type Source struct { + + // This account is aliased to / also known as accounts at the + // given ActivityPub URIs. To set this, use `/api/v1/accounts/alias`. + // + // Omitted from json if empty / not set. + AlsoKnownAsURIs []string `json:"also_known_as_uris"` + + // Metadata about the account. + Fields []*Field `json:"fields"` + + // The number of pending follow requests. + FollowRequestsCount int64 `json:"follow_requests_count,omitempty"` + + // The default posting language for new statuses. + Language string `json:"language,omitempty"` + + // Profile bio. + Note string `json:"note,omitempty"` + + // The default post privacy to be used for new statuses. + // public = Public post + // unlisted = Unlisted post + // private = Followers-only post + // direct = Direct post + Privacy string `json:"privacy,omitempty"` + + // Whether new statuses should be marked sensitive by default. + Sensitive bool `json:"sensitive,omitempty"` + + // The default posting content type for new statuses. + StatusContentType string `json:"status_content_type,omitempty"` +} + +// Validate validates this source +func (m *Source) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFields(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Source) validateFields(formats strfmt.Registry) error { + if swag.IsZero(m.Fields) { // not required + return nil + } + + for i := 0; i < len(m.Fields); i++ { + if swag.IsZero(m.Fields[i]) { // not required + continue + } + + if m.Fields[i] != nil { + if err := m.Fields[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this source based on the context it is used +func (m *Source) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFields(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Source) contextValidateFields(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Fields); i++ { + + if m.Fields[i] != nil { + + if swag.IsZero(m.Fields[i]) { // not required + return nil + } + + if err := m.Fields[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("fields" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("fields" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Source) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Source) UnmarshalBinary(b []byte) error { + var res Source + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/status.go b/models/status.go new file mode 100644 index 0000000..80f3af1 --- /dev/null +++ b/models/status.go @@ -0,0 +1,749 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Status Status models a status or post. +// +// swagger:model Status +type Status struct { + + // This status has been bookmarked by the account viewing it. + Bookmarked bool `json:"bookmarked,omitempty"` + + // The content of this status. Should be HTML, but might also be plaintext in some cases. + // Example: \u003cp\u003eHey this is a status!\u003c/p\u003e + Content string `json:"content,omitempty"` + + // The date when this status was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Custom emoji to be used when rendering status content. + Emojis []*Emoji `json:"emojis"` + + // This status has been favourited by the account viewing it. + Favourited bool `json:"favourited,omitempty"` + + // Number of favourites/likes this status has received, according to our instance. + FavouritesCount int64 `json:"favourites_count,omitempty"` + + // A list of filters that matched this status and why they matched, if there are any such filters. + Filtered []*FilterResult `json:"filtered"` + + // ID of the status. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // ID of the account being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"` + + // ID of the status being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToID string `json:"in_reply_to_id,omitempty"` + + // Primary language of this status (ISO 639 Part 1 two-letter language code). + // Will be null if language is not known. + // Example: en + Language string `json:"language,omitempty"` + + // Media that is attached to this status. + MediaAttachments []*Attachment `json:"media_attachments"` + + // Mentions of users within the status content. + Mentions []*Mention `json:"mentions"` + + // Replies to this status have been muted by the account viewing it. + Muted bool `json:"muted,omitempty"` + + // This status has been pinned by the account viewing it (only relevant for your own statuses). + Pinned bool `json:"pinned,omitempty"` + + // This status has been boosted/reblogged by the account viewing it. + Reblogged bool `json:"reblogged,omitempty"` + + // Number of times this status has been boosted/reblogged, according to our instance. + ReblogsCount int64 `json:"reblogs_count,omitempty"` + + // Number of replies to this status, according to our instance. + RepliesCount int64 `json:"replies_count,omitempty"` + + // Status contains sensitive content. + // Example: false + Sensitive bool `json:"sensitive,omitempty"` + + // Subject, summary, or content warning for the status. + // Example: warning nsfw + SpoilerText string `json:"spoiler_text,omitempty"` + + // Hashtags used within the status content. + Tags []*Tag `json:"tags"` + + // Plain-text source of a status. Returned instead of content when status is deleted, + // so the user may redraft from the source text without the client having to reverse-engineer + // the original text from the HTML content. + Text string `json:"text,omitempty"` + + // ActivityPub URI of the status. Equivalent to the status's activitypub ID. + // Example: https://example.org/users/some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URI string `json:"uri,omitempty"` + + // The status's publicly available web URL. This link will only work if the visibility of the status is 'public'. + // Example: https://example.org/@some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URL string `json:"url,omitempty"` + + // Visibility of this status. + // Example: unlisted + Visibility string `json:"visibility,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // application + Application *Application `json:"application,omitempty"` + + // card + Card *Card `json:"card,omitempty"` + + // interaction policy + InteractionPolicy *InteractionPolicy `json:"interaction_policy,omitempty"` + + // poll + Poll *Poll `json:"poll,omitempty"` + + // reblog + Reblog *StatusReblogged `json:"reblog,omitempty"` +} + +// Validate validates this status +func (m *Status) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFiltered(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMentions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTags(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateApplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCard(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInteractionPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePoll(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReblog(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Status) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateFiltered(formats strfmt.Registry) error { + if swag.IsZero(m.Filtered) { // not required + return nil + } + + for i := 0; i < len(m.Filtered); i++ { + if swag.IsZero(m.Filtered[i]) { // not required + continue + } + + if m.Filtered[i] != nil { + if err := m.Filtered[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + for i := 0; i < len(m.MediaAttachments); i++ { + if swag.IsZero(m.MediaAttachments[i]) { // not required + continue + } + + if m.MediaAttachments[i] != nil { + if err := m.MediaAttachments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateMentions(formats strfmt.Registry) error { + if swag.IsZero(m.Mentions) { // not required + return nil + } + + for i := 0; i < len(m.Mentions); i++ { + if swag.IsZero(m.Mentions[i]) { // not required + continue + } + + if m.Mentions[i] != nil { + if err := m.Mentions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateTags(formats strfmt.Registry) error { + if swag.IsZero(m.Tags) { // not required + return nil + } + + for i := 0; i < len(m.Tags); i++ { + if swag.IsZero(m.Tags[i]) { // not required + continue + } + + if m.Tags[i] != nil { + if err := m.Tags[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Status) validateApplication(formats strfmt.Registry) error { + if swag.IsZero(m.Application) { // not required + return nil + } + + if m.Application != nil { + if err := m.Application.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *Status) validateCard(formats strfmt.Registry) error { + if swag.IsZero(m.Card) { // not required + return nil + } + + if m.Card != nil { + if err := m.Card.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *Status) validateInteractionPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if m.InteractionPolicy != nil { + if err := m.InteractionPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *Status) validatePoll(formats strfmt.Registry) error { + if swag.IsZero(m.Poll) { // not required + return nil + } + + if m.Poll != nil { + if err := m.Poll.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *Status) validateReblog(formats strfmt.Registry) error { + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if m.Reblog != nil { + if err := m.Reblog.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// ContextValidate validate this status based on the context it is used +func (m *Status) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFiltered(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMentions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTags(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateApplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCard(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInteractionPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoll(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReblog(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *Status) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateFiltered(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Filtered); i++ { + + if m.Filtered[i] != nil { + + if swag.IsZero(m.Filtered[i]) { // not required + return nil + } + + if err := m.Filtered[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MediaAttachments); i++ { + + if m.MediaAttachments[i] != nil { + + if swag.IsZero(m.MediaAttachments[i]) { // not required + return nil + } + + if err := m.MediaAttachments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateMentions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Mentions); i++ { + + if m.Mentions[i] != nil { + + if swag.IsZero(m.Mentions[i]) { // not required + return nil + } + + if err := m.Mentions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tags); i++ { + + if m.Tags[i] != nil { + + if swag.IsZero(m.Tags[i]) { // not required + return nil + } + + if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *Status) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateApplication(ctx context.Context, formats strfmt.Registry) error { + + if m.Application != nil { + + if swag.IsZero(m.Application) { // not required + return nil + } + + if err := m.Application.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateCard(ctx context.Context, formats strfmt.Registry) error { + + if m.Card != nil { + + if swag.IsZero(m.Card) { // not required + return nil + } + + if err := m.Card.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateInteractionPolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.InteractionPolicy != nil { + + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if err := m.InteractionPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidatePoll(ctx context.Context, formats strfmt.Registry) error { + + if m.Poll != nil { + + if swag.IsZero(m.Poll) { // not required + return nil + } + + if err := m.Poll.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *Status) contextValidateReblog(ctx context.Context, formats strfmt.Registry) error { + + if m.Reblog != nil { + + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if err := m.Reblog.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *Status) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Status) UnmarshalBinary(b []byte) error { + var res Status + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/status_edit.go b/models/status_edit.go new file mode 100644 index 0000000..5c7db83 --- /dev/null +++ b/models/status_edit.go @@ -0,0 +1,303 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// StatusEdit StatusEdit represents one historical revision of a status, containing +// partial information about the state of the status at that revision. +// +// swagger:model StatusEdit +type StatusEdit struct { + + // The content of this status at this revision. + // Should be HTML, but might also be plaintext in some cases. + // Example: \u003cp\u003eHey this is a status!\u003c/p\u003e + Content string `json:"content,omitempty"` + + // The date when this revision was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Custom emoji to be used when rendering status content. + Emojis []*Emoji `json:"emojis"` + + // Media that is attached to this status. + MediaAttachments []*Attachment `json:"media_attachments"` + + // Status marked sensitive at this revision. + // Example: false + Sensitive bool `json:"sensitive,omitempty"` + + // Subject, summary, or content warning for the status at this revision. + // Example: warning nsfw + SpoilerText string `json:"spoiler_text,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // poll + Poll *Poll `json:"poll,omitempty"` +} + +// Validate validates this status edit +func (m *StatusEdit) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePoll(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusEdit) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + for i := 0; i < len(m.MediaAttachments); i++ { + if swag.IsZero(m.MediaAttachments[i]) { // not required + continue + } + + if m.MediaAttachments[i] != nil { + if err := m.MediaAttachments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusEdit) validatePoll(formats strfmt.Registry) error { + if swag.IsZero(m.Poll) { // not required + return nil + } + + if m.Poll != nil { + if err := m.Poll.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +// ContextValidate validate this status edit based on the context it is used +func (m *StatusEdit) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoll(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusEdit) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MediaAttachments); i++ { + + if m.MediaAttachments[i] != nil { + + if swag.IsZero(m.MediaAttachments[i]) { // not required + return nil + } + + if err := m.MediaAttachments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusEdit) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusEdit) contextValidatePoll(ctx context.Context, formats strfmt.Registry) error { + + if m.Poll != nil { + + if swag.IsZero(m.Poll) { // not required + return nil + } + + if err := m.Poll.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StatusEdit) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StatusEdit) UnmarshalBinary(b []byte) error { + var res StatusEdit + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/status_reblogged.go b/models/status_reblogged.go new file mode 100644 index 0000000..c8863a6 --- /dev/null +++ b/models/status_reblogged.go @@ -0,0 +1,749 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// StatusReblogged StatusReblogged represents a reblogged status. +// +// swagger:model StatusReblogged +type StatusReblogged struct { + + // This status has been bookmarked by the account viewing it. + Bookmarked bool `json:"bookmarked,omitempty"` + + // The content of this status. Should be HTML, but might also be plaintext in some cases. + // Example: \u003cp\u003eHey this is a status!\u003c/p\u003e + Content string `json:"content,omitempty"` + + // The date when this status was created (ISO 8601 Datetime). + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // Custom emoji to be used when rendering status content. + Emojis []*Emoji `json:"emojis"` + + // This status has been favourited by the account viewing it. + Favourited bool `json:"favourited,omitempty"` + + // Number of favourites/likes this status has received, according to our instance. + FavouritesCount int64 `json:"favourites_count,omitempty"` + + // A list of filters that matched this status and why they matched, if there are any such filters. + Filtered []*FilterResult `json:"filtered"` + + // ID of the status. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // ID of the account being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToAccountID string `json:"in_reply_to_account_id,omitempty"` + + // ID of the status being replied to. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + InReplyToID string `json:"in_reply_to_id,omitempty"` + + // Primary language of this status (ISO 639 Part 1 two-letter language code). + // Will be null if language is not known. + // Example: en + Language string `json:"language,omitempty"` + + // Media that is attached to this status. + MediaAttachments []*Attachment `json:"media_attachments"` + + // Mentions of users within the status content. + Mentions []*Mention `json:"mentions"` + + // Replies to this status have been muted by the account viewing it. + Muted bool `json:"muted,omitempty"` + + // This status has been pinned by the account viewing it (only relevant for your own statuses). + Pinned bool `json:"pinned,omitempty"` + + // This status has been boosted/reblogged by the account viewing it. + Reblogged bool `json:"reblogged,omitempty"` + + // Number of times this status has been boosted/reblogged, according to our instance. + ReblogsCount int64 `json:"reblogs_count,omitempty"` + + // Number of replies to this status, according to our instance. + RepliesCount int64 `json:"replies_count,omitempty"` + + // Status contains sensitive content. + // Example: false + Sensitive bool `json:"sensitive,omitempty"` + + // Subject, summary, or content warning for the status. + // Example: warning nsfw + SpoilerText string `json:"spoiler_text,omitempty"` + + // Hashtags used within the status content. + Tags []*Tag `json:"tags"` + + // Plain-text source of a status. Returned instead of content when status is deleted, + // so the user may redraft from the source text without the client having to reverse-engineer + // the original text from the HTML content. + Text string `json:"text,omitempty"` + + // ActivityPub URI of the status. Equivalent to the status's activitypub ID. + // Example: https://example.org/users/some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URI string `json:"uri,omitempty"` + + // The status's publicly available web URL. This link will only work if the visibility of the status is 'public'. + // Example: https://example.org/@some_user/statuses/01FBVD42CQ3ZEEVMW180SBX03B + URL string `json:"url,omitempty"` + + // Visibility of this status. + // Example: unlisted + Visibility string `json:"visibility,omitempty"` + + // account + Account *Account `json:"account,omitempty"` + + // application + Application *Application `json:"application,omitempty"` + + // card + Card *Card `json:"card,omitempty"` + + // interaction policy + InteractionPolicy *InteractionPolicy `json:"interaction_policy,omitempty"` + + // poll + Poll *Poll `json:"poll,omitempty"` + + // reblog + Reblog *StatusReblogged `json:"reblog,omitempty"` +} + +// Validate validates this status reblogged +func (m *StatusReblogged) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateEmojis(formats); err != nil { + res = append(res, err) + } + + if err := m.validateFiltered(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMediaAttachments(formats); err != nil { + res = append(res, err) + } + + if err := m.validateMentions(formats); err != nil { + res = append(res, err) + } + + if err := m.validateTags(formats); err != nil { + res = append(res, err) + } + + if err := m.validateAccount(formats); err != nil { + res = append(res, err) + } + + if err := m.validateApplication(formats); err != nil { + res = append(res, err) + } + + if err := m.validateCard(formats); err != nil { + res = append(res, err) + } + + if err := m.validateInteractionPolicy(formats); err != nil { + res = append(res, err) + } + + if err := m.validatePoll(formats); err != nil { + res = append(res, err) + } + + if err := m.validateReblog(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusReblogged) validateEmojis(formats strfmt.Registry) error { + if swag.IsZero(m.Emojis) { // not required + return nil + } + + for i := 0; i < len(m.Emojis); i++ { + if swag.IsZero(m.Emojis[i]) { // not required + continue + } + + if m.Emojis[i] != nil { + if err := m.Emojis[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateFiltered(formats strfmt.Registry) error { + if swag.IsZero(m.Filtered) { // not required + return nil + } + + for i := 0; i < len(m.Filtered); i++ { + if swag.IsZero(m.Filtered[i]) { // not required + continue + } + + if m.Filtered[i] != nil { + if err := m.Filtered[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateMediaAttachments(formats strfmt.Registry) error { + if swag.IsZero(m.MediaAttachments) { // not required + return nil + } + + for i := 0; i < len(m.MediaAttachments); i++ { + if swag.IsZero(m.MediaAttachments[i]) { // not required + continue + } + + if m.MediaAttachments[i] != nil { + if err := m.MediaAttachments[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateMentions(formats strfmt.Registry) error { + if swag.IsZero(m.Mentions) { // not required + return nil + } + + for i := 0; i < len(m.Mentions); i++ { + if swag.IsZero(m.Mentions[i]) { // not required + continue + } + + if m.Mentions[i] != nil { + if err := m.Mentions[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateTags(formats strfmt.Registry) error { + if swag.IsZero(m.Tags) { // not required + return nil + } + + for i := 0; i < len(m.Tags); i++ { + if swag.IsZero(m.Tags[i]) { // not required + continue + } + + if m.Tags[i] != nil { + if err := m.Tags[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) validateAccount(formats strfmt.Registry) error { + if swag.IsZero(m.Account) { // not required + return nil + } + + if m.Account != nil { + if err := m.Account.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateApplication(formats strfmt.Registry) error { + if swag.IsZero(m.Application) { // not required + return nil + } + + if m.Application != nil { + if err := m.Application.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateCard(formats strfmt.Registry) error { + if swag.IsZero(m.Card) { // not required + return nil + } + + if m.Card != nil { + if err := m.Card.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateInteractionPolicy(formats strfmt.Registry) error { + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if m.InteractionPolicy != nil { + if err := m.InteractionPolicy.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validatePoll(formats strfmt.Registry) error { + if swag.IsZero(m.Poll) { // not required + return nil + } + + if m.Poll != nil { + if err := m.Poll.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) validateReblog(formats strfmt.Registry) error { + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if m.Reblog != nil { + if err := m.Reblog.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// ContextValidate validate this status reblogged based on the context it is used +func (m *StatusReblogged) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateEmojis(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateFiltered(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMediaAttachments(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateMentions(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateTags(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateAccount(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateApplication(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateCard(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateInteractionPolicy(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidatePoll(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateReblog(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *StatusReblogged) contextValidateEmojis(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Emojis); i++ { + + if m.Emojis[i] != nil { + + if swag.IsZero(m.Emojis[i]) { // not required + return nil + } + + if err := m.Emojis[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("emojis" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("emojis" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateFiltered(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Filtered); i++ { + + if m.Filtered[i] != nil { + + if swag.IsZero(m.Filtered[i]) { // not required + return nil + } + + if err := m.Filtered[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("filtered" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("filtered" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateMediaAttachments(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.MediaAttachments); i++ { + + if m.MediaAttachments[i] != nil { + + if swag.IsZero(m.MediaAttachments[i]) { // not required + return nil + } + + if err := m.MediaAttachments[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("media_attachments" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateMentions(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Mentions); i++ { + + if m.Mentions[i] != nil { + + if swag.IsZero(m.Mentions[i]) { // not required + return nil + } + + if err := m.Mentions[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("mentions" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("mentions" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateTags(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Tags); i++ { + + if m.Tags[i] != nil { + + if swag.IsZero(m.Tags[i]) { // not required + return nil + } + + if err := m.Tags[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("tags" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("tags" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *StatusReblogged) contextValidateAccount(ctx context.Context, formats strfmt.Registry) error { + + if m.Account != nil { + + if swag.IsZero(m.Account) { // not required + return nil + } + + if err := m.Account.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("account") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("account") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateApplication(ctx context.Context, formats strfmt.Registry) error { + + if m.Application != nil { + + if swag.IsZero(m.Application) { // not required + return nil + } + + if err := m.Application.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("application") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("application") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateCard(ctx context.Context, formats strfmt.Registry) error { + + if m.Card != nil { + + if swag.IsZero(m.Card) { // not required + return nil + } + + if err := m.Card.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("card") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("card") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateInteractionPolicy(ctx context.Context, formats strfmt.Registry) error { + + if m.InteractionPolicy != nil { + + if swag.IsZero(m.InteractionPolicy) { // not required + return nil + } + + if err := m.InteractionPolicy.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("interaction_policy") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("interaction_policy") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidatePoll(ctx context.Context, formats strfmt.Registry) error { + + if m.Poll != nil { + + if swag.IsZero(m.Poll) { // not required + return nil + } + + if err := m.Poll.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("poll") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("poll") + } + return err + } + } + + return nil +} + +func (m *StatusReblogged) contextValidateReblog(ctx context.Context, formats strfmt.Registry) error { + + if m.Reblog != nil { + + if swag.IsZero(m.Reblog) { // not required + return nil + } + + if err := m.Reblog.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("reblog") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("reblog") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *StatusReblogged) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StatusReblogged) UnmarshalBinary(b []byte) error { + var res StatusReblogged + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/status_source.go b/models/status_source.go new file mode 100644 index 0000000..7186b10 --- /dev/null +++ b/models/status_source.go @@ -0,0 +1,58 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// StatusSource StatusSource represents the source text of a +// status as submitted to the API when it was created. +// +// swagger:model StatusSource +type StatusSource struct { + + // ID of the status. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Plain-text version of spoiler text. + SpoilerText string `json:"spoiler_text,omitempty"` + + // Plain-text source of a status. + Text string `json:"text,omitempty"` +} + +// Validate validates this status source +func (m *StatusSource) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this status source based on context it is used +func (m *StatusSource) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *StatusSource) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *StatusSource) UnmarshalBinary(b []byte) error { + var res StatusSource + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/swagger_collection.go b/models/swagger_collection.go new file mode 100644 index 0000000..3d14a6d --- /dev/null +++ b/models/swagger_collection.go @@ -0,0 +1,174 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SwaggerCollection SwaggerCollection represents an ActivityPub Collection. +// +// swagger:model SwaggerCollection +type SwaggerCollection struct { + + // ActivityStreams JSON-LD context. + // A string or an array of strings, or more + // complex nested items. + // Example: https://www.w3.org/ns/activitystreams + Context interface{} `json:"@context,omitempty"` + + // ActivityStreams ID. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies + ID string `json:"id,omitempty"` + + // ActivityStreams type. + // Example: Collection + Type string `json:"type,omitempty"` + + // first + First *SwaggerCollectionPage `json:"first,omitempty"` + + // last + Last *SwaggerCollectionPage `json:"last,omitempty"` +} + +// Validate validates this swagger collection +func (m *SwaggerCollection) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateFirst(formats); err != nil { + res = append(res, err) + } + + if err := m.validateLast(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SwaggerCollection) validateFirst(formats strfmt.Registry) error { + if swag.IsZero(m.First) { // not required + return nil + } + + if m.First != nil { + if err := m.First.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("first") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("first") + } + return err + } + } + + return nil +} + +func (m *SwaggerCollection) validateLast(formats strfmt.Registry) error { + if swag.IsZero(m.Last) { // not required + return nil + } + + if m.Last != nil { + if err := m.Last.Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last") + } + return err + } + } + + return nil +} + +// ContextValidate validate this swagger collection based on the context it is used +func (m *SwaggerCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateFirst(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateLast(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *SwaggerCollection) contextValidateFirst(ctx context.Context, formats strfmt.Registry) error { + + if m.First != nil { + + if swag.IsZero(m.First) { // not required + return nil + } + + if err := m.First.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("first") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("first") + } + return err + } + } + + return nil +} + +func (m *SwaggerCollection) contextValidateLast(ctx context.Context, formats strfmt.Registry) error { + + if m.Last != nil { + + if swag.IsZero(m.Last) { // not required + return nil + } + + if err := m.Last.ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("last") + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("last") + } + return err + } + } + + return nil +} + +// MarshalBinary interface implementation +func (m *SwaggerCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SwaggerCollection) UnmarshalBinary(b []byte) error { + var res SwaggerCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/swagger_collection_page.go b/models/swagger_collection_page.go new file mode 100644 index 0000000..aac783c --- /dev/null +++ b/models/swagger_collection_page.go @@ -0,0 +1,67 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SwaggerCollectionPage SwaggerCollectionPage represents one page of a collection. +// +// swagger:model SwaggerCollectionPage +type SwaggerCollectionPage struct { + + // ActivityStreams ID. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies?page=true + ID string `json:"id,omitempty"` + + // Items on this page. + // Example: ["https://example.org/users/some_other_user/statuses/086417595981111564","https://another.example.com/users/another_user/statuses/01FCN8XDV3YG7B4R42QA6YQZ9R"] + Items []string `json:"items"` + + // Link to the next page. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies?only_other_accounts=true\u0026page=true + Next string `json:"next,omitempty"` + + // Collection this page belongs to. + // Example: https://example.org/users/some_user/statuses/106717595988259568/replies + PartOf string `json:"partOf,omitempty"` + + // ActivityStreams type. + // Example: CollectionPage + Type string `json:"type,omitempty"` +} + +// Validate validates this swagger collection page +func (m *SwaggerCollectionPage) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this swagger collection page based on context it is used +func (m *SwaggerCollectionPage) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SwaggerCollectionPage) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SwaggerCollectionPage) UnmarshalBinary(b []byte) error { + var res SwaggerCollectionPage + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/swagger_featured_collection.go b/models/swagger_featured_collection.go new file mode 100644 index 0000000..8037174 --- /dev/null +++ b/models/swagger_featured_collection.go @@ -0,0 +1,69 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// SwaggerFeaturedCollection SwaggerFeaturedCollection represents an ActivityPub OrderedCollection. +// +// swagger:model SwaggerFeaturedCollection +type SwaggerFeaturedCollection struct { + + // ActivityStreams JSON-LD context. + // A string or an array of strings, or more + // complex nested items. + // Example: https://www.w3.org/ns/activitystreams + Context interface{} `json:"@context,omitempty"` + + // ActivityStreams ID. + // Example: https://example.org/users/some_user/collections/featured + ID string `json:"id,omitempty"` + + // List of status URIs. + // Example: ["https://example.org/users/some_user/statuses/01GSZ0F7Q8SJKNRF777GJD271R","https://example.org/users/some_user/statuses/01GSZ0G012CBQ7TEKX689S3QRE"] + Items []string `json:"items"` + + // Number of items in this collection. + // Example: 2 + TotalItems int64 `json:"TotalItems,omitempty"` + + // ActivityStreams type. + // Example: OrderedCollection + Type string `json:"type,omitempty"` +} + +// Validate validates this swagger featured collection +func (m *SwaggerFeaturedCollection) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this swagger featured collection based on context it is used +func (m *SwaggerFeaturedCollection) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *SwaggerFeaturedCollection) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *SwaggerFeaturedCollection) UnmarshalBinary(b []byte) error { + var res SwaggerFeaturedCollection + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/tag.go b/models/tag.go new file mode 100644 index 0000000..5e9426b --- /dev/null +++ b/models/tag.go @@ -0,0 +1,60 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Tag Tag represents a hashtag used within the content of a status. +// +// swagger:model Tag +type Tag struct { + + // History of this hashtag's usage. + // Currently just a stub, if provided will always be an empty array. + // Example: [] + History []interface{} `json:"history"` + + // The value of the hashtag after the # sign. + // Example: helloworld + Name string `json:"name,omitempty"` + + // Web link to the hashtag. + // Example: https://example.org/tags/helloworld + URL string `json:"url,omitempty"` +} + +// Validate validates this tag +func (m *Tag) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this tag based on context it is used +func (m *Tag) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Tag) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Tag) UnmarshalBinary(b []byte) error { + var res Tag + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/theme.go b/models/theme.go new file mode 100644 index 0000000..a0e1b9c --- /dev/null +++ b/models/theme.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Theme Theme represents one user-selectable preset CSS theme. +// +// swagger:model Theme +type Theme struct { + + // User-facing description of this theme. + Description string `json:"description,omitempty"` + + // FileName of this theme in the themes directory. + FileName string `json:"file_name,omitempty"` + + // User-facing title of this theme. + Title string `json:"title,omitempty"` +} + +// Validate validates this theme +func (m *Theme) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this theme based on context it is used +func (m *Theme) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Theme) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Theme) UnmarshalBinary(b []byte) error { + var res Theme + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/thread_context.go b/models/thread_context.go new file mode 100644 index 0000000..4a90c0f --- /dev/null +++ b/models/thread_context.go @@ -0,0 +1,184 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// ThreadContext ThreadContext models the tree or +// "thread" around a given status. +// +// swagger:model ThreadContext +type ThreadContext struct { + + // Parents in the thread. + Ancestors []*Status `json:"ancestors"` + + // Children in the thread. + Descendants []*Status `json:"descendants"` +} + +// Validate validates this thread context +func (m *ThreadContext) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateAncestors(formats); err != nil { + res = append(res, err) + } + + if err := m.validateDescendants(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ThreadContext) validateAncestors(formats strfmt.Registry) error { + if swag.IsZero(m.Ancestors) { // not required + return nil + } + + for i := 0; i < len(m.Ancestors); i++ { + if swag.IsZero(m.Ancestors[i]) { // not required + continue + } + + if m.Ancestors[i] != nil { + if err := m.Ancestors[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ThreadContext) validateDescendants(formats strfmt.Registry) error { + if swag.IsZero(m.Descendants) { // not required + return nil + } + + for i := 0; i < len(m.Descendants); i++ { + if swag.IsZero(m.Descendants[i]) { // not required + continue + } + + if m.Descendants[i] != nil { + if err := m.Descendants[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("descendants" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("descendants" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this thread context based on the context it is used +func (m *ThreadContext) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateAncestors(ctx, formats); err != nil { + res = append(res, err) + } + + if err := m.contextValidateDescendants(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *ThreadContext) contextValidateAncestors(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Ancestors); i++ { + + if m.Ancestors[i] != nil { + + if swag.IsZero(m.Ancestors[i]) { // not required + return nil + } + + if err := m.Ancestors[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("ancestors" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +func (m *ThreadContext) contextValidateDescendants(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Descendants); i++ { + + if m.Descendants[i] != nil { + + if swag.IsZero(m.Descendants[i]) { // not required + return nil + } + + if err := m.Descendants[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("descendants" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("descendants" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *ThreadContext) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *ThreadContext) UnmarshalBinary(b []byte) error { + var res ThreadContext + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/timeline_marker.go b/models/timeline_marker.go new file mode 100644 index 0000000..6ba5e43 --- /dev/null +++ b/models/timeline_marker.go @@ -0,0 +1,56 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// TimelineMarker TimelineMarker contains information about a user's progress through a specific timeline. +// +// swagger:model TimelineMarker +type TimelineMarker struct { + + // The ID of the most recently viewed entity. + LastReadID string `json:"last_read_id,omitempty"` + + // The timestamp of when the marker was set (ISO 8601 Datetime) + UpdatedAt string `json:"updated_at,omitempty"` + + // Used for locking to prevent write conflicts. + Version int64 `json:"version,omitempty"` +} + +// Validate validates this timeline marker +func (m *TimelineMarker) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this timeline marker based on context it is used +func (m *TimelineMarker) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *TimelineMarker) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *TimelineMarker) UnmarshalBinary(b []byte) error { + var res TimelineMarker + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/token.go b/models/token.go new file mode 100644 index 0000000..64168f4 --- /dev/null +++ b/models/token.go @@ -0,0 +1,62 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// Token Token represents an OAuth token used for authenticating with the GoToSocial API and performing actions. +// +// swagger:model Token +type Token struct { + + // Access token used for authorization. + AccessToken string `json:"access_token,omitempty"` + + // When the OAuth token was generated (UNIX timestamp seconds). + // Example: 1627644520 + CreatedAt int64 `json:"created_at,omitempty"` + + // OAuth scopes granted by this token, space-separated. + // Example: read write admin + Scope string `json:"scope,omitempty"` + + // OAuth token type. Will always be 'Bearer'. + // Example: bearer + TokenType string `json:"token_type,omitempty"` +} + +// Validate validates this token +func (m *Token) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this token based on context it is used +func (m *Token) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *Token) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *Token) UnmarshalBinary(b []byte) error { + var res Token + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/user.go b/models/user.go new file mode 100644 index 0000000..1965170 --- /dev/null +++ b/models/user.go @@ -0,0 +1,99 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// User User models fields relevant to one user. +// +// swagger:model User +type User struct { + + // User is an admin. + // Example: false + Admin bool `json:"admin,omitempty"` + + // User was approved by an admin. + // Example: true + Approved bool `json:"approved,omitempty"` + + // Time when the last "please confirm your email address" email was sent, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + ConfirmationSentAt string `json:"confirmation_sent_at,omitempty"` + + // Time at which the email given in the `email` field was confirmed, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + ConfirmedAt string `json:"confirmed_at,omitempty"` + + // Time this user was created. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + CreatedAt string `json:"created_at,omitempty"` + + // User's account is disabled. + // Example: false + Disabled bool `json:"disabled,omitempty"` + + // Confirmed email address of this user, if set. + // Example: someone@example.org + Email string `json:"email,omitempty"` + + // Database ID of this user. + // Example: 01FBVD42CQ3ZEEVMW180SBX03B + ID string `json:"id,omitempty"` + + // Time at which this user was last emailed, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + LastEmailedAt string `json:"last_emailed_at,omitempty"` + + // User is a moderator. + // Example: false + Moderator bool `json:"moderator,omitempty"` + + // Reason for sign-up, if provided. + // Example: Please! Pretty please! + Reason string `json:"reason,omitempty"` + + // Time when the last "please reset your password" email was sent, if at all. (ISO 8601 Datetime) + // Example: 2021-07-30T09:20:25+00:00 + ResetPasswordSentAt string `json:"reset_password_sent_at,omitempty"` + + // Unconfirmed email address of this user, if set. + // Example: someone.else@somewhere.else.example.org + UnconfirmedEmail string `json:"unconfirmed_email,omitempty"` +} + +// Validate validates this user +func (m *User) Validate(formats strfmt.Registry) error { + return nil +} + +// ContextValidate validates this user based on context it is used +func (m *User) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + return nil +} + +// MarshalBinary interface implementation +func (m *User) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *User) UnmarshalBinary(b []byte) error { + var res User + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +} diff --git a/models/well_known_response.go b/models/well_known_response.go new file mode 100644 index 0000000..3cd0a53 --- /dev/null +++ b/models/well_known_response.go @@ -0,0 +1,130 @@ +// Code generated by go-swagger; DO NOT EDIT. + +package models + +// This file was generated by the swagger tool. +// Editing this file might prove futile when you re-run the swagger generate command + +import ( + "context" + "strconv" + + "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" + "github.com/go-openapi/swag" +) + +// WellKnownResponse WellKnownResponse represents the response to either a webfinger request for an 'acct' resource, or a request to nodeinfo. +// For example, it would be returned from https://example.org/.well-known/webfinger?resource=acct:some_username@example.org +// +// See https://webfinger.net/ +// +// swagger:model WellKnownResponse +type WellKnownResponse struct { + + // aliases + Aliases []string `json:"aliases"` + + // links + Links []*Link `json:"links"` + + // subject + Subject string `json:"subject,omitempty"` +} + +// Validate validates this well known response +func (m *WellKnownResponse) Validate(formats strfmt.Registry) error { + var res []error + + if err := m.validateLinks(formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *WellKnownResponse) validateLinks(formats strfmt.Registry) error { + if swag.IsZero(m.Links) { // not required + return nil + } + + for i := 0; i < len(m.Links); i++ { + if swag.IsZero(m.Links[i]) { // not required + continue + } + + if m.Links[i] != nil { + if err := m.Links[i].Validate(formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// ContextValidate validate this well known response based on the context it is used +func (m *WellKnownResponse) ContextValidate(ctx context.Context, formats strfmt.Registry) error { + var res []error + + if err := m.contextValidateLinks(ctx, formats); err != nil { + res = append(res, err) + } + + if len(res) > 0 { + return errors.CompositeValidationError(res...) + } + return nil +} + +func (m *WellKnownResponse) contextValidateLinks(ctx context.Context, formats strfmt.Registry) error { + + for i := 0; i < len(m.Links); i++ { + + if m.Links[i] != nil { + + if swag.IsZero(m.Links[i]) { // not required + return nil + } + + if err := m.Links[i].ContextValidate(ctx, formats); err != nil { + if ve, ok := err.(*errors.Validation); ok { + return ve.ValidateName("links" + "." + strconv.Itoa(i)) + } else if ce, ok := err.(*errors.CompositeError); ok { + return ce.ValidateName("links" + "." + strconv.Itoa(i)) + } + return err + } + } + + } + + return nil +} + +// MarshalBinary interface implementation +func (m *WellKnownResponse) MarshalBinary() ([]byte, error) { + if m == nil { + return nil, nil + } + return swag.WriteJSON(m) +} + +// UnmarshalBinary interface implementation +func (m *WellKnownResponse) UnmarshalBinary(b []byte) error { + var res WellKnownResponse + if err := swag.ReadJSON(b, &res); err != nil { + return err + } + *m = res + return nil +}