├── .gitignore ├── .travis.yml ├── LICENSE ├── Makefile ├── README.md ├── auth └── auth.go ├── client ├── application │ ├── application_client.go │ ├── create_app_parameters.go │ ├── create_app_responses.go │ ├── delete_app_parameters.go │ ├── delete_app_responses.go │ ├── get_apps_parameters.go │ ├── get_apps_responses.go │ ├── update_application_parameters.go │ ├── update_application_responses.go │ ├── upload_app_image_parameters.go │ └── upload_app_image_responses.go ├── client │ ├── client_client.go │ ├── create_client_parameters.go │ ├── create_client_responses.go │ ├── delete_client_parameters.go │ ├── delete_client_responses.go │ ├── get_clients_parameters.go │ ├── get_clients_responses.go │ ├── update_client_parameters.go │ └── update_client_responses.go ├── gotify_rest_client.go ├── message │ ├── create_message_parameters.go │ ├── create_message_responses.go │ ├── delete_app_messages_parameters.go │ ├── delete_app_messages_responses.go │ ├── delete_message_parameters.go │ ├── delete_message_responses.go │ ├── delete_messages_parameters.go │ ├── delete_messages_responses.go │ ├── get_app_messages_parameters.go │ ├── get_app_messages_responses.go │ ├── get_messages_parameters.go │ ├── get_messages_responses.go │ ├── message_client.go │ ├── stream_messages_parameters.go │ └── stream_messages_responses.go ├── plugin │ ├── disable_plugin_parameters.go │ ├── disable_plugin_responses.go │ ├── enable_plugin_parameters.go │ ├── enable_plugin_responses.go │ ├── get_plugin_config_parameters.go │ ├── get_plugin_config_responses.go │ ├── get_plugin_display_parameters.go │ ├── get_plugin_display_responses.go │ ├── get_plugins_parameters.go │ ├── get_plugins_responses.go │ ├── plugin_client.go │ ├── update_plugin_config_parameters.go │ └── update_plugin_config_responses.go ├── user │ ├── create_user_parameters.go │ ├── create_user_responses.go │ ├── current_user_parameters.go │ ├── current_user_responses.go │ ├── delete_user_parameters.go │ ├── delete_user_responses.go │ ├── get_user_parameters.go │ ├── get_user_responses.go │ ├── get_users_parameters.go │ ├── get_users_responses.go │ ├── update_current_user_parameters.go │ ├── update_current_user_responses.go │ ├── update_user_parameters.go │ ├── update_user_responses.go │ └── user_client.go └── version │ ├── get_version_parameters.go │ ├── get_version_responses.go │ └── version_client.go ├── go.mod ├── go.sum ├── gotify └── factory.go └── models ├── application.go ├── client.go ├── error.go ├── message.go ├── paging.go ├── pluginconf.go ├── user.go └── version.go /.gitignore: -------------------------------------------------------------------------------- 1 | .tools 2 | .idea 3 | build 4 | .swagger-codegen -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: go 2 | go: 3 | - "1.11" 4 | 5 | notifications: 6 | email: false 7 | 8 | env: 9 | - GO111MODULE=on 10 | 11 | install: 12 | - go mod download 13 | - go mod verify 14 | 15 | script: 16 | - go install ./... -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Gotify 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | GOTIFY_VERSION=2.0.4 2 | BUILD=./build 3 | TEMP_SPEC=${BUILD}/gotify.json 4 | SWAGGER=./.tools/swagger 5 | 6 | ifeq ($(OS),Windows_NT) 7 | DOWNLOAD_SWAGGER=swagger_windows_amd64.exe 8 | else 9 | DOWNLOAD_SWAGGER=swagger_linux_amd64 10 | endif 11 | 12 | clean-tools: 13 | rm -rf .tools 14 | 15 | get-tools: clean-tools 16 | mkdir .tools || true 17 | wget -O ${SWAGGER} https://github.com/go-swagger/go-swagger/releases/download/v0.19.0/${DOWNLOAD_SWAGGER} 18 | chmod u+x .tools/* 19 | 20 | install: 21 | go mod download 22 | 23 | obtain-spec: 24 | mkdir build || true 25 | wget -O ${TEMP_SPEC} https://raw.githubusercontent.com/gotify/server/v${GOTIFY_VERSION}/docs/spec.json 26 | 27 | generate: obtain-spec 28 | ${SWAGGER} generate client -f ${TEMP_SPEC} --additional-initialism=rest --skip-models 29 | 30 | clean: 31 | rm -rf client build 32 | 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Gotify Golang API-Client [![travis-badge]][travis] 2 | 3 | Generated with [swagger-go](https://github.com/go-swagger/go-swagger). 4 | 5 | ## Example 6 | 7 | ```go 8 | package main 9 | 10 | import ( 11 | "log" 12 | "net/http" 13 | "net/url" 14 | 15 | "github.com/gotify/go-api-client/v2/auth" 16 | "github.com/gotify/go-api-client/v2/client/message" 17 | "github.com/gotify/go-api-client/v2/gotify" 18 | "github.com/gotify/go-api-client/v2/models" 19 | ) 20 | 21 | const ( 22 | gotifyURL = "https://push.gotify.url" 23 | applicationToken = "AxNVvRfx9.ZKCTj" 24 | ) 25 | 26 | func main() { 27 | myURL, _ := url.Parse(gotifyURL) 28 | client := gotify.NewClient(myURL, &http.Client{}) 29 | versionResponse, err := client.Version.GetVersion(nil) 30 | 31 | if err != nil { 32 | log.Fatal("Could not request version ", err) 33 | return 34 | } 35 | version := versionResponse.Payload 36 | log.Println("Found version", *version) 37 | 38 | params := message.NewCreateMessageParams() 39 | params.Body = &models.MessageExternal{ 40 | Title: "my title", 41 | Message: "my message", 42 | Priority: 5, 43 | } 44 | _, err = client.Message.CreateMessage(params, auth.TokenAuth(applicationToken)) 45 | 46 | if err != nil { 47 | log.Fatalf("Could not send message %v", err) 48 | return 49 | } 50 | log.Println("Message Sent!") 51 | } 52 | ``` 53 | 54 | ## Update Instructions 55 | 56 | * Change version in [Makefile](Makefile). 57 | * Run `make clean generate` 58 | * Commit changes 59 | 60 | [travis]: https://travis-ci.org/gotify/go-api-client 61 | [travis-badge]: https://travis-ci.org/gotify/go-api-client.svg?branch=master 62 | -------------------------------------------------------------------------------- /auth/auth.go: -------------------------------------------------------------------------------- 1 | package auth 2 | 3 | import ( 4 | httptransport "github.com/go-openapi/runtime/client" 5 | "github.com/go-openapi/runtime" 6 | ) 7 | 8 | func BasicAuth(username, password string) runtime.ClientAuthInfoWriter { 9 | return httptransport.BasicAuth(username, password) 10 | } 11 | 12 | func TokenAuth(token string) runtime.ClientAuthInfoWriter { 13 | return httptransport.APIKeyAuth("X-Gotify-Key", "header", token) 14 | } -------------------------------------------------------------------------------- /client/application/application_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "github.com/go-openapi/runtime" 10 | 11 | strfmt "github.com/go-openapi/strfmt" 12 | ) 13 | 14 | // New creates a new application API client. 15 | func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { 16 | return &Client{transport: transport, formats: formats} 17 | } 18 | 19 | /* 20 | Client for application API 21 | */ 22 | type Client struct { 23 | transport runtime.ClientTransport 24 | formats strfmt.Registry 25 | } 26 | 27 | /* 28 | CreateApp creates an application 29 | */ 30 | func (a *Client) CreateApp(params *CreateAppParams, authInfo runtime.ClientAuthInfoWriter) (*CreateAppOK, error) { 31 | // TODO: Validate the params before sending 32 | if params == nil { 33 | params = NewCreateAppParams() 34 | } 35 | 36 | result, err := a.transport.Submit(&runtime.ClientOperation{ 37 | ID: "createApp", 38 | Method: "POST", 39 | PathPattern: "/application", 40 | ProducesMediaTypes: []string{"application/json"}, 41 | ConsumesMediaTypes: []string{"application/json"}, 42 | Schemes: []string{"http", "https"}, 43 | Params: params, 44 | Reader: &CreateAppReader{formats: a.formats}, 45 | AuthInfo: authInfo, 46 | Context: params.Context, 47 | Client: params.HTTPClient, 48 | }) 49 | if err != nil { 50 | return nil, err 51 | } 52 | return result.(*CreateAppOK), nil 53 | 54 | } 55 | 56 | /* 57 | DeleteApp deletes an application 58 | */ 59 | func (a *Client) DeleteApp(params *DeleteAppParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteAppOK, error) { 60 | // TODO: Validate the params before sending 61 | if params == nil { 62 | params = NewDeleteAppParams() 63 | } 64 | 65 | result, err := a.transport.Submit(&runtime.ClientOperation{ 66 | ID: "deleteApp", 67 | Method: "DELETE", 68 | PathPattern: "/application/{id}", 69 | ProducesMediaTypes: []string{"application/json"}, 70 | ConsumesMediaTypes: []string{"application/json"}, 71 | Schemes: []string{"http", "https"}, 72 | Params: params, 73 | Reader: &DeleteAppReader{formats: a.formats}, 74 | AuthInfo: authInfo, 75 | Context: params.Context, 76 | Client: params.HTTPClient, 77 | }) 78 | if err != nil { 79 | return nil, err 80 | } 81 | return result.(*DeleteAppOK), nil 82 | 83 | } 84 | 85 | /* 86 | GetApps returns all applications 87 | */ 88 | func (a *Client) GetApps(params *GetAppsParams, authInfo runtime.ClientAuthInfoWriter) (*GetAppsOK, error) { 89 | // TODO: Validate the params before sending 90 | if params == nil { 91 | params = NewGetAppsParams() 92 | } 93 | 94 | result, err := a.transport.Submit(&runtime.ClientOperation{ 95 | ID: "getApps", 96 | Method: "GET", 97 | PathPattern: "/application", 98 | ProducesMediaTypes: []string{"application/json"}, 99 | ConsumesMediaTypes: []string{"application/json"}, 100 | Schemes: []string{"http", "https"}, 101 | Params: params, 102 | Reader: &GetAppsReader{formats: a.formats}, 103 | AuthInfo: authInfo, 104 | Context: params.Context, 105 | Client: params.HTTPClient, 106 | }) 107 | if err != nil { 108 | return nil, err 109 | } 110 | return result.(*GetAppsOK), nil 111 | 112 | } 113 | 114 | /* 115 | UpdateApplication updates an application 116 | */ 117 | func (a *Client) UpdateApplication(params *UpdateApplicationParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateApplicationOK, error) { 118 | // TODO: Validate the params before sending 119 | if params == nil { 120 | params = NewUpdateApplicationParams() 121 | } 122 | 123 | result, err := a.transport.Submit(&runtime.ClientOperation{ 124 | ID: "updateApplication", 125 | Method: "PUT", 126 | PathPattern: "/application/{id}", 127 | ProducesMediaTypes: []string{"application/json"}, 128 | ConsumesMediaTypes: []string{"application/json"}, 129 | Schemes: []string{"http", "https"}, 130 | Params: params, 131 | Reader: &UpdateApplicationReader{formats: a.formats}, 132 | AuthInfo: authInfo, 133 | Context: params.Context, 134 | Client: params.HTTPClient, 135 | }) 136 | if err != nil { 137 | return nil, err 138 | } 139 | return result.(*UpdateApplicationOK), nil 140 | 141 | } 142 | 143 | /* 144 | UploadAppImage uploads an image for an application 145 | */ 146 | func (a *Client) UploadAppImage(params *UploadAppImageParams, authInfo runtime.ClientAuthInfoWriter) (*UploadAppImageOK, error) { 147 | // TODO: Validate the params before sending 148 | if params == nil { 149 | params = NewUploadAppImageParams() 150 | } 151 | 152 | result, err := a.transport.Submit(&runtime.ClientOperation{ 153 | ID: "uploadAppImage", 154 | Method: "POST", 155 | PathPattern: "/application/{id}/image", 156 | ProducesMediaTypes: []string{"application/json"}, 157 | ConsumesMediaTypes: []string{"multipart/form-data"}, 158 | Schemes: []string{"http", "https"}, 159 | Params: params, 160 | Reader: &UploadAppImageReader{formats: a.formats}, 161 | AuthInfo: authInfo, 162 | Context: params.Context, 163 | Client: params.HTTPClient, 164 | }) 165 | if err != nil { 166 | return nil, err 167 | } 168 | return result.(*UploadAppImageOK), nil 169 | 170 | } 171 | 172 | // SetTransport changes the transport on the client 173 | func (a *Client) SetTransport(transport runtime.ClientTransport) { 174 | a.transport = transport 175 | } 176 | -------------------------------------------------------------------------------- /client/application/create_app_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | 19 | models "github.com/gotify/go-api-client/v2/models" 20 | ) 21 | 22 | // NewCreateAppParams creates a new CreateAppParams object 23 | // with the default values initialized. 24 | func NewCreateAppParams() *CreateAppParams { 25 | var () 26 | return &CreateAppParams{ 27 | 28 | timeout: cr.DefaultTimeout, 29 | } 30 | } 31 | 32 | // NewCreateAppParamsWithTimeout creates a new CreateAppParams object 33 | // with the default values initialized, and the ability to set a timeout on a request 34 | func NewCreateAppParamsWithTimeout(timeout time.Duration) *CreateAppParams { 35 | var () 36 | return &CreateAppParams{ 37 | 38 | timeout: timeout, 39 | } 40 | } 41 | 42 | // NewCreateAppParamsWithContext creates a new CreateAppParams object 43 | // with the default values initialized, and the ability to set a context for a request 44 | func NewCreateAppParamsWithContext(ctx context.Context) *CreateAppParams { 45 | var () 46 | return &CreateAppParams{ 47 | 48 | Context: ctx, 49 | } 50 | } 51 | 52 | // NewCreateAppParamsWithHTTPClient creates a new CreateAppParams object 53 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 54 | func NewCreateAppParamsWithHTTPClient(client *http.Client) *CreateAppParams { 55 | var () 56 | return &CreateAppParams{ 57 | HTTPClient: client, 58 | } 59 | } 60 | 61 | /*CreateAppParams contains all the parameters to send to the API endpoint 62 | for the create app operation typically these are written to a http.Request 63 | */ 64 | type CreateAppParams struct { 65 | 66 | /*Body 67 | the application to add 68 | 69 | */ 70 | Body *models.Application 71 | 72 | timeout time.Duration 73 | Context context.Context 74 | HTTPClient *http.Client 75 | } 76 | 77 | // WithTimeout adds the timeout to the create app params 78 | func (o *CreateAppParams) WithTimeout(timeout time.Duration) *CreateAppParams { 79 | o.SetTimeout(timeout) 80 | return o 81 | } 82 | 83 | // SetTimeout adds the timeout to the create app params 84 | func (o *CreateAppParams) SetTimeout(timeout time.Duration) { 85 | o.timeout = timeout 86 | } 87 | 88 | // WithContext adds the context to the create app params 89 | func (o *CreateAppParams) WithContext(ctx context.Context) *CreateAppParams { 90 | o.SetContext(ctx) 91 | return o 92 | } 93 | 94 | // SetContext adds the context to the create app params 95 | func (o *CreateAppParams) SetContext(ctx context.Context) { 96 | o.Context = ctx 97 | } 98 | 99 | // WithHTTPClient adds the HTTPClient to the create app params 100 | func (o *CreateAppParams) WithHTTPClient(client *http.Client) *CreateAppParams { 101 | o.SetHTTPClient(client) 102 | return o 103 | } 104 | 105 | // SetHTTPClient adds the HTTPClient to the create app params 106 | func (o *CreateAppParams) SetHTTPClient(client *http.Client) { 107 | o.HTTPClient = client 108 | } 109 | 110 | // WithBody adds the body to the create app params 111 | func (o *CreateAppParams) WithBody(body *models.Application) *CreateAppParams { 112 | o.SetBody(body) 113 | return o 114 | } 115 | 116 | // SetBody adds the body to the create app params 117 | func (o *CreateAppParams) SetBody(body *models.Application) { 118 | o.Body = body 119 | } 120 | 121 | // WriteToRequest writes these params to a swagger request 122 | func (o *CreateAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 123 | 124 | if err := r.SetTimeout(o.timeout); err != nil { 125 | return err 126 | } 127 | var res []error 128 | 129 | if o.Body != nil { 130 | if err := r.SetBodyParam(o.Body); err != nil { 131 | return err 132 | } 133 | } 134 | 135 | if len(res) > 0 { 136 | return errors.CompositeValidationError(res...) 137 | } 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /client/application/create_app_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // CreateAppReader is a Reader for the CreateApp structure. 20 | type CreateAppReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *CreateAppReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewCreateAppOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewCreateAppBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewCreateAppUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewCreateAppForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | default: 57 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 | } 59 | } 60 | 61 | // NewCreateAppOK creates a CreateAppOK with default headers values 62 | func NewCreateAppOK() *CreateAppOK { 63 | return &CreateAppOK{} 64 | } 65 | 66 | /*CreateAppOK handles this case with default header values. 67 | 68 | Ok 69 | */ 70 | type CreateAppOK struct { 71 | Payload *models.Application 72 | } 73 | 74 | func (o *CreateAppOK) Error() string { 75 | return fmt.Sprintf("[POST /application][%d] createAppOK %+v", 200, o.Payload) 76 | } 77 | 78 | func (o *CreateAppOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 | 80 | o.Payload = new(models.Application) 81 | 82 | // response payload 83 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 | return err 85 | } 86 | 87 | return nil 88 | } 89 | 90 | // NewCreateAppBadRequest creates a CreateAppBadRequest with default headers values 91 | func NewCreateAppBadRequest() *CreateAppBadRequest { 92 | return &CreateAppBadRequest{} 93 | } 94 | 95 | /*CreateAppBadRequest handles this case with default header values. 96 | 97 | Bad Request 98 | */ 99 | type CreateAppBadRequest struct { 100 | Payload *models.Error 101 | } 102 | 103 | func (o *CreateAppBadRequest) Error() string { 104 | return fmt.Sprintf("[POST /application][%d] createAppBadRequest %+v", 400, o.Payload) 105 | } 106 | 107 | func (o *CreateAppBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 | 109 | o.Payload = new(models.Error) 110 | 111 | // response payload 112 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 113 | return err 114 | } 115 | 116 | return nil 117 | } 118 | 119 | // NewCreateAppUnauthorized creates a CreateAppUnauthorized with default headers values 120 | func NewCreateAppUnauthorized() *CreateAppUnauthorized { 121 | return &CreateAppUnauthorized{} 122 | } 123 | 124 | /*CreateAppUnauthorized handles this case with default header values. 125 | 126 | Unauthorized 127 | */ 128 | type CreateAppUnauthorized struct { 129 | Payload *models.Error 130 | } 131 | 132 | func (o *CreateAppUnauthorized) Error() string { 133 | return fmt.Sprintf("[POST /application][%d] createAppUnauthorized %+v", 401, o.Payload) 134 | } 135 | 136 | func (o *CreateAppUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 137 | 138 | o.Payload = new(models.Error) 139 | 140 | // response payload 141 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 142 | return err 143 | } 144 | 145 | return nil 146 | } 147 | 148 | // NewCreateAppForbidden creates a CreateAppForbidden with default headers values 149 | func NewCreateAppForbidden() *CreateAppForbidden { 150 | return &CreateAppForbidden{} 151 | } 152 | 153 | /*CreateAppForbidden handles this case with default header values. 154 | 155 | Forbidden 156 | */ 157 | type CreateAppForbidden struct { 158 | Payload *models.Error 159 | } 160 | 161 | func (o *CreateAppForbidden) Error() string { 162 | return fmt.Sprintf("[POST /application][%d] createAppForbidden %+v", 403, o.Payload) 163 | } 164 | 165 | func (o *CreateAppForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 166 | 167 | o.Payload = new(models.Error) 168 | 169 | // response payload 170 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 171 | return err 172 | } 173 | 174 | return nil 175 | } 176 | -------------------------------------------------------------------------------- /client/application/delete_app_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewDeleteAppParams creates a new DeleteAppParams object 22 | // with the default values initialized. 23 | func NewDeleteAppParams() *DeleteAppParams { 24 | var () 25 | return &DeleteAppParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewDeleteAppParamsWithTimeout creates a new DeleteAppParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewDeleteAppParamsWithTimeout(timeout time.Duration) *DeleteAppParams { 34 | var () 35 | return &DeleteAppParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewDeleteAppParamsWithContext creates a new DeleteAppParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewDeleteAppParamsWithContext(ctx context.Context) *DeleteAppParams { 44 | var () 45 | return &DeleteAppParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewDeleteAppParamsWithHTTPClient creates a new DeleteAppParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewDeleteAppParamsWithHTTPClient(client *http.Client) *DeleteAppParams { 54 | var () 55 | return &DeleteAppParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*DeleteAppParams contains all the parameters to send to the API endpoint 61 | for the delete app operation typically these are written to a http.Request 62 | */ 63 | type DeleteAppParams struct { 64 | 65 | /*ID 66 | the application id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the delete app params 77 | func (o *DeleteAppParams) WithTimeout(timeout time.Duration) *DeleteAppParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the delete app params 83 | func (o *DeleteAppParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the delete app params 88 | func (o *DeleteAppParams) WithContext(ctx context.Context) *DeleteAppParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the delete app params 94 | func (o *DeleteAppParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the delete app params 99 | func (o *DeleteAppParams) WithHTTPClient(client *http.Client) *DeleteAppParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the delete app params 105 | func (o *DeleteAppParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the delete app params 110 | func (o *DeleteAppParams) WithID(id int64) *DeleteAppParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the delete app params 116 | func (o *DeleteAppParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *DeleteAppParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/application/delete_app_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // DeleteAppReader is a Reader for the DeleteApp structure. 20 | type DeleteAppReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *DeleteAppReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewDeleteAppOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewDeleteAppBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewDeleteAppUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewDeleteAppForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | case 404: 57 | result := NewDeleteAppNotFound() 58 | if err := result.readResponse(response, consumer, o.formats); err != nil { 59 | return nil, err 60 | } 61 | return nil, result 62 | 63 | default: 64 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 65 | } 66 | } 67 | 68 | // NewDeleteAppOK creates a DeleteAppOK with default headers values 69 | func NewDeleteAppOK() *DeleteAppOK { 70 | return &DeleteAppOK{} 71 | } 72 | 73 | /*DeleteAppOK handles this case with default header values. 74 | 75 | Ok 76 | */ 77 | type DeleteAppOK struct { 78 | } 79 | 80 | func (o *DeleteAppOK) Error() string { 81 | return fmt.Sprintf("[DELETE /application/{id}][%d] deleteAppOK ", 200) 82 | } 83 | 84 | func (o *DeleteAppOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 85 | 86 | return nil 87 | } 88 | 89 | // NewDeleteAppBadRequest creates a DeleteAppBadRequest with default headers values 90 | func NewDeleteAppBadRequest() *DeleteAppBadRequest { 91 | return &DeleteAppBadRequest{} 92 | } 93 | 94 | /*DeleteAppBadRequest handles this case with default header values. 95 | 96 | Bad Request 97 | */ 98 | type DeleteAppBadRequest struct { 99 | Payload *models.Error 100 | } 101 | 102 | func (o *DeleteAppBadRequest) Error() string { 103 | return fmt.Sprintf("[DELETE /application/{id}][%d] deleteAppBadRequest %+v", 400, o.Payload) 104 | } 105 | 106 | func (o *DeleteAppBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 107 | 108 | o.Payload = new(models.Error) 109 | 110 | // response payload 111 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 112 | return err 113 | } 114 | 115 | return nil 116 | } 117 | 118 | // NewDeleteAppUnauthorized creates a DeleteAppUnauthorized with default headers values 119 | func NewDeleteAppUnauthorized() *DeleteAppUnauthorized { 120 | return &DeleteAppUnauthorized{} 121 | } 122 | 123 | /*DeleteAppUnauthorized handles this case with default header values. 124 | 125 | Unauthorized 126 | */ 127 | type DeleteAppUnauthorized struct { 128 | Payload *models.Error 129 | } 130 | 131 | func (o *DeleteAppUnauthorized) Error() string { 132 | return fmt.Sprintf("[DELETE /application/{id}][%d] deleteAppUnauthorized %+v", 401, o.Payload) 133 | } 134 | 135 | func (o *DeleteAppUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 136 | 137 | o.Payload = new(models.Error) 138 | 139 | // response payload 140 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 141 | return err 142 | } 143 | 144 | return nil 145 | } 146 | 147 | // NewDeleteAppForbidden creates a DeleteAppForbidden with default headers values 148 | func NewDeleteAppForbidden() *DeleteAppForbidden { 149 | return &DeleteAppForbidden{} 150 | } 151 | 152 | /*DeleteAppForbidden handles this case with default header values. 153 | 154 | Forbidden 155 | */ 156 | type DeleteAppForbidden struct { 157 | Payload *models.Error 158 | } 159 | 160 | func (o *DeleteAppForbidden) Error() string { 161 | return fmt.Sprintf("[DELETE /application/{id}][%d] deleteAppForbidden %+v", 403, o.Payload) 162 | } 163 | 164 | func (o *DeleteAppForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 165 | 166 | o.Payload = new(models.Error) 167 | 168 | // response payload 169 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 170 | return err 171 | } 172 | 173 | return nil 174 | } 175 | 176 | // NewDeleteAppNotFound creates a DeleteAppNotFound with default headers values 177 | func NewDeleteAppNotFound() *DeleteAppNotFound { 178 | return &DeleteAppNotFound{} 179 | } 180 | 181 | /*DeleteAppNotFound handles this case with default header values. 182 | 183 | Not Found 184 | */ 185 | type DeleteAppNotFound struct { 186 | Payload *models.Error 187 | } 188 | 189 | func (o *DeleteAppNotFound) Error() string { 190 | return fmt.Sprintf("[DELETE /application/{id}][%d] deleteAppNotFound %+v", 404, o.Payload) 191 | } 192 | 193 | func (o *DeleteAppNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 194 | 195 | o.Payload = new(models.Error) 196 | 197 | // response payload 198 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 199 | return err 200 | } 201 | 202 | return nil 203 | } 204 | -------------------------------------------------------------------------------- /client/application/get_apps_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewGetAppsParams creates a new GetAppsParams object 21 | // with the default values initialized. 22 | func NewGetAppsParams() *GetAppsParams { 23 | 24 | return &GetAppsParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewGetAppsParamsWithTimeout creates a new GetAppsParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewGetAppsParamsWithTimeout(timeout time.Duration) *GetAppsParams { 33 | 34 | return &GetAppsParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewGetAppsParamsWithContext creates a new GetAppsParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewGetAppsParamsWithContext(ctx context.Context) *GetAppsParams { 43 | 44 | return &GetAppsParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewGetAppsParamsWithHTTPClient creates a new GetAppsParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewGetAppsParamsWithHTTPClient(client *http.Client) *GetAppsParams { 53 | 54 | return &GetAppsParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*GetAppsParams contains all the parameters to send to the API endpoint 60 | for the get apps operation typically these are written to a http.Request 61 | */ 62 | type GetAppsParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the get apps params 69 | func (o *GetAppsParams) WithTimeout(timeout time.Duration) *GetAppsParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the get apps params 75 | func (o *GetAppsParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the get apps params 80 | func (o *GetAppsParams) WithContext(ctx context.Context) *GetAppsParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the get apps params 86 | func (o *GetAppsParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the get apps params 91 | func (o *GetAppsParams) WithHTTPClient(client *http.Client) *GetAppsParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the get apps params 97 | func (o *GetAppsParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *GetAppsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/application/get_apps_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // GetAppsReader is a Reader for the GetApps structure. 20 | type GetAppsReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *GetAppsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewGetAppsOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 401: 36 | result := NewGetAppsUnauthorized() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 403: 43 | result := NewGetAppsForbidden() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | default: 50 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 51 | } 52 | } 53 | 54 | // NewGetAppsOK creates a GetAppsOK with default headers values 55 | func NewGetAppsOK() *GetAppsOK { 56 | return &GetAppsOK{} 57 | } 58 | 59 | /*GetAppsOK handles this case with default header values. 60 | 61 | Ok 62 | */ 63 | type GetAppsOK struct { 64 | Payload []*models.Application 65 | } 66 | 67 | func (o *GetAppsOK) Error() string { 68 | return fmt.Sprintf("[GET /application][%d] getAppsOK %+v", 200, o.Payload) 69 | } 70 | 71 | func (o *GetAppsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 72 | 73 | // response payload 74 | if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 75 | return err 76 | } 77 | 78 | return nil 79 | } 80 | 81 | // NewGetAppsUnauthorized creates a GetAppsUnauthorized with default headers values 82 | func NewGetAppsUnauthorized() *GetAppsUnauthorized { 83 | return &GetAppsUnauthorized{} 84 | } 85 | 86 | /*GetAppsUnauthorized handles this case with default header values. 87 | 88 | Unauthorized 89 | */ 90 | type GetAppsUnauthorized struct { 91 | Payload *models.Error 92 | } 93 | 94 | func (o *GetAppsUnauthorized) Error() string { 95 | return fmt.Sprintf("[GET /application][%d] getAppsUnauthorized %+v", 401, o.Payload) 96 | } 97 | 98 | func (o *GetAppsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 99 | 100 | o.Payload = new(models.Error) 101 | 102 | // response payload 103 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 104 | return err 105 | } 106 | 107 | return nil 108 | } 109 | 110 | // NewGetAppsForbidden creates a GetAppsForbidden with default headers values 111 | func NewGetAppsForbidden() *GetAppsForbidden { 112 | return &GetAppsForbidden{} 113 | } 114 | 115 | /*GetAppsForbidden handles this case with default header values. 116 | 117 | Forbidden 118 | */ 119 | type GetAppsForbidden struct { 120 | Payload *models.Error 121 | } 122 | 123 | func (o *GetAppsForbidden) Error() string { 124 | return fmt.Sprintf("[GET /application][%d] getAppsForbidden %+v", 403, o.Payload) 125 | } 126 | 127 | func (o *GetAppsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 128 | 129 | o.Payload = new(models.Error) 130 | 131 | // response payload 132 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 133 | return err 134 | } 135 | 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/application/update_application_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | 20 | models "github.com/gotify/go-api-client/v2/models" 21 | ) 22 | 23 | // NewUpdateApplicationParams creates a new UpdateApplicationParams object 24 | // with the default values initialized. 25 | func NewUpdateApplicationParams() *UpdateApplicationParams { 26 | var () 27 | return &UpdateApplicationParams{ 28 | 29 | timeout: cr.DefaultTimeout, 30 | } 31 | } 32 | 33 | // NewUpdateApplicationParamsWithTimeout creates a new UpdateApplicationParams object 34 | // with the default values initialized, and the ability to set a timeout on a request 35 | func NewUpdateApplicationParamsWithTimeout(timeout time.Duration) *UpdateApplicationParams { 36 | var () 37 | return &UpdateApplicationParams{ 38 | 39 | timeout: timeout, 40 | } 41 | } 42 | 43 | // NewUpdateApplicationParamsWithContext creates a new UpdateApplicationParams object 44 | // with the default values initialized, and the ability to set a context for a request 45 | func NewUpdateApplicationParamsWithContext(ctx context.Context) *UpdateApplicationParams { 46 | var () 47 | return &UpdateApplicationParams{ 48 | 49 | Context: ctx, 50 | } 51 | } 52 | 53 | // NewUpdateApplicationParamsWithHTTPClient creates a new UpdateApplicationParams object 54 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 55 | func NewUpdateApplicationParamsWithHTTPClient(client *http.Client) *UpdateApplicationParams { 56 | var () 57 | return &UpdateApplicationParams{ 58 | HTTPClient: client, 59 | } 60 | } 61 | 62 | /*UpdateApplicationParams contains all the parameters to send to the API endpoint 63 | for the update application operation typically these are written to a http.Request 64 | */ 65 | type UpdateApplicationParams struct { 66 | 67 | /*Body 68 | the application to update 69 | 70 | */ 71 | Body *models.Application 72 | /*ID 73 | the application id 74 | 75 | */ 76 | ID int64 77 | 78 | timeout time.Duration 79 | Context context.Context 80 | HTTPClient *http.Client 81 | } 82 | 83 | // WithTimeout adds the timeout to the update application params 84 | func (o *UpdateApplicationParams) WithTimeout(timeout time.Duration) *UpdateApplicationParams { 85 | o.SetTimeout(timeout) 86 | return o 87 | } 88 | 89 | // SetTimeout adds the timeout to the update application params 90 | func (o *UpdateApplicationParams) SetTimeout(timeout time.Duration) { 91 | o.timeout = timeout 92 | } 93 | 94 | // WithContext adds the context to the update application params 95 | func (o *UpdateApplicationParams) WithContext(ctx context.Context) *UpdateApplicationParams { 96 | o.SetContext(ctx) 97 | return o 98 | } 99 | 100 | // SetContext adds the context to the update application params 101 | func (o *UpdateApplicationParams) SetContext(ctx context.Context) { 102 | o.Context = ctx 103 | } 104 | 105 | // WithHTTPClient adds the HTTPClient to the update application params 106 | func (o *UpdateApplicationParams) WithHTTPClient(client *http.Client) *UpdateApplicationParams { 107 | o.SetHTTPClient(client) 108 | return o 109 | } 110 | 111 | // SetHTTPClient adds the HTTPClient to the update application params 112 | func (o *UpdateApplicationParams) SetHTTPClient(client *http.Client) { 113 | o.HTTPClient = client 114 | } 115 | 116 | // WithBody adds the body to the update application params 117 | func (o *UpdateApplicationParams) WithBody(body *models.Application) *UpdateApplicationParams { 118 | o.SetBody(body) 119 | return o 120 | } 121 | 122 | // SetBody adds the body to the update application params 123 | func (o *UpdateApplicationParams) SetBody(body *models.Application) { 124 | o.Body = body 125 | } 126 | 127 | // WithID adds the id to the update application params 128 | func (o *UpdateApplicationParams) WithID(id int64) *UpdateApplicationParams { 129 | o.SetID(id) 130 | return o 131 | } 132 | 133 | // SetID adds the id to the update application params 134 | func (o *UpdateApplicationParams) SetID(id int64) { 135 | o.ID = id 136 | } 137 | 138 | // WriteToRequest writes these params to a swagger request 139 | func (o *UpdateApplicationParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 140 | 141 | if err := r.SetTimeout(o.timeout); err != nil { 142 | return err 143 | } 144 | var res []error 145 | 146 | if o.Body != nil { 147 | if err := r.SetBodyParam(o.Body); err != nil { 148 | return err 149 | } 150 | } 151 | 152 | // path param id 153 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 154 | return err 155 | } 156 | 157 | if len(res) > 0 { 158 | return errors.CompositeValidationError(res...) 159 | } 160 | return nil 161 | } 162 | -------------------------------------------------------------------------------- /client/application/upload_app_image_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package application 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewUploadAppImageParams creates a new UploadAppImageParams object 22 | // with the default values initialized. 23 | func NewUploadAppImageParams() *UploadAppImageParams { 24 | var () 25 | return &UploadAppImageParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewUploadAppImageParamsWithTimeout creates a new UploadAppImageParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewUploadAppImageParamsWithTimeout(timeout time.Duration) *UploadAppImageParams { 34 | var () 35 | return &UploadAppImageParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewUploadAppImageParamsWithContext creates a new UploadAppImageParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewUploadAppImageParamsWithContext(ctx context.Context) *UploadAppImageParams { 44 | var () 45 | return &UploadAppImageParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewUploadAppImageParamsWithHTTPClient creates a new UploadAppImageParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewUploadAppImageParamsWithHTTPClient(client *http.Client) *UploadAppImageParams { 54 | var () 55 | return &UploadAppImageParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*UploadAppImageParams contains all the parameters to send to the API endpoint 61 | for the upload app image operation typically these are written to a http.Request 62 | */ 63 | type UploadAppImageParams struct { 64 | 65 | /*File 66 | the application image 67 | 68 | */ 69 | File runtime.NamedReadCloser 70 | /*ID 71 | the application id 72 | 73 | */ 74 | ID int64 75 | 76 | timeout time.Duration 77 | Context context.Context 78 | HTTPClient *http.Client 79 | } 80 | 81 | // WithTimeout adds the timeout to the upload app image params 82 | func (o *UploadAppImageParams) WithTimeout(timeout time.Duration) *UploadAppImageParams { 83 | o.SetTimeout(timeout) 84 | return o 85 | } 86 | 87 | // SetTimeout adds the timeout to the upload app image params 88 | func (o *UploadAppImageParams) SetTimeout(timeout time.Duration) { 89 | o.timeout = timeout 90 | } 91 | 92 | // WithContext adds the context to the upload app image params 93 | func (o *UploadAppImageParams) WithContext(ctx context.Context) *UploadAppImageParams { 94 | o.SetContext(ctx) 95 | return o 96 | } 97 | 98 | // SetContext adds the context to the upload app image params 99 | func (o *UploadAppImageParams) SetContext(ctx context.Context) { 100 | o.Context = ctx 101 | } 102 | 103 | // WithHTTPClient adds the HTTPClient to the upload app image params 104 | func (o *UploadAppImageParams) WithHTTPClient(client *http.Client) *UploadAppImageParams { 105 | o.SetHTTPClient(client) 106 | return o 107 | } 108 | 109 | // SetHTTPClient adds the HTTPClient to the upload app image params 110 | func (o *UploadAppImageParams) SetHTTPClient(client *http.Client) { 111 | o.HTTPClient = client 112 | } 113 | 114 | // WithFile adds the file to the upload app image params 115 | func (o *UploadAppImageParams) WithFile(file runtime.NamedReadCloser) *UploadAppImageParams { 116 | o.SetFile(file) 117 | return o 118 | } 119 | 120 | // SetFile adds the file to the upload app image params 121 | func (o *UploadAppImageParams) SetFile(file runtime.NamedReadCloser) { 122 | o.File = file 123 | } 124 | 125 | // WithID adds the id to the upload app image params 126 | func (o *UploadAppImageParams) WithID(id int64) *UploadAppImageParams { 127 | o.SetID(id) 128 | return o 129 | } 130 | 131 | // SetID adds the id to the upload app image params 132 | func (o *UploadAppImageParams) SetID(id int64) { 133 | o.ID = id 134 | } 135 | 136 | // WriteToRequest writes these params to a swagger request 137 | func (o *UploadAppImageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 138 | 139 | if err := r.SetTimeout(o.timeout); err != nil { 140 | return err 141 | } 142 | var res []error 143 | 144 | // form file param file 145 | if err := r.SetFileParam("file", o.File); err != nil { 146 | return err 147 | } 148 | 149 | // path param id 150 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 151 | return err 152 | } 153 | 154 | if len(res) > 0 { 155 | return errors.CompositeValidationError(res...) 156 | } 157 | return nil 158 | } 159 | -------------------------------------------------------------------------------- /client/client/client_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "github.com/go-openapi/runtime" 10 | 11 | strfmt "github.com/go-openapi/strfmt" 12 | ) 13 | 14 | // New creates a new client API client. 15 | func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { 16 | return &Client{transport: transport, formats: formats} 17 | } 18 | 19 | /* 20 | Client for client API 21 | */ 22 | type Client struct { 23 | transport runtime.ClientTransport 24 | formats strfmt.Registry 25 | } 26 | 27 | /* 28 | CreateClient creates a client 29 | */ 30 | func (a *Client) CreateClient(params *CreateClientParams, authInfo runtime.ClientAuthInfoWriter) (*CreateClientOK, error) { 31 | // TODO: Validate the params before sending 32 | if params == nil { 33 | params = NewCreateClientParams() 34 | } 35 | 36 | result, err := a.transport.Submit(&runtime.ClientOperation{ 37 | ID: "createClient", 38 | Method: "POST", 39 | PathPattern: "/client", 40 | ProducesMediaTypes: []string{"application/json"}, 41 | ConsumesMediaTypes: []string{"application/json"}, 42 | Schemes: []string{"http", "https"}, 43 | Params: params, 44 | Reader: &CreateClientReader{formats: a.formats}, 45 | AuthInfo: authInfo, 46 | Context: params.Context, 47 | Client: params.HTTPClient, 48 | }) 49 | if err != nil { 50 | return nil, err 51 | } 52 | return result.(*CreateClientOK), nil 53 | 54 | } 55 | 56 | /* 57 | DeleteClient deletes a client 58 | */ 59 | func (a *Client) DeleteClient(params *DeleteClientParams, authInfo runtime.ClientAuthInfoWriter) (*DeleteClientOK, error) { 60 | // TODO: Validate the params before sending 61 | if params == nil { 62 | params = NewDeleteClientParams() 63 | } 64 | 65 | result, err := a.transport.Submit(&runtime.ClientOperation{ 66 | ID: "deleteClient", 67 | Method: "DELETE", 68 | PathPattern: "/client/{id}", 69 | ProducesMediaTypes: []string{"application/json"}, 70 | ConsumesMediaTypes: []string{"application/json"}, 71 | Schemes: []string{"http", "https"}, 72 | Params: params, 73 | Reader: &DeleteClientReader{formats: a.formats}, 74 | AuthInfo: authInfo, 75 | Context: params.Context, 76 | Client: params.HTTPClient, 77 | }) 78 | if err != nil { 79 | return nil, err 80 | } 81 | return result.(*DeleteClientOK), nil 82 | 83 | } 84 | 85 | /* 86 | GetClients returns all clients 87 | */ 88 | func (a *Client) GetClients(params *GetClientsParams, authInfo runtime.ClientAuthInfoWriter) (*GetClientsOK, error) { 89 | // TODO: Validate the params before sending 90 | if params == nil { 91 | params = NewGetClientsParams() 92 | } 93 | 94 | result, err := a.transport.Submit(&runtime.ClientOperation{ 95 | ID: "getClients", 96 | Method: "GET", 97 | PathPattern: "/client", 98 | ProducesMediaTypes: []string{"application/json"}, 99 | ConsumesMediaTypes: []string{"application/json"}, 100 | Schemes: []string{"http", "https"}, 101 | Params: params, 102 | Reader: &GetClientsReader{formats: a.formats}, 103 | AuthInfo: authInfo, 104 | Context: params.Context, 105 | Client: params.HTTPClient, 106 | }) 107 | if err != nil { 108 | return nil, err 109 | } 110 | return result.(*GetClientsOK), nil 111 | 112 | } 113 | 114 | /* 115 | UpdateClient updates a client 116 | */ 117 | func (a *Client) UpdateClient(params *UpdateClientParams, authInfo runtime.ClientAuthInfoWriter) (*UpdateClientOK, error) { 118 | // TODO: Validate the params before sending 119 | if params == nil { 120 | params = NewUpdateClientParams() 121 | } 122 | 123 | result, err := a.transport.Submit(&runtime.ClientOperation{ 124 | ID: "updateClient", 125 | Method: "PUT", 126 | PathPattern: "/client/{id}", 127 | ProducesMediaTypes: []string{"application/json"}, 128 | ConsumesMediaTypes: []string{"application/json"}, 129 | Schemes: []string{"http", "https"}, 130 | Params: params, 131 | Reader: &UpdateClientReader{formats: a.formats}, 132 | AuthInfo: authInfo, 133 | Context: params.Context, 134 | Client: params.HTTPClient, 135 | }) 136 | if err != nil { 137 | return nil, err 138 | } 139 | return result.(*UpdateClientOK), nil 140 | 141 | } 142 | 143 | // SetTransport changes the transport on the client 144 | func (a *Client) SetTransport(transport runtime.ClientTransport) { 145 | a.transport = transport 146 | } 147 | -------------------------------------------------------------------------------- /client/client/create_client_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | 19 | models "github.com/gotify/go-api-client/v2/models" 20 | ) 21 | 22 | // NewCreateClientParams creates a new CreateClientParams object 23 | // with the default values initialized. 24 | func NewCreateClientParams() *CreateClientParams { 25 | var () 26 | return &CreateClientParams{ 27 | 28 | timeout: cr.DefaultTimeout, 29 | } 30 | } 31 | 32 | // NewCreateClientParamsWithTimeout creates a new CreateClientParams object 33 | // with the default values initialized, and the ability to set a timeout on a request 34 | func NewCreateClientParamsWithTimeout(timeout time.Duration) *CreateClientParams { 35 | var () 36 | return &CreateClientParams{ 37 | 38 | timeout: timeout, 39 | } 40 | } 41 | 42 | // NewCreateClientParamsWithContext creates a new CreateClientParams object 43 | // with the default values initialized, and the ability to set a context for a request 44 | func NewCreateClientParamsWithContext(ctx context.Context) *CreateClientParams { 45 | var () 46 | return &CreateClientParams{ 47 | 48 | Context: ctx, 49 | } 50 | } 51 | 52 | // NewCreateClientParamsWithHTTPClient creates a new CreateClientParams object 53 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 54 | func NewCreateClientParamsWithHTTPClient(client *http.Client) *CreateClientParams { 55 | var () 56 | return &CreateClientParams{ 57 | HTTPClient: client, 58 | } 59 | } 60 | 61 | /*CreateClientParams contains all the parameters to send to the API endpoint 62 | for the create client operation typically these are written to a http.Request 63 | */ 64 | type CreateClientParams struct { 65 | 66 | /*Body 67 | the client to add 68 | 69 | */ 70 | Body *models.Client 71 | 72 | timeout time.Duration 73 | Context context.Context 74 | HTTPClient *http.Client 75 | } 76 | 77 | // WithTimeout adds the timeout to the create client params 78 | func (o *CreateClientParams) WithTimeout(timeout time.Duration) *CreateClientParams { 79 | o.SetTimeout(timeout) 80 | return o 81 | } 82 | 83 | // SetTimeout adds the timeout to the create client params 84 | func (o *CreateClientParams) SetTimeout(timeout time.Duration) { 85 | o.timeout = timeout 86 | } 87 | 88 | // WithContext adds the context to the create client params 89 | func (o *CreateClientParams) WithContext(ctx context.Context) *CreateClientParams { 90 | o.SetContext(ctx) 91 | return o 92 | } 93 | 94 | // SetContext adds the context to the create client params 95 | func (o *CreateClientParams) SetContext(ctx context.Context) { 96 | o.Context = ctx 97 | } 98 | 99 | // WithHTTPClient adds the HTTPClient to the create client params 100 | func (o *CreateClientParams) WithHTTPClient(client *http.Client) *CreateClientParams { 101 | o.SetHTTPClient(client) 102 | return o 103 | } 104 | 105 | // SetHTTPClient adds the HTTPClient to the create client params 106 | func (o *CreateClientParams) SetHTTPClient(client *http.Client) { 107 | o.HTTPClient = client 108 | } 109 | 110 | // WithBody adds the body to the create client params 111 | func (o *CreateClientParams) WithBody(body *models.Client) *CreateClientParams { 112 | o.SetBody(body) 113 | return o 114 | } 115 | 116 | // SetBody adds the body to the create client params 117 | func (o *CreateClientParams) SetBody(body *models.Client) { 118 | o.Body = body 119 | } 120 | 121 | // WriteToRequest writes these params to a swagger request 122 | func (o *CreateClientParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 123 | 124 | if err := r.SetTimeout(o.timeout); err != nil { 125 | return err 126 | } 127 | var res []error 128 | 129 | if o.Body != nil { 130 | if err := r.SetBodyParam(o.Body); err != nil { 131 | return err 132 | } 133 | } 134 | 135 | if len(res) > 0 { 136 | return errors.CompositeValidationError(res...) 137 | } 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /client/client/create_client_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // CreateClientReader is a Reader for the CreateClient structure. 20 | type CreateClientReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *CreateClientReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewCreateClientOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewCreateClientBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewCreateClientUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewCreateClientForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | default: 57 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 | } 59 | } 60 | 61 | // NewCreateClientOK creates a CreateClientOK with default headers values 62 | func NewCreateClientOK() *CreateClientOK { 63 | return &CreateClientOK{} 64 | } 65 | 66 | /*CreateClientOK handles this case with default header values. 67 | 68 | Ok 69 | */ 70 | type CreateClientOK struct { 71 | Payload *models.Client 72 | } 73 | 74 | func (o *CreateClientOK) Error() string { 75 | return fmt.Sprintf("[POST /client][%d] createClientOK %+v", 200, o.Payload) 76 | } 77 | 78 | func (o *CreateClientOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 | 80 | o.Payload = new(models.Client) 81 | 82 | // response payload 83 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 | return err 85 | } 86 | 87 | return nil 88 | } 89 | 90 | // NewCreateClientBadRequest creates a CreateClientBadRequest with default headers values 91 | func NewCreateClientBadRequest() *CreateClientBadRequest { 92 | return &CreateClientBadRequest{} 93 | } 94 | 95 | /*CreateClientBadRequest handles this case with default header values. 96 | 97 | Bad Request 98 | */ 99 | type CreateClientBadRequest struct { 100 | Payload *models.Error 101 | } 102 | 103 | func (o *CreateClientBadRequest) Error() string { 104 | return fmt.Sprintf("[POST /client][%d] createClientBadRequest %+v", 400, o.Payload) 105 | } 106 | 107 | func (o *CreateClientBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 | 109 | o.Payload = new(models.Error) 110 | 111 | // response payload 112 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 113 | return err 114 | } 115 | 116 | return nil 117 | } 118 | 119 | // NewCreateClientUnauthorized creates a CreateClientUnauthorized with default headers values 120 | func NewCreateClientUnauthorized() *CreateClientUnauthorized { 121 | return &CreateClientUnauthorized{} 122 | } 123 | 124 | /*CreateClientUnauthorized handles this case with default header values. 125 | 126 | Unauthorized 127 | */ 128 | type CreateClientUnauthorized struct { 129 | Payload *models.Error 130 | } 131 | 132 | func (o *CreateClientUnauthorized) Error() string { 133 | return fmt.Sprintf("[POST /client][%d] createClientUnauthorized %+v", 401, o.Payload) 134 | } 135 | 136 | func (o *CreateClientUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 137 | 138 | o.Payload = new(models.Error) 139 | 140 | // response payload 141 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 142 | return err 143 | } 144 | 145 | return nil 146 | } 147 | 148 | // NewCreateClientForbidden creates a CreateClientForbidden with default headers values 149 | func NewCreateClientForbidden() *CreateClientForbidden { 150 | return &CreateClientForbidden{} 151 | } 152 | 153 | /*CreateClientForbidden handles this case with default header values. 154 | 155 | Forbidden 156 | */ 157 | type CreateClientForbidden struct { 158 | Payload *models.Error 159 | } 160 | 161 | func (o *CreateClientForbidden) Error() string { 162 | return fmt.Sprintf("[POST /client][%d] createClientForbidden %+v", 403, o.Payload) 163 | } 164 | 165 | func (o *CreateClientForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 166 | 167 | o.Payload = new(models.Error) 168 | 169 | // response payload 170 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 171 | return err 172 | } 173 | 174 | return nil 175 | } 176 | -------------------------------------------------------------------------------- /client/client/delete_client_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewDeleteClientParams creates a new DeleteClientParams object 22 | // with the default values initialized. 23 | func NewDeleteClientParams() *DeleteClientParams { 24 | var () 25 | return &DeleteClientParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewDeleteClientParamsWithTimeout creates a new DeleteClientParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewDeleteClientParamsWithTimeout(timeout time.Duration) *DeleteClientParams { 34 | var () 35 | return &DeleteClientParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewDeleteClientParamsWithContext creates a new DeleteClientParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewDeleteClientParamsWithContext(ctx context.Context) *DeleteClientParams { 44 | var () 45 | return &DeleteClientParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewDeleteClientParamsWithHTTPClient creates a new DeleteClientParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewDeleteClientParamsWithHTTPClient(client *http.Client) *DeleteClientParams { 54 | var () 55 | return &DeleteClientParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*DeleteClientParams contains all the parameters to send to the API endpoint 61 | for the delete client operation typically these are written to a http.Request 62 | */ 63 | type DeleteClientParams struct { 64 | 65 | /*ID 66 | the client id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the delete client params 77 | func (o *DeleteClientParams) WithTimeout(timeout time.Duration) *DeleteClientParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the delete client params 83 | func (o *DeleteClientParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the delete client params 88 | func (o *DeleteClientParams) WithContext(ctx context.Context) *DeleteClientParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the delete client params 94 | func (o *DeleteClientParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the delete client params 99 | func (o *DeleteClientParams) WithHTTPClient(client *http.Client) *DeleteClientParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the delete client params 105 | func (o *DeleteClientParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the delete client params 110 | func (o *DeleteClientParams) WithID(id int64) *DeleteClientParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the delete client params 116 | func (o *DeleteClientParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *DeleteClientParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/client/get_clients_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewGetClientsParams creates a new GetClientsParams object 21 | // with the default values initialized. 22 | func NewGetClientsParams() *GetClientsParams { 23 | 24 | return &GetClientsParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewGetClientsParamsWithTimeout creates a new GetClientsParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewGetClientsParamsWithTimeout(timeout time.Duration) *GetClientsParams { 33 | 34 | return &GetClientsParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewGetClientsParamsWithContext creates a new GetClientsParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewGetClientsParamsWithContext(ctx context.Context) *GetClientsParams { 43 | 44 | return &GetClientsParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewGetClientsParamsWithHTTPClient creates a new GetClientsParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewGetClientsParamsWithHTTPClient(client *http.Client) *GetClientsParams { 53 | 54 | return &GetClientsParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*GetClientsParams contains all the parameters to send to the API endpoint 60 | for the get clients operation typically these are written to a http.Request 61 | */ 62 | type GetClientsParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the get clients params 69 | func (o *GetClientsParams) WithTimeout(timeout time.Duration) *GetClientsParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the get clients params 75 | func (o *GetClientsParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the get clients params 80 | func (o *GetClientsParams) WithContext(ctx context.Context) *GetClientsParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the get clients params 86 | func (o *GetClientsParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the get clients params 91 | func (o *GetClientsParams) WithHTTPClient(client *http.Client) *GetClientsParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the get clients params 97 | func (o *GetClientsParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *GetClientsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/client/get_clients_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // GetClientsReader is a Reader for the GetClients structure. 20 | type GetClientsReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *GetClientsReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewGetClientsOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 401: 36 | result := NewGetClientsUnauthorized() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 403: 43 | result := NewGetClientsForbidden() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | default: 50 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 51 | } 52 | } 53 | 54 | // NewGetClientsOK creates a GetClientsOK with default headers values 55 | func NewGetClientsOK() *GetClientsOK { 56 | return &GetClientsOK{} 57 | } 58 | 59 | /*GetClientsOK handles this case with default header values. 60 | 61 | Ok 62 | */ 63 | type GetClientsOK struct { 64 | Payload []*models.Client 65 | } 66 | 67 | func (o *GetClientsOK) Error() string { 68 | return fmt.Sprintf("[GET /client][%d] getClientsOK %+v", 200, o.Payload) 69 | } 70 | 71 | func (o *GetClientsOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 72 | 73 | // response payload 74 | if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 75 | return err 76 | } 77 | 78 | return nil 79 | } 80 | 81 | // NewGetClientsUnauthorized creates a GetClientsUnauthorized with default headers values 82 | func NewGetClientsUnauthorized() *GetClientsUnauthorized { 83 | return &GetClientsUnauthorized{} 84 | } 85 | 86 | /*GetClientsUnauthorized handles this case with default header values. 87 | 88 | Unauthorized 89 | */ 90 | type GetClientsUnauthorized struct { 91 | Payload *models.Error 92 | } 93 | 94 | func (o *GetClientsUnauthorized) Error() string { 95 | return fmt.Sprintf("[GET /client][%d] getClientsUnauthorized %+v", 401, o.Payload) 96 | } 97 | 98 | func (o *GetClientsUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 99 | 100 | o.Payload = new(models.Error) 101 | 102 | // response payload 103 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 104 | return err 105 | } 106 | 107 | return nil 108 | } 109 | 110 | // NewGetClientsForbidden creates a GetClientsForbidden with default headers values 111 | func NewGetClientsForbidden() *GetClientsForbidden { 112 | return &GetClientsForbidden{} 113 | } 114 | 115 | /*GetClientsForbidden handles this case with default header values. 116 | 117 | Forbidden 118 | */ 119 | type GetClientsForbidden struct { 120 | Payload *models.Error 121 | } 122 | 123 | func (o *GetClientsForbidden) Error() string { 124 | return fmt.Sprintf("[GET /client][%d] getClientsForbidden %+v", 403, o.Payload) 125 | } 126 | 127 | func (o *GetClientsForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 128 | 129 | o.Payload = new(models.Error) 130 | 131 | // response payload 132 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 133 | return err 134 | } 135 | 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/client/update_client_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | 20 | models "github.com/gotify/go-api-client/v2/models" 21 | ) 22 | 23 | // NewUpdateClientParams creates a new UpdateClientParams object 24 | // with the default values initialized. 25 | func NewUpdateClientParams() *UpdateClientParams { 26 | var () 27 | return &UpdateClientParams{ 28 | 29 | timeout: cr.DefaultTimeout, 30 | } 31 | } 32 | 33 | // NewUpdateClientParamsWithTimeout creates a new UpdateClientParams object 34 | // with the default values initialized, and the ability to set a timeout on a request 35 | func NewUpdateClientParamsWithTimeout(timeout time.Duration) *UpdateClientParams { 36 | var () 37 | return &UpdateClientParams{ 38 | 39 | timeout: timeout, 40 | } 41 | } 42 | 43 | // NewUpdateClientParamsWithContext creates a new UpdateClientParams object 44 | // with the default values initialized, and the ability to set a context for a request 45 | func NewUpdateClientParamsWithContext(ctx context.Context) *UpdateClientParams { 46 | var () 47 | return &UpdateClientParams{ 48 | 49 | Context: ctx, 50 | } 51 | } 52 | 53 | // NewUpdateClientParamsWithHTTPClient creates a new UpdateClientParams object 54 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 55 | func NewUpdateClientParamsWithHTTPClient(client *http.Client) *UpdateClientParams { 56 | var () 57 | return &UpdateClientParams{ 58 | HTTPClient: client, 59 | } 60 | } 61 | 62 | /*UpdateClientParams contains all the parameters to send to the API endpoint 63 | for the update client operation typically these are written to a http.Request 64 | */ 65 | type UpdateClientParams struct { 66 | 67 | /*Body 68 | the client to update 69 | 70 | */ 71 | Body *models.Client 72 | /*ID 73 | the client id 74 | 75 | */ 76 | ID int64 77 | 78 | timeout time.Duration 79 | Context context.Context 80 | HTTPClient *http.Client 81 | } 82 | 83 | // WithTimeout adds the timeout to the update client params 84 | func (o *UpdateClientParams) WithTimeout(timeout time.Duration) *UpdateClientParams { 85 | o.SetTimeout(timeout) 86 | return o 87 | } 88 | 89 | // SetTimeout adds the timeout to the update client params 90 | func (o *UpdateClientParams) SetTimeout(timeout time.Duration) { 91 | o.timeout = timeout 92 | } 93 | 94 | // WithContext adds the context to the update client params 95 | func (o *UpdateClientParams) WithContext(ctx context.Context) *UpdateClientParams { 96 | o.SetContext(ctx) 97 | return o 98 | } 99 | 100 | // SetContext adds the context to the update client params 101 | func (o *UpdateClientParams) SetContext(ctx context.Context) { 102 | o.Context = ctx 103 | } 104 | 105 | // WithHTTPClient adds the HTTPClient to the update client params 106 | func (o *UpdateClientParams) WithHTTPClient(client *http.Client) *UpdateClientParams { 107 | o.SetHTTPClient(client) 108 | return o 109 | } 110 | 111 | // SetHTTPClient adds the HTTPClient to the update client params 112 | func (o *UpdateClientParams) SetHTTPClient(client *http.Client) { 113 | o.HTTPClient = client 114 | } 115 | 116 | // WithBody adds the body to the update client params 117 | func (o *UpdateClientParams) WithBody(body *models.Client) *UpdateClientParams { 118 | o.SetBody(body) 119 | return o 120 | } 121 | 122 | // SetBody adds the body to the update client params 123 | func (o *UpdateClientParams) SetBody(body *models.Client) { 124 | o.Body = body 125 | } 126 | 127 | // WithID adds the id to the update client params 128 | func (o *UpdateClientParams) WithID(id int64) *UpdateClientParams { 129 | o.SetID(id) 130 | return o 131 | } 132 | 133 | // SetID adds the id to the update client params 134 | func (o *UpdateClientParams) SetID(id int64) { 135 | o.ID = id 136 | } 137 | 138 | // WriteToRequest writes these params to a swagger request 139 | func (o *UpdateClientParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 140 | 141 | if err := r.SetTimeout(o.timeout); err != nil { 142 | return err 143 | } 144 | var res []error 145 | 146 | if o.Body != nil { 147 | if err := r.SetBodyParam(o.Body); err != nil { 148 | return err 149 | } 150 | } 151 | 152 | // path param id 153 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 154 | return err 155 | } 156 | 157 | if len(res) > 0 { 158 | return errors.CompositeValidationError(res...) 159 | } 160 | return nil 161 | } 162 | -------------------------------------------------------------------------------- /client/gotify_rest_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package client 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "github.com/go-openapi/runtime" 10 | httptransport "github.com/go-openapi/runtime/client" 11 | 12 | strfmt "github.com/go-openapi/strfmt" 13 | 14 | "github.com/gotify/go-api-client/v2/client/application" 15 | "github.com/gotify/go-api-client/v2/client/client" 16 | "github.com/gotify/go-api-client/v2/client/message" 17 | "github.com/gotify/go-api-client/v2/client/plugin" 18 | "github.com/gotify/go-api-client/v2/client/user" 19 | "github.com/gotify/go-api-client/v2/client/version" 20 | ) 21 | 22 | // Default gotify REST HTTP client. 23 | var Default = NewHTTPClient(nil) 24 | 25 | const ( 26 | // DefaultHost is the default Host 27 | // found in Meta (info) section of spec file 28 | DefaultHost string = "localhost" 29 | // DefaultBasePath is the default BasePath 30 | // found in Meta (info) section of spec file 31 | DefaultBasePath string = "/" 32 | ) 33 | 34 | // DefaultSchemes are the default schemes found in Meta (info) section of spec file 35 | var DefaultSchemes = []string{"http", "https"} 36 | 37 | // NewHTTPClient creates a new gotify REST HTTP client. 38 | func NewHTTPClient(formats strfmt.Registry) *GotifyREST { 39 | return NewHTTPClientWithConfig(formats, nil) 40 | } 41 | 42 | // NewHTTPClientWithConfig creates a new gotify REST HTTP client, 43 | // using a customizable transport config. 44 | func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *GotifyREST { 45 | // ensure nullable parameters have default 46 | if cfg == nil { 47 | cfg = DefaultTransportConfig() 48 | } 49 | 50 | // create transport and client 51 | transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) 52 | return New(transport, formats) 53 | } 54 | 55 | // New creates a new gotify REST client 56 | func New(transport runtime.ClientTransport, formats strfmt.Registry) *GotifyREST { 57 | // ensure nullable parameters have default 58 | if formats == nil { 59 | formats = strfmt.Default 60 | } 61 | 62 | cli := new(GotifyREST) 63 | cli.Transport = transport 64 | 65 | cli.Application = application.New(transport, formats) 66 | 67 | cli.Client = client.New(transport, formats) 68 | 69 | cli.Message = message.New(transport, formats) 70 | 71 | cli.Plugin = plugin.New(transport, formats) 72 | 73 | cli.User = user.New(transport, formats) 74 | 75 | cli.Version = version.New(transport, formats) 76 | 77 | return cli 78 | } 79 | 80 | // DefaultTransportConfig creates a TransportConfig with the 81 | // default settings taken from the meta section of the spec file. 82 | func DefaultTransportConfig() *TransportConfig { 83 | return &TransportConfig{ 84 | Host: DefaultHost, 85 | BasePath: DefaultBasePath, 86 | Schemes: DefaultSchemes, 87 | } 88 | } 89 | 90 | // TransportConfig contains the transport related info, 91 | // found in the meta section of the spec file. 92 | type TransportConfig struct { 93 | Host string 94 | BasePath string 95 | Schemes []string 96 | } 97 | 98 | // WithHost overrides the default host, 99 | // provided by the meta section of the spec file. 100 | func (cfg *TransportConfig) WithHost(host string) *TransportConfig { 101 | cfg.Host = host 102 | return cfg 103 | } 104 | 105 | // WithBasePath overrides the default basePath, 106 | // provided by the meta section of the spec file. 107 | func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { 108 | cfg.BasePath = basePath 109 | return cfg 110 | } 111 | 112 | // WithSchemes overrides the default schemes, 113 | // provided by the meta section of the spec file. 114 | func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { 115 | cfg.Schemes = schemes 116 | return cfg 117 | } 118 | 119 | // GotifyREST is a client for gotify REST 120 | type GotifyREST struct { 121 | Application *application.Client 122 | 123 | Client *client.Client 124 | 125 | Message *message.Client 126 | 127 | Plugin *plugin.Client 128 | 129 | User *user.Client 130 | 131 | Version *version.Client 132 | 133 | Transport runtime.ClientTransport 134 | } 135 | 136 | // SetTransport changes the transport on the client and all its subresources 137 | func (c *GotifyREST) SetTransport(transport runtime.ClientTransport) { 138 | c.Transport = transport 139 | 140 | c.Application.SetTransport(transport) 141 | 142 | c.Client.SetTransport(transport) 143 | 144 | c.Message.SetTransport(transport) 145 | 146 | c.Plugin.SetTransport(transport) 147 | 148 | c.User.SetTransport(transport) 149 | 150 | c.Version.SetTransport(transport) 151 | 152 | } 153 | -------------------------------------------------------------------------------- /client/message/create_message_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | 19 | models "github.com/gotify/go-api-client/v2/models" 20 | ) 21 | 22 | // NewCreateMessageParams creates a new CreateMessageParams object 23 | // with the default values initialized. 24 | func NewCreateMessageParams() *CreateMessageParams { 25 | var () 26 | return &CreateMessageParams{ 27 | 28 | timeout: cr.DefaultTimeout, 29 | } 30 | } 31 | 32 | // NewCreateMessageParamsWithTimeout creates a new CreateMessageParams object 33 | // with the default values initialized, and the ability to set a timeout on a request 34 | func NewCreateMessageParamsWithTimeout(timeout time.Duration) *CreateMessageParams { 35 | var () 36 | return &CreateMessageParams{ 37 | 38 | timeout: timeout, 39 | } 40 | } 41 | 42 | // NewCreateMessageParamsWithContext creates a new CreateMessageParams object 43 | // with the default values initialized, and the ability to set a context for a request 44 | func NewCreateMessageParamsWithContext(ctx context.Context) *CreateMessageParams { 45 | var () 46 | return &CreateMessageParams{ 47 | 48 | Context: ctx, 49 | } 50 | } 51 | 52 | // NewCreateMessageParamsWithHTTPClient creates a new CreateMessageParams object 53 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 54 | func NewCreateMessageParamsWithHTTPClient(client *http.Client) *CreateMessageParams { 55 | var () 56 | return &CreateMessageParams{ 57 | HTTPClient: client, 58 | } 59 | } 60 | 61 | /*CreateMessageParams contains all the parameters to send to the API endpoint 62 | for the create message operation typically these are written to a http.Request 63 | */ 64 | type CreateMessageParams struct { 65 | 66 | /*Body 67 | the message to add 68 | 69 | */ 70 | Body *models.MessageExternal 71 | 72 | timeout time.Duration 73 | Context context.Context 74 | HTTPClient *http.Client 75 | } 76 | 77 | // WithTimeout adds the timeout to the create message params 78 | func (o *CreateMessageParams) WithTimeout(timeout time.Duration) *CreateMessageParams { 79 | o.SetTimeout(timeout) 80 | return o 81 | } 82 | 83 | // SetTimeout adds the timeout to the create message params 84 | func (o *CreateMessageParams) SetTimeout(timeout time.Duration) { 85 | o.timeout = timeout 86 | } 87 | 88 | // WithContext adds the context to the create message params 89 | func (o *CreateMessageParams) WithContext(ctx context.Context) *CreateMessageParams { 90 | o.SetContext(ctx) 91 | return o 92 | } 93 | 94 | // SetContext adds the context to the create message params 95 | func (o *CreateMessageParams) SetContext(ctx context.Context) { 96 | o.Context = ctx 97 | } 98 | 99 | // WithHTTPClient adds the HTTPClient to the create message params 100 | func (o *CreateMessageParams) WithHTTPClient(client *http.Client) *CreateMessageParams { 101 | o.SetHTTPClient(client) 102 | return o 103 | } 104 | 105 | // SetHTTPClient adds the HTTPClient to the create message params 106 | func (o *CreateMessageParams) SetHTTPClient(client *http.Client) { 107 | o.HTTPClient = client 108 | } 109 | 110 | // WithBody adds the body to the create message params 111 | func (o *CreateMessageParams) WithBody(body *models.MessageExternal) *CreateMessageParams { 112 | o.SetBody(body) 113 | return o 114 | } 115 | 116 | // SetBody adds the body to the create message params 117 | func (o *CreateMessageParams) SetBody(body *models.MessageExternal) { 118 | o.Body = body 119 | } 120 | 121 | // WriteToRequest writes these params to a swagger request 122 | func (o *CreateMessageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 123 | 124 | if err := r.SetTimeout(o.timeout); err != nil { 125 | return err 126 | } 127 | var res []error 128 | 129 | if o.Body != nil { 130 | if err := r.SetBodyParam(o.Body); err != nil { 131 | return err 132 | } 133 | } 134 | 135 | if len(res) > 0 { 136 | return errors.CompositeValidationError(res...) 137 | } 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /client/message/create_message_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // CreateMessageReader is a Reader for the CreateMessage structure. 20 | type CreateMessageReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *CreateMessageReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewCreateMessageOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewCreateMessageBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewCreateMessageUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewCreateMessageForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | default: 57 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 | } 59 | } 60 | 61 | // NewCreateMessageOK creates a CreateMessageOK with default headers values 62 | func NewCreateMessageOK() *CreateMessageOK { 63 | return &CreateMessageOK{} 64 | } 65 | 66 | /*CreateMessageOK handles this case with default header values. 67 | 68 | Ok 69 | */ 70 | type CreateMessageOK struct { 71 | Payload *models.MessageExternal 72 | } 73 | 74 | func (o *CreateMessageOK) Error() string { 75 | return fmt.Sprintf("[POST /message][%d] createMessageOK %+v", 200, o.Payload) 76 | } 77 | 78 | func (o *CreateMessageOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 | 80 | o.Payload = new(models.MessageExternal) 81 | 82 | // response payload 83 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 | return err 85 | } 86 | 87 | return nil 88 | } 89 | 90 | // NewCreateMessageBadRequest creates a CreateMessageBadRequest with default headers values 91 | func NewCreateMessageBadRequest() *CreateMessageBadRequest { 92 | return &CreateMessageBadRequest{} 93 | } 94 | 95 | /*CreateMessageBadRequest handles this case with default header values. 96 | 97 | Bad Request 98 | */ 99 | type CreateMessageBadRequest struct { 100 | Payload *models.Error 101 | } 102 | 103 | func (o *CreateMessageBadRequest) Error() string { 104 | return fmt.Sprintf("[POST /message][%d] createMessageBadRequest %+v", 400, o.Payload) 105 | } 106 | 107 | func (o *CreateMessageBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 | 109 | o.Payload = new(models.Error) 110 | 111 | // response payload 112 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 113 | return err 114 | } 115 | 116 | return nil 117 | } 118 | 119 | // NewCreateMessageUnauthorized creates a CreateMessageUnauthorized with default headers values 120 | func NewCreateMessageUnauthorized() *CreateMessageUnauthorized { 121 | return &CreateMessageUnauthorized{} 122 | } 123 | 124 | /*CreateMessageUnauthorized handles this case with default header values. 125 | 126 | Unauthorized 127 | */ 128 | type CreateMessageUnauthorized struct { 129 | Payload *models.Error 130 | } 131 | 132 | func (o *CreateMessageUnauthorized) Error() string { 133 | return fmt.Sprintf("[POST /message][%d] createMessageUnauthorized %+v", 401, o.Payload) 134 | } 135 | 136 | func (o *CreateMessageUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 137 | 138 | o.Payload = new(models.Error) 139 | 140 | // response payload 141 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 142 | return err 143 | } 144 | 145 | return nil 146 | } 147 | 148 | // NewCreateMessageForbidden creates a CreateMessageForbidden with default headers values 149 | func NewCreateMessageForbidden() *CreateMessageForbidden { 150 | return &CreateMessageForbidden{} 151 | } 152 | 153 | /*CreateMessageForbidden handles this case with default header values. 154 | 155 | Forbidden 156 | */ 157 | type CreateMessageForbidden struct { 158 | Payload *models.Error 159 | } 160 | 161 | func (o *CreateMessageForbidden) Error() string { 162 | return fmt.Sprintf("[POST /message][%d] createMessageForbidden %+v", 403, o.Payload) 163 | } 164 | 165 | func (o *CreateMessageForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 166 | 167 | o.Payload = new(models.Error) 168 | 169 | // response payload 170 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 171 | return err 172 | } 173 | 174 | return nil 175 | } 176 | -------------------------------------------------------------------------------- /client/message/delete_app_messages_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewDeleteAppMessagesParams creates a new DeleteAppMessagesParams object 22 | // with the default values initialized. 23 | func NewDeleteAppMessagesParams() *DeleteAppMessagesParams { 24 | var () 25 | return &DeleteAppMessagesParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewDeleteAppMessagesParamsWithTimeout creates a new DeleteAppMessagesParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewDeleteAppMessagesParamsWithTimeout(timeout time.Duration) *DeleteAppMessagesParams { 34 | var () 35 | return &DeleteAppMessagesParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewDeleteAppMessagesParamsWithContext creates a new DeleteAppMessagesParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewDeleteAppMessagesParamsWithContext(ctx context.Context) *DeleteAppMessagesParams { 44 | var () 45 | return &DeleteAppMessagesParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewDeleteAppMessagesParamsWithHTTPClient creates a new DeleteAppMessagesParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewDeleteAppMessagesParamsWithHTTPClient(client *http.Client) *DeleteAppMessagesParams { 54 | var () 55 | return &DeleteAppMessagesParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*DeleteAppMessagesParams contains all the parameters to send to the API endpoint 61 | for the delete app messages operation typically these are written to a http.Request 62 | */ 63 | type DeleteAppMessagesParams struct { 64 | 65 | /*ID 66 | the application id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the delete app messages params 77 | func (o *DeleteAppMessagesParams) WithTimeout(timeout time.Duration) *DeleteAppMessagesParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the delete app messages params 83 | func (o *DeleteAppMessagesParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the delete app messages params 88 | func (o *DeleteAppMessagesParams) WithContext(ctx context.Context) *DeleteAppMessagesParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the delete app messages params 94 | func (o *DeleteAppMessagesParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the delete app messages params 99 | func (o *DeleteAppMessagesParams) WithHTTPClient(client *http.Client) *DeleteAppMessagesParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the delete app messages params 105 | func (o *DeleteAppMessagesParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the delete app messages params 110 | func (o *DeleteAppMessagesParams) WithID(id int64) *DeleteAppMessagesParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the delete app messages params 116 | func (o *DeleteAppMessagesParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *DeleteAppMessagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/message/delete_message_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewDeleteMessageParams creates a new DeleteMessageParams object 22 | // with the default values initialized. 23 | func NewDeleteMessageParams() *DeleteMessageParams { 24 | var () 25 | return &DeleteMessageParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewDeleteMessageParamsWithTimeout creates a new DeleteMessageParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewDeleteMessageParamsWithTimeout(timeout time.Duration) *DeleteMessageParams { 34 | var () 35 | return &DeleteMessageParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewDeleteMessageParamsWithContext creates a new DeleteMessageParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewDeleteMessageParamsWithContext(ctx context.Context) *DeleteMessageParams { 44 | var () 45 | return &DeleteMessageParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewDeleteMessageParamsWithHTTPClient creates a new DeleteMessageParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewDeleteMessageParamsWithHTTPClient(client *http.Client) *DeleteMessageParams { 54 | var () 55 | return &DeleteMessageParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*DeleteMessageParams contains all the parameters to send to the API endpoint 61 | for the delete message operation typically these are written to a http.Request 62 | */ 63 | type DeleteMessageParams struct { 64 | 65 | /*ID 66 | the message id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the delete message params 77 | func (o *DeleteMessageParams) WithTimeout(timeout time.Duration) *DeleteMessageParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the delete message params 83 | func (o *DeleteMessageParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the delete message params 88 | func (o *DeleteMessageParams) WithContext(ctx context.Context) *DeleteMessageParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the delete message params 94 | func (o *DeleteMessageParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the delete message params 99 | func (o *DeleteMessageParams) WithHTTPClient(client *http.Client) *DeleteMessageParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the delete message params 105 | func (o *DeleteMessageParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the delete message params 110 | func (o *DeleteMessageParams) WithID(id int64) *DeleteMessageParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the delete message params 116 | func (o *DeleteMessageParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *DeleteMessageParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/message/delete_messages_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewDeleteMessagesParams creates a new DeleteMessagesParams object 21 | // with the default values initialized. 22 | func NewDeleteMessagesParams() *DeleteMessagesParams { 23 | 24 | return &DeleteMessagesParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewDeleteMessagesParamsWithTimeout creates a new DeleteMessagesParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewDeleteMessagesParamsWithTimeout(timeout time.Duration) *DeleteMessagesParams { 33 | 34 | return &DeleteMessagesParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewDeleteMessagesParamsWithContext creates a new DeleteMessagesParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewDeleteMessagesParamsWithContext(ctx context.Context) *DeleteMessagesParams { 43 | 44 | return &DeleteMessagesParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewDeleteMessagesParamsWithHTTPClient creates a new DeleteMessagesParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewDeleteMessagesParamsWithHTTPClient(client *http.Client) *DeleteMessagesParams { 53 | 54 | return &DeleteMessagesParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*DeleteMessagesParams contains all the parameters to send to the API endpoint 60 | for the delete messages operation typically these are written to a http.Request 61 | */ 62 | type DeleteMessagesParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the delete messages params 69 | func (o *DeleteMessagesParams) WithTimeout(timeout time.Duration) *DeleteMessagesParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the delete messages params 75 | func (o *DeleteMessagesParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the delete messages params 80 | func (o *DeleteMessagesParams) WithContext(ctx context.Context) *DeleteMessagesParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the delete messages params 86 | func (o *DeleteMessagesParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the delete messages params 91 | func (o *DeleteMessagesParams) WithHTTPClient(client *http.Client) *DeleteMessagesParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the delete messages params 97 | func (o *DeleteMessagesParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *DeleteMessagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/message/delete_messages_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // DeleteMessagesReader is a Reader for the DeleteMessages structure. 20 | type DeleteMessagesReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *DeleteMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewDeleteMessagesOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 401: 36 | result := NewDeleteMessagesUnauthorized() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 403: 43 | result := NewDeleteMessagesForbidden() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | default: 50 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 51 | } 52 | } 53 | 54 | // NewDeleteMessagesOK creates a DeleteMessagesOK with default headers values 55 | func NewDeleteMessagesOK() *DeleteMessagesOK { 56 | return &DeleteMessagesOK{} 57 | } 58 | 59 | /*DeleteMessagesOK handles this case with default header values. 60 | 61 | Ok 62 | */ 63 | type DeleteMessagesOK struct { 64 | } 65 | 66 | func (o *DeleteMessagesOK) Error() string { 67 | return fmt.Sprintf("[DELETE /message][%d] deleteMessagesOK ", 200) 68 | } 69 | 70 | func (o *DeleteMessagesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 71 | 72 | return nil 73 | } 74 | 75 | // NewDeleteMessagesUnauthorized creates a DeleteMessagesUnauthorized with default headers values 76 | func NewDeleteMessagesUnauthorized() *DeleteMessagesUnauthorized { 77 | return &DeleteMessagesUnauthorized{} 78 | } 79 | 80 | /*DeleteMessagesUnauthorized handles this case with default header values. 81 | 82 | Unauthorized 83 | */ 84 | type DeleteMessagesUnauthorized struct { 85 | Payload *models.Error 86 | } 87 | 88 | func (o *DeleteMessagesUnauthorized) Error() string { 89 | return fmt.Sprintf("[DELETE /message][%d] deleteMessagesUnauthorized %+v", 401, o.Payload) 90 | } 91 | 92 | func (o *DeleteMessagesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 93 | 94 | o.Payload = new(models.Error) 95 | 96 | // response payload 97 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 98 | return err 99 | } 100 | 101 | return nil 102 | } 103 | 104 | // NewDeleteMessagesForbidden creates a DeleteMessagesForbidden with default headers values 105 | func NewDeleteMessagesForbidden() *DeleteMessagesForbidden { 106 | return &DeleteMessagesForbidden{} 107 | } 108 | 109 | /*DeleteMessagesForbidden handles this case with default header values. 110 | 111 | Forbidden 112 | */ 113 | type DeleteMessagesForbidden struct { 114 | Payload *models.Error 115 | } 116 | 117 | func (o *DeleteMessagesForbidden) Error() string { 118 | return fmt.Sprintf("[DELETE /message][%d] deleteMessagesForbidden %+v", 403, o.Payload) 119 | } 120 | 121 | func (o *DeleteMessagesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 122 | 123 | o.Payload = new(models.Error) 124 | 125 | // response payload 126 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 127 | return err 128 | } 129 | 130 | return nil 131 | } 132 | -------------------------------------------------------------------------------- /client/message/get_messages_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewGetMessagesParams creates a new GetMessagesParams object 22 | // with the default values initialized. 23 | func NewGetMessagesParams() *GetMessagesParams { 24 | var ( 25 | limitDefault = int64(100) 26 | ) 27 | return &GetMessagesParams{ 28 | Limit: &limitDefault, 29 | 30 | timeout: cr.DefaultTimeout, 31 | } 32 | } 33 | 34 | // NewGetMessagesParamsWithTimeout creates a new GetMessagesParams object 35 | // with the default values initialized, and the ability to set a timeout on a request 36 | func NewGetMessagesParamsWithTimeout(timeout time.Duration) *GetMessagesParams { 37 | var ( 38 | limitDefault = int64(100) 39 | ) 40 | return &GetMessagesParams{ 41 | Limit: &limitDefault, 42 | 43 | timeout: timeout, 44 | } 45 | } 46 | 47 | // NewGetMessagesParamsWithContext creates a new GetMessagesParams object 48 | // with the default values initialized, and the ability to set a context for a request 49 | func NewGetMessagesParamsWithContext(ctx context.Context) *GetMessagesParams { 50 | var ( 51 | limitDefault = int64(100) 52 | ) 53 | return &GetMessagesParams{ 54 | Limit: &limitDefault, 55 | 56 | Context: ctx, 57 | } 58 | } 59 | 60 | // NewGetMessagesParamsWithHTTPClient creates a new GetMessagesParams object 61 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 62 | func NewGetMessagesParamsWithHTTPClient(client *http.Client) *GetMessagesParams { 63 | var ( 64 | limitDefault = int64(100) 65 | ) 66 | return &GetMessagesParams{ 67 | Limit: &limitDefault, 68 | HTTPClient: client, 69 | } 70 | } 71 | 72 | /*GetMessagesParams contains all the parameters to send to the API endpoint 73 | for the get messages operation typically these are written to a http.Request 74 | */ 75 | type GetMessagesParams struct { 76 | 77 | /*Limit 78 | the maximal amount of messages to return 79 | 80 | */ 81 | Limit *int64 82 | /*Since 83 | return all messages with an ID less than this value 84 | 85 | */ 86 | Since *int64 87 | 88 | timeout time.Duration 89 | Context context.Context 90 | HTTPClient *http.Client 91 | } 92 | 93 | // WithTimeout adds the timeout to the get messages params 94 | func (o *GetMessagesParams) WithTimeout(timeout time.Duration) *GetMessagesParams { 95 | o.SetTimeout(timeout) 96 | return o 97 | } 98 | 99 | // SetTimeout adds the timeout to the get messages params 100 | func (o *GetMessagesParams) SetTimeout(timeout time.Duration) { 101 | o.timeout = timeout 102 | } 103 | 104 | // WithContext adds the context to the get messages params 105 | func (o *GetMessagesParams) WithContext(ctx context.Context) *GetMessagesParams { 106 | o.SetContext(ctx) 107 | return o 108 | } 109 | 110 | // SetContext adds the context to the get messages params 111 | func (o *GetMessagesParams) SetContext(ctx context.Context) { 112 | o.Context = ctx 113 | } 114 | 115 | // WithHTTPClient adds the HTTPClient to the get messages params 116 | func (o *GetMessagesParams) WithHTTPClient(client *http.Client) *GetMessagesParams { 117 | o.SetHTTPClient(client) 118 | return o 119 | } 120 | 121 | // SetHTTPClient adds the HTTPClient to the get messages params 122 | func (o *GetMessagesParams) SetHTTPClient(client *http.Client) { 123 | o.HTTPClient = client 124 | } 125 | 126 | // WithLimit adds the limit to the get messages params 127 | func (o *GetMessagesParams) WithLimit(limit *int64) *GetMessagesParams { 128 | o.SetLimit(limit) 129 | return o 130 | } 131 | 132 | // SetLimit adds the limit to the get messages params 133 | func (o *GetMessagesParams) SetLimit(limit *int64) { 134 | o.Limit = limit 135 | } 136 | 137 | // WithSince adds the since to the get messages params 138 | func (o *GetMessagesParams) WithSince(since *int64) *GetMessagesParams { 139 | o.SetSince(since) 140 | return o 141 | } 142 | 143 | // SetSince adds the since to the get messages params 144 | func (o *GetMessagesParams) SetSince(since *int64) { 145 | o.Since = since 146 | } 147 | 148 | // WriteToRequest writes these params to a swagger request 149 | func (o *GetMessagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 150 | 151 | if err := r.SetTimeout(o.timeout); err != nil { 152 | return err 153 | } 154 | var res []error 155 | 156 | if o.Limit != nil { 157 | 158 | // query param limit 159 | var qrLimit int64 160 | if o.Limit != nil { 161 | qrLimit = *o.Limit 162 | } 163 | qLimit := swag.FormatInt64(qrLimit) 164 | if qLimit != "" { 165 | if err := r.SetQueryParam("limit", qLimit); err != nil { 166 | return err 167 | } 168 | } 169 | 170 | } 171 | 172 | if o.Since != nil { 173 | 174 | // query param since 175 | var qrSince int64 176 | if o.Since != nil { 177 | qrSince = *o.Since 178 | } 179 | qSince := swag.FormatInt64(qrSince) 180 | if qSince != "" { 181 | if err := r.SetQueryParam("since", qSince); err != nil { 182 | return err 183 | } 184 | } 185 | 186 | } 187 | 188 | if len(res) > 0 { 189 | return errors.CompositeValidationError(res...) 190 | } 191 | return nil 192 | } 193 | -------------------------------------------------------------------------------- /client/message/get_messages_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // GetMessagesReader is a Reader for the GetMessages structure. 20 | type GetMessagesReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *GetMessagesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewGetMessagesOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewGetMessagesBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewGetMessagesUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewGetMessagesForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | default: 57 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 | } 59 | } 60 | 61 | // NewGetMessagesOK creates a GetMessagesOK with default headers values 62 | func NewGetMessagesOK() *GetMessagesOK { 63 | return &GetMessagesOK{} 64 | } 65 | 66 | /*GetMessagesOK handles this case with default header values. 67 | 68 | Ok 69 | */ 70 | type GetMessagesOK struct { 71 | Payload *models.PagedMessages 72 | } 73 | 74 | func (o *GetMessagesOK) Error() string { 75 | return fmt.Sprintf("[GET /message][%d] getMessagesOK %+v", 200, o.Payload) 76 | } 77 | 78 | func (o *GetMessagesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 | 80 | o.Payload = new(models.PagedMessages) 81 | 82 | // response payload 83 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 | return err 85 | } 86 | 87 | return nil 88 | } 89 | 90 | // NewGetMessagesBadRequest creates a GetMessagesBadRequest with default headers values 91 | func NewGetMessagesBadRequest() *GetMessagesBadRequest { 92 | return &GetMessagesBadRequest{} 93 | } 94 | 95 | /*GetMessagesBadRequest handles this case with default header values. 96 | 97 | Bad Request 98 | */ 99 | type GetMessagesBadRequest struct { 100 | Payload *models.Error 101 | } 102 | 103 | func (o *GetMessagesBadRequest) Error() string { 104 | return fmt.Sprintf("[GET /message][%d] getMessagesBadRequest %+v", 400, o.Payload) 105 | } 106 | 107 | func (o *GetMessagesBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 | 109 | o.Payload = new(models.Error) 110 | 111 | // response payload 112 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 113 | return err 114 | } 115 | 116 | return nil 117 | } 118 | 119 | // NewGetMessagesUnauthorized creates a GetMessagesUnauthorized with default headers values 120 | func NewGetMessagesUnauthorized() *GetMessagesUnauthorized { 121 | return &GetMessagesUnauthorized{} 122 | } 123 | 124 | /*GetMessagesUnauthorized handles this case with default header values. 125 | 126 | Unauthorized 127 | */ 128 | type GetMessagesUnauthorized struct { 129 | Payload *models.Error 130 | } 131 | 132 | func (o *GetMessagesUnauthorized) Error() string { 133 | return fmt.Sprintf("[GET /message][%d] getMessagesUnauthorized %+v", 401, o.Payload) 134 | } 135 | 136 | func (o *GetMessagesUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 137 | 138 | o.Payload = new(models.Error) 139 | 140 | // response payload 141 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 142 | return err 143 | } 144 | 145 | return nil 146 | } 147 | 148 | // NewGetMessagesForbidden creates a GetMessagesForbidden with default headers values 149 | func NewGetMessagesForbidden() *GetMessagesForbidden { 150 | return &GetMessagesForbidden{} 151 | } 152 | 153 | /*GetMessagesForbidden handles this case with default header values. 154 | 155 | Forbidden 156 | */ 157 | type GetMessagesForbidden struct { 158 | Payload *models.Error 159 | } 160 | 161 | func (o *GetMessagesForbidden) Error() string { 162 | return fmt.Sprintf("[GET /message][%d] getMessagesForbidden %+v", 403, o.Payload) 163 | } 164 | 165 | func (o *GetMessagesForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 166 | 167 | o.Payload = new(models.Error) 168 | 169 | // response payload 170 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 171 | return err 172 | } 173 | 174 | return nil 175 | } 176 | -------------------------------------------------------------------------------- /client/message/stream_messages_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package message 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewStreamMessagesParams creates a new StreamMessagesParams object 21 | // with the default values initialized. 22 | func NewStreamMessagesParams() *StreamMessagesParams { 23 | 24 | return &StreamMessagesParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewStreamMessagesParamsWithTimeout creates a new StreamMessagesParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewStreamMessagesParamsWithTimeout(timeout time.Duration) *StreamMessagesParams { 33 | 34 | return &StreamMessagesParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewStreamMessagesParamsWithContext creates a new StreamMessagesParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewStreamMessagesParamsWithContext(ctx context.Context) *StreamMessagesParams { 43 | 44 | return &StreamMessagesParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewStreamMessagesParamsWithHTTPClient creates a new StreamMessagesParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewStreamMessagesParamsWithHTTPClient(client *http.Client) *StreamMessagesParams { 53 | 54 | return &StreamMessagesParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*StreamMessagesParams contains all the parameters to send to the API endpoint 60 | for the stream messages operation typically these are written to a http.Request 61 | */ 62 | type StreamMessagesParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the stream messages params 69 | func (o *StreamMessagesParams) WithTimeout(timeout time.Duration) *StreamMessagesParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the stream messages params 75 | func (o *StreamMessagesParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the stream messages params 80 | func (o *StreamMessagesParams) WithContext(ctx context.Context) *StreamMessagesParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the stream messages params 86 | func (o *StreamMessagesParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the stream messages params 91 | func (o *StreamMessagesParams) WithHTTPClient(client *http.Client) *StreamMessagesParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the stream messages params 97 | func (o *StreamMessagesParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *StreamMessagesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/plugin/disable_plugin_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package plugin 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewDisablePluginParams creates a new DisablePluginParams object 22 | // with the default values initialized. 23 | func NewDisablePluginParams() *DisablePluginParams { 24 | var () 25 | return &DisablePluginParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewDisablePluginParamsWithTimeout creates a new DisablePluginParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewDisablePluginParamsWithTimeout(timeout time.Duration) *DisablePluginParams { 34 | var () 35 | return &DisablePluginParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewDisablePluginParamsWithContext creates a new DisablePluginParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewDisablePluginParamsWithContext(ctx context.Context) *DisablePluginParams { 44 | var () 45 | return &DisablePluginParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewDisablePluginParamsWithHTTPClient creates a new DisablePluginParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewDisablePluginParamsWithHTTPClient(client *http.Client) *DisablePluginParams { 54 | var () 55 | return &DisablePluginParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*DisablePluginParams contains all the parameters to send to the API endpoint 61 | for the disable plugin operation typically these are written to a http.Request 62 | */ 63 | type DisablePluginParams struct { 64 | 65 | /*ID 66 | the plugin id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the disable plugin params 77 | func (o *DisablePluginParams) WithTimeout(timeout time.Duration) *DisablePluginParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the disable plugin params 83 | func (o *DisablePluginParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the disable plugin params 88 | func (o *DisablePluginParams) WithContext(ctx context.Context) *DisablePluginParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the disable plugin params 94 | func (o *DisablePluginParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the disable plugin params 99 | func (o *DisablePluginParams) WithHTTPClient(client *http.Client) *DisablePluginParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the disable plugin params 105 | func (o *DisablePluginParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the disable plugin params 110 | func (o *DisablePluginParams) WithID(id int64) *DisablePluginParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the disable plugin params 116 | func (o *DisablePluginParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *DisablePluginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/plugin/enable_plugin_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package plugin 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewEnablePluginParams creates a new EnablePluginParams object 22 | // with the default values initialized. 23 | func NewEnablePluginParams() *EnablePluginParams { 24 | var () 25 | return &EnablePluginParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewEnablePluginParamsWithTimeout creates a new EnablePluginParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewEnablePluginParamsWithTimeout(timeout time.Duration) *EnablePluginParams { 34 | var () 35 | return &EnablePluginParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewEnablePluginParamsWithContext creates a new EnablePluginParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewEnablePluginParamsWithContext(ctx context.Context) *EnablePluginParams { 44 | var () 45 | return &EnablePluginParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewEnablePluginParamsWithHTTPClient creates a new EnablePluginParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewEnablePluginParamsWithHTTPClient(client *http.Client) *EnablePluginParams { 54 | var () 55 | return &EnablePluginParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*EnablePluginParams contains all the parameters to send to the API endpoint 61 | for the enable plugin operation typically these are written to a http.Request 62 | */ 63 | type EnablePluginParams struct { 64 | 65 | /*ID 66 | the plugin id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the enable plugin params 77 | func (o *EnablePluginParams) WithTimeout(timeout time.Duration) *EnablePluginParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the enable plugin params 83 | func (o *EnablePluginParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the enable plugin params 88 | func (o *EnablePluginParams) WithContext(ctx context.Context) *EnablePluginParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the enable plugin params 94 | func (o *EnablePluginParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the enable plugin params 99 | func (o *EnablePluginParams) WithHTTPClient(client *http.Client) *EnablePluginParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the enable plugin params 105 | func (o *EnablePluginParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the enable plugin params 110 | func (o *EnablePluginParams) WithID(id int64) *EnablePluginParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the enable plugin params 116 | func (o *EnablePluginParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *EnablePluginParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/plugin/get_plugin_config_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package plugin 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewGetPluginConfigParams creates a new GetPluginConfigParams object 22 | // with the default values initialized. 23 | func NewGetPluginConfigParams() *GetPluginConfigParams { 24 | var () 25 | return &GetPluginConfigParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewGetPluginConfigParamsWithTimeout creates a new GetPluginConfigParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewGetPluginConfigParamsWithTimeout(timeout time.Duration) *GetPluginConfigParams { 34 | var () 35 | return &GetPluginConfigParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewGetPluginConfigParamsWithContext creates a new GetPluginConfigParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewGetPluginConfigParamsWithContext(ctx context.Context) *GetPluginConfigParams { 44 | var () 45 | return &GetPluginConfigParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewGetPluginConfigParamsWithHTTPClient creates a new GetPluginConfigParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewGetPluginConfigParamsWithHTTPClient(client *http.Client) *GetPluginConfigParams { 54 | var () 55 | return &GetPluginConfigParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*GetPluginConfigParams contains all the parameters to send to the API endpoint 61 | for the get plugin config operation typically these are written to a http.Request 62 | */ 63 | type GetPluginConfigParams struct { 64 | 65 | /*ID 66 | the plugin id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the get plugin config params 77 | func (o *GetPluginConfigParams) WithTimeout(timeout time.Duration) *GetPluginConfigParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the get plugin config params 83 | func (o *GetPluginConfigParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the get plugin config params 88 | func (o *GetPluginConfigParams) WithContext(ctx context.Context) *GetPluginConfigParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the get plugin config params 94 | func (o *GetPluginConfigParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the get plugin config params 99 | func (o *GetPluginConfigParams) WithHTTPClient(client *http.Client) *GetPluginConfigParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the get plugin config params 105 | func (o *GetPluginConfigParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the get plugin config params 110 | func (o *GetPluginConfigParams) WithID(id int64) *GetPluginConfigParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the get plugin config params 116 | func (o *GetPluginConfigParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *GetPluginConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/plugin/get_plugin_display_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package plugin 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewGetPluginDisplayParams creates a new GetPluginDisplayParams object 22 | // with the default values initialized. 23 | func NewGetPluginDisplayParams() *GetPluginDisplayParams { 24 | var () 25 | return &GetPluginDisplayParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewGetPluginDisplayParamsWithTimeout creates a new GetPluginDisplayParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewGetPluginDisplayParamsWithTimeout(timeout time.Duration) *GetPluginDisplayParams { 34 | var () 35 | return &GetPluginDisplayParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewGetPluginDisplayParamsWithContext creates a new GetPluginDisplayParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewGetPluginDisplayParamsWithContext(ctx context.Context) *GetPluginDisplayParams { 44 | var () 45 | return &GetPluginDisplayParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewGetPluginDisplayParamsWithHTTPClient creates a new GetPluginDisplayParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewGetPluginDisplayParamsWithHTTPClient(client *http.Client) *GetPluginDisplayParams { 54 | var () 55 | return &GetPluginDisplayParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*GetPluginDisplayParams contains all the parameters to send to the API endpoint 61 | for the get plugin display operation typically these are written to a http.Request 62 | */ 63 | type GetPluginDisplayParams struct { 64 | 65 | /*ID 66 | the plugin id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the get plugin display params 77 | func (o *GetPluginDisplayParams) WithTimeout(timeout time.Duration) *GetPluginDisplayParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the get plugin display params 83 | func (o *GetPluginDisplayParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the get plugin display params 88 | func (o *GetPluginDisplayParams) WithContext(ctx context.Context) *GetPluginDisplayParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the get plugin display params 94 | func (o *GetPluginDisplayParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the get plugin display params 99 | func (o *GetPluginDisplayParams) WithHTTPClient(client *http.Client) *GetPluginDisplayParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the get plugin display params 105 | func (o *GetPluginDisplayParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the get plugin display params 110 | func (o *GetPluginDisplayParams) WithID(id int64) *GetPluginDisplayParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the get plugin display params 116 | func (o *GetPluginDisplayParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *GetPluginDisplayParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/plugin/get_plugins_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package plugin 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewGetPluginsParams creates a new GetPluginsParams object 21 | // with the default values initialized. 22 | func NewGetPluginsParams() *GetPluginsParams { 23 | 24 | return &GetPluginsParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewGetPluginsParamsWithTimeout creates a new GetPluginsParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewGetPluginsParamsWithTimeout(timeout time.Duration) *GetPluginsParams { 33 | 34 | return &GetPluginsParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewGetPluginsParamsWithContext creates a new GetPluginsParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewGetPluginsParamsWithContext(ctx context.Context) *GetPluginsParams { 43 | 44 | return &GetPluginsParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewGetPluginsParamsWithHTTPClient creates a new GetPluginsParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewGetPluginsParamsWithHTTPClient(client *http.Client) *GetPluginsParams { 53 | 54 | return &GetPluginsParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*GetPluginsParams contains all the parameters to send to the API endpoint 60 | for the get plugins operation typically these are written to a http.Request 61 | */ 62 | type GetPluginsParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the get plugins params 69 | func (o *GetPluginsParams) WithTimeout(timeout time.Duration) *GetPluginsParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the get plugins params 75 | func (o *GetPluginsParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the get plugins params 80 | func (o *GetPluginsParams) WithContext(ctx context.Context) *GetPluginsParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the get plugins params 86 | func (o *GetPluginsParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the get plugins params 91 | func (o *GetPluginsParams) WithHTTPClient(client *http.Client) *GetPluginsParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the get plugins params 97 | func (o *GetPluginsParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *GetPluginsParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/plugin/update_plugin_config_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package plugin 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewUpdatePluginConfigParams creates a new UpdatePluginConfigParams object 22 | // with the default values initialized. 23 | func NewUpdatePluginConfigParams() *UpdatePluginConfigParams { 24 | var () 25 | return &UpdatePluginConfigParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewUpdatePluginConfigParamsWithTimeout creates a new UpdatePluginConfigParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewUpdatePluginConfigParamsWithTimeout(timeout time.Duration) *UpdatePluginConfigParams { 34 | var () 35 | return &UpdatePluginConfigParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewUpdatePluginConfigParamsWithContext creates a new UpdatePluginConfigParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewUpdatePluginConfigParamsWithContext(ctx context.Context) *UpdatePluginConfigParams { 44 | var () 45 | return &UpdatePluginConfigParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewUpdatePluginConfigParamsWithHTTPClient creates a new UpdatePluginConfigParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewUpdatePluginConfigParamsWithHTTPClient(client *http.Client) *UpdatePluginConfigParams { 54 | var () 55 | return &UpdatePluginConfigParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*UpdatePluginConfigParams contains all the parameters to send to the API endpoint 61 | for the update plugin config operation typically these are written to a http.Request 62 | */ 63 | type UpdatePluginConfigParams struct { 64 | 65 | /*ID 66 | the plugin id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the update plugin config params 77 | func (o *UpdatePluginConfigParams) WithTimeout(timeout time.Duration) *UpdatePluginConfigParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the update plugin config params 83 | func (o *UpdatePluginConfigParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the update plugin config params 88 | func (o *UpdatePluginConfigParams) WithContext(ctx context.Context) *UpdatePluginConfigParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the update plugin config params 94 | func (o *UpdatePluginConfigParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the update plugin config params 99 | func (o *UpdatePluginConfigParams) WithHTTPClient(client *http.Client) *UpdatePluginConfigParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the update plugin config params 105 | func (o *UpdatePluginConfigParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the update plugin config params 110 | func (o *UpdatePluginConfigParams) WithID(id int64) *UpdatePluginConfigParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the update plugin config params 116 | func (o *UpdatePluginConfigParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *UpdatePluginConfigParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/user/create_user_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | 19 | models "github.com/gotify/go-api-client/v2/models" 20 | ) 21 | 22 | // NewCreateUserParams creates a new CreateUserParams object 23 | // with the default values initialized. 24 | func NewCreateUserParams() *CreateUserParams { 25 | var () 26 | return &CreateUserParams{ 27 | 28 | timeout: cr.DefaultTimeout, 29 | } 30 | } 31 | 32 | // NewCreateUserParamsWithTimeout creates a new CreateUserParams object 33 | // with the default values initialized, and the ability to set a timeout on a request 34 | func NewCreateUserParamsWithTimeout(timeout time.Duration) *CreateUserParams { 35 | var () 36 | return &CreateUserParams{ 37 | 38 | timeout: timeout, 39 | } 40 | } 41 | 42 | // NewCreateUserParamsWithContext creates a new CreateUserParams object 43 | // with the default values initialized, and the ability to set a context for a request 44 | func NewCreateUserParamsWithContext(ctx context.Context) *CreateUserParams { 45 | var () 46 | return &CreateUserParams{ 47 | 48 | Context: ctx, 49 | } 50 | } 51 | 52 | // NewCreateUserParamsWithHTTPClient creates a new CreateUserParams object 53 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 54 | func NewCreateUserParamsWithHTTPClient(client *http.Client) *CreateUserParams { 55 | var () 56 | return &CreateUserParams{ 57 | HTTPClient: client, 58 | } 59 | } 60 | 61 | /*CreateUserParams contains all the parameters to send to the API endpoint 62 | for the create user operation typically these are written to a http.Request 63 | */ 64 | type CreateUserParams struct { 65 | 66 | /*Body 67 | the user to add 68 | 69 | */ 70 | Body *models.UserExternalWithPass 71 | 72 | timeout time.Duration 73 | Context context.Context 74 | HTTPClient *http.Client 75 | } 76 | 77 | // WithTimeout adds the timeout to the create user params 78 | func (o *CreateUserParams) WithTimeout(timeout time.Duration) *CreateUserParams { 79 | o.SetTimeout(timeout) 80 | return o 81 | } 82 | 83 | // SetTimeout adds the timeout to the create user params 84 | func (o *CreateUserParams) SetTimeout(timeout time.Duration) { 85 | o.timeout = timeout 86 | } 87 | 88 | // WithContext adds the context to the create user params 89 | func (o *CreateUserParams) WithContext(ctx context.Context) *CreateUserParams { 90 | o.SetContext(ctx) 91 | return o 92 | } 93 | 94 | // SetContext adds the context to the create user params 95 | func (o *CreateUserParams) SetContext(ctx context.Context) { 96 | o.Context = ctx 97 | } 98 | 99 | // WithHTTPClient adds the HTTPClient to the create user params 100 | func (o *CreateUserParams) WithHTTPClient(client *http.Client) *CreateUserParams { 101 | o.SetHTTPClient(client) 102 | return o 103 | } 104 | 105 | // SetHTTPClient adds the HTTPClient to the create user params 106 | func (o *CreateUserParams) SetHTTPClient(client *http.Client) { 107 | o.HTTPClient = client 108 | } 109 | 110 | // WithBody adds the body to the create user params 111 | func (o *CreateUserParams) WithBody(body *models.UserExternalWithPass) *CreateUserParams { 112 | o.SetBody(body) 113 | return o 114 | } 115 | 116 | // SetBody adds the body to the create user params 117 | func (o *CreateUserParams) SetBody(body *models.UserExternalWithPass) { 118 | o.Body = body 119 | } 120 | 121 | // WriteToRequest writes these params to a swagger request 122 | func (o *CreateUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 123 | 124 | if err := r.SetTimeout(o.timeout); err != nil { 125 | return err 126 | } 127 | var res []error 128 | 129 | if o.Body != nil { 130 | if err := r.SetBodyParam(o.Body); err != nil { 131 | return err 132 | } 133 | } 134 | 135 | if len(res) > 0 { 136 | return errors.CompositeValidationError(res...) 137 | } 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /client/user/create_user_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // CreateUserReader is a Reader for the CreateUser structure. 20 | type CreateUserReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *CreateUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewCreateUserOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewCreateUserBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewCreateUserUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewCreateUserForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | default: 57 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 | } 59 | } 60 | 61 | // NewCreateUserOK creates a CreateUserOK with default headers values 62 | func NewCreateUserOK() *CreateUserOK { 63 | return &CreateUserOK{} 64 | } 65 | 66 | /*CreateUserOK handles this case with default header values. 67 | 68 | Ok 69 | */ 70 | type CreateUserOK struct { 71 | Payload *models.UserExternal 72 | } 73 | 74 | func (o *CreateUserOK) Error() string { 75 | return fmt.Sprintf("[POST /user][%d] createUserOK %+v", 200, o.Payload) 76 | } 77 | 78 | func (o *CreateUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 79 | 80 | o.Payload = new(models.UserExternal) 81 | 82 | // response payload 83 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 84 | return err 85 | } 86 | 87 | return nil 88 | } 89 | 90 | // NewCreateUserBadRequest creates a CreateUserBadRequest with default headers values 91 | func NewCreateUserBadRequest() *CreateUserBadRequest { 92 | return &CreateUserBadRequest{} 93 | } 94 | 95 | /*CreateUserBadRequest handles this case with default header values. 96 | 97 | Bad Request 98 | */ 99 | type CreateUserBadRequest struct { 100 | Payload *models.Error 101 | } 102 | 103 | func (o *CreateUserBadRequest) Error() string { 104 | return fmt.Sprintf("[POST /user][%d] createUserBadRequest %+v", 400, o.Payload) 105 | } 106 | 107 | func (o *CreateUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 108 | 109 | o.Payload = new(models.Error) 110 | 111 | // response payload 112 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 113 | return err 114 | } 115 | 116 | return nil 117 | } 118 | 119 | // NewCreateUserUnauthorized creates a CreateUserUnauthorized with default headers values 120 | func NewCreateUserUnauthorized() *CreateUserUnauthorized { 121 | return &CreateUserUnauthorized{} 122 | } 123 | 124 | /*CreateUserUnauthorized handles this case with default header values. 125 | 126 | Unauthorized 127 | */ 128 | type CreateUserUnauthorized struct { 129 | Payload *models.Error 130 | } 131 | 132 | func (o *CreateUserUnauthorized) Error() string { 133 | return fmt.Sprintf("[POST /user][%d] createUserUnauthorized %+v", 401, o.Payload) 134 | } 135 | 136 | func (o *CreateUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 137 | 138 | o.Payload = new(models.Error) 139 | 140 | // response payload 141 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 142 | return err 143 | } 144 | 145 | return nil 146 | } 147 | 148 | // NewCreateUserForbidden creates a CreateUserForbidden with default headers values 149 | func NewCreateUserForbidden() *CreateUserForbidden { 150 | return &CreateUserForbidden{} 151 | } 152 | 153 | /*CreateUserForbidden handles this case with default header values. 154 | 155 | Forbidden 156 | */ 157 | type CreateUserForbidden struct { 158 | Payload *models.Error 159 | } 160 | 161 | func (o *CreateUserForbidden) Error() string { 162 | return fmt.Sprintf("[POST /user][%d] createUserForbidden %+v", 403, o.Payload) 163 | } 164 | 165 | func (o *CreateUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 166 | 167 | o.Payload = new(models.Error) 168 | 169 | // response payload 170 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 171 | return err 172 | } 173 | 174 | return nil 175 | } 176 | -------------------------------------------------------------------------------- /client/user/current_user_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewCurrentUserParams creates a new CurrentUserParams object 21 | // with the default values initialized. 22 | func NewCurrentUserParams() *CurrentUserParams { 23 | 24 | return &CurrentUserParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewCurrentUserParamsWithTimeout creates a new CurrentUserParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewCurrentUserParamsWithTimeout(timeout time.Duration) *CurrentUserParams { 33 | 34 | return &CurrentUserParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewCurrentUserParamsWithContext creates a new CurrentUserParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewCurrentUserParamsWithContext(ctx context.Context) *CurrentUserParams { 43 | 44 | return &CurrentUserParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewCurrentUserParamsWithHTTPClient creates a new CurrentUserParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewCurrentUserParamsWithHTTPClient(client *http.Client) *CurrentUserParams { 53 | 54 | return &CurrentUserParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*CurrentUserParams contains all the parameters to send to the API endpoint 60 | for the current user operation typically these are written to a http.Request 61 | */ 62 | type CurrentUserParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the current user params 69 | func (o *CurrentUserParams) WithTimeout(timeout time.Duration) *CurrentUserParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the current user params 75 | func (o *CurrentUserParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the current user params 80 | func (o *CurrentUserParams) WithContext(ctx context.Context) *CurrentUserParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the current user params 86 | func (o *CurrentUserParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the current user params 91 | func (o *CurrentUserParams) WithHTTPClient(client *http.Client) *CurrentUserParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the current user params 97 | func (o *CurrentUserParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *CurrentUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/user/current_user_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // CurrentUserReader is a Reader for the CurrentUser structure. 20 | type CurrentUserReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *CurrentUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewCurrentUserOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 401: 36 | result := NewCurrentUserUnauthorized() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 403: 43 | result := NewCurrentUserForbidden() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | default: 50 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 51 | } 52 | } 53 | 54 | // NewCurrentUserOK creates a CurrentUserOK with default headers values 55 | func NewCurrentUserOK() *CurrentUserOK { 56 | return &CurrentUserOK{} 57 | } 58 | 59 | /*CurrentUserOK handles this case with default header values. 60 | 61 | Ok 62 | */ 63 | type CurrentUserOK struct { 64 | Payload *models.UserExternal 65 | } 66 | 67 | func (o *CurrentUserOK) Error() string { 68 | return fmt.Sprintf("[GET /current/user][%d] currentUserOK %+v", 200, o.Payload) 69 | } 70 | 71 | func (o *CurrentUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 72 | 73 | o.Payload = new(models.UserExternal) 74 | 75 | // response payload 76 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 77 | return err 78 | } 79 | 80 | return nil 81 | } 82 | 83 | // NewCurrentUserUnauthorized creates a CurrentUserUnauthorized with default headers values 84 | func NewCurrentUserUnauthorized() *CurrentUserUnauthorized { 85 | return &CurrentUserUnauthorized{} 86 | } 87 | 88 | /*CurrentUserUnauthorized handles this case with default header values. 89 | 90 | Unauthorized 91 | */ 92 | type CurrentUserUnauthorized struct { 93 | Payload *models.Error 94 | } 95 | 96 | func (o *CurrentUserUnauthorized) Error() string { 97 | return fmt.Sprintf("[GET /current/user][%d] currentUserUnauthorized %+v", 401, o.Payload) 98 | } 99 | 100 | func (o *CurrentUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 101 | 102 | o.Payload = new(models.Error) 103 | 104 | // response payload 105 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 106 | return err 107 | } 108 | 109 | return nil 110 | } 111 | 112 | // NewCurrentUserForbidden creates a CurrentUserForbidden with default headers values 113 | func NewCurrentUserForbidden() *CurrentUserForbidden { 114 | return &CurrentUserForbidden{} 115 | } 116 | 117 | /*CurrentUserForbidden handles this case with default header values. 118 | 119 | Forbidden 120 | */ 121 | type CurrentUserForbidden struct { 122 | Payload *models.Error 123 | } 124 | 125 | func (o *CurrentUserForbidden) Error() string { 126 | return fmt.Sprintf("[GET /current/user][%d] currentUserForbidden %+v", 403, o.Payload) 127 | } 128 | 129 | func (o *CurrentUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 130 | 131 | o.Payload = new(models.Error) 132 | 133 | // response payload 134 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 135 | return err 136 | } 137 | 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /client/user/delete_user_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewDeleteUserParams creates a new DeleteUserParams object 22 | // with the default values initialized. 23 | func NewDeleteUserParams() *DeleteUserParams { 24 | var () 25 | return &DeleteUserParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewDeleteUserParamsWithTimeout creates a new DeleteUserParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewDeleteUserParamsWithTimeout(timeout time.Duration) *DeleteUserParams { 34 | var () 35 | return &DeleteUserParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewDeleteUserParamsWithContext creates a new DeleteUserParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewDeleteUserParamsWithContext(ctx context.Context) *DeleteUserParams { 44 | var () 45 | return &DeleteUserParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewDeleteUserParamsWithHTTPClient creates a new DeleteUserParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewDeleteUserParamsWithHTTPClient(client *http.Client) *DeleteUserParams { 54 | var () 55 | return &DeleteUserParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*DeleteUserParams contains all the parameters to send to the API endpoint 61 | for the delete user operation typically these are written to a http.Request 62 | */ 63 | type DeleteUserParams struct { 64 | 65 | /*ID 66 | the user id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the delete user params 77 | func (o *DeleteUserParams) WithTimeout(timeout time.Duration) *DeleteUserParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the delete user params 83 | func (o *DeleteUserParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the delete user params 88 | func (o *DeleteUserParams) WithContext(ctx context.Context) *DeleteUserParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the delete user params 94 | func (o *DeleteUserParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the delete user params 99 | func (o *DeleteUserParams) WithHTTPClient(client *http.Client) *DeleteUserParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the delete user params 105 | func (o *DeleteUserParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the delete user params 110 | func (o *DeleteUserParams) WithID(id int64) *DeleteUserParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the delete user params 116 | func (o *DeleteUserParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *DeleteUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/user/delete_user_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // DeleteUserReader is a Reader for the DeleteUser structure. 20 | type DeleteUserReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *DeleteUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewDeleteUserOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewDeleteUserBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewDeleteUserUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewDeleteUserForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | case 404: 57 | result := NewDeleteUserNotFound() 58 | if err := result.readResponse(response, consumer, o.formats); err != nil { 59 | return nil, err 60 | } 61 | return nil, result 62 | 63 | default: 64 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 65 | } 66 | } 67 | 68 | // NewDeleteUserOK creates a DeleteUserOK with default headers values 69 | func NewDeleteUserOK() *DeleteUserOK { 70 | return &DeleteUserOK{} 71 | } 72 | 73 | /*DeleteUserOK handles this case with default header values. 74 | 75 | Ok 76 | */ 77 | type DeleteUserOK struct { 78 | } 79 | 80 | func (o *DeleteUserOK) Error() string { 81 | return fmt.Sprintf("[DELETE /user/{id}][%d] deleteUserOK ", 200) 82 | } 83 | 84 | func (o *DeleteUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 85 | 86 | return nil 87 | } 88 | 89 | // NewDeleteUserBadRequest creates a DeleteUserBadRequest with default headers values 90 | func NewDeleteUserBadRequest() *DeleteUserBadRequest { 91 | return &DeleteUserBadRequest{} 92 | } 93 | 94 | /*DeleteUserBadRequest handles this case with default header values. 95 | 96 | Bad Request 97 | */ 98 | type DeleteUserBadRequest struct { 99 | Payload *models.Error 100 | } 101 | 102 | func (o *DeleteUserBadRequest) Error() string { 103 | return fmt.Sprintf("[DELETE /user/{id}][%d] deleteUserBadRequest %+v", 400, o.Payload) 104 | } 105 | 106 | func (o *DeleteUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 107 | 108 | o.Payload = new(models.Error) 109 | 110 | // response payload 111 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 112 | return err 113 | } 114 | 115 | return nil 116 | } 117 | 118 | // NewDeleteUserUnauthorized creates a DeleteUserUnauthorized with default headers values 119 | func NewDeleteUserUnauthorized() *DeleteUserUnauthorized { 120 | return &DeleteUserUnauthorized{} 121 | } 122 | 123 | /*DeleteUserUnauthorized handles this case with default header values. 124 | 125 | Unauthorized 126 | */ 127 | type DeleteUserUnauthorized struct { 128 | Payload *models.Error 129 | } 130 | 131 | func (o *DeleteUserUnauthorized) Error() string { 132 | return fmt.Sprintf("[DELETE /user/{id}][%d] deleteUserUnauthorized %+v", 401, o.Payload) 133 | } 134 | 135 | func (o *DeleteUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 136 | 137 | o.Payload = new(models.Error) 138 | 139 | // response payload 140 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 141 | return err 142 | } 143 | 144 | return nil 145 | } 146 | 147 | // NewDeleteUserForbidden creates a DeleteUserForbidden with default headers values 148 | func NewDeleteUserForbidden() *DeleteUserForbidden { 149 | return &DeleteUserForbidden{} 150 | } 151 | 152 | /*DeleteUserForbidden handles this case with default header values. 153 | 154 | Forbidden 155 | */ 156 | type DeleteUserForbidden struct { 157 | Payload *models.Error 158 | } 159 | 160 | func (o *DeleteUserForbidden) Error() string { 161 | return fmt.Sprintf("[DELETE /user/{id}][%d] deleteUserForbidden %+v", 403, o.Payload) 162 | } 163 | 164 | func (o *DeleteUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 165 | 166 | o.Payload = new(models.Error) 167 | 168 | // response payload 169 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 170 | return err 171 | } 172 | 173 | return nil 174 | } 175 | 176 | // NewDeleteUserNotFound creates a DeleteUserNotFound with default headers values 177 | func NewDeleteUserNotFound() *DeleteUserNotFound { 178 | return &DeleteUserNotFound{} 179 | } 180 | 181 | /*DeleteUserNotFound handles this case with default header values. 182 | 183 | Not Found 184 | */ 185 | type DeleteUserNotFound struct { 186 | Payload *models.Error 187 | } 188 | 189 | func (o *DeleteUserNotFound) Error() string { 190 | return fmt.Sprintf("[DELETE /user/{id}][%d] deleteUserNotFound %+v", 404, o.Payload) 191 | } 192 | 193 | func (o *DeleteUserNotFound) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 194 | 195 | o.Payload = new(models.Error) 196 | 197 | // response payload 198 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 199 | return err 200 | } 201 | 202 | return nil 203 | } 204 | -------------------------------------------------------------------------------- /client/user/get_user_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | ) 20 | 21 | // NewGetUserParams creates a new GetUserParams object 22 | // with the default values initialized. 23 | func NewGetUserParams() *GetUserParams { 24 | var () 25 | return &GetUserParams{ 26 | 27 | timeout: cr.DefaultTimeout, 28 | } 29 | } 30 | 31 | // NewGetUserParamsWithTimeout creates a new GetUserParams object 32 | // with the default values initialized, and the ability to set a timeout on a request 33 | func NewGetUserParamsWithTimeout(timeout time.Duration) *GetUserParams { 34 | var () 35 | return &GetUserParams{ 36 | 37 | timeout: timeout, 38 | } 39 | } 40 | 41 | // NewGetUserParamsWithContext creates a new GetUserParams object 42 | // with the default values initialized, and the ability to set a context for a request 43 | func NewGetUserParamsWithContext(ctx context.Context) *GetUserParams { 44 | var () 45 | return &GetUserParams{ 46 | 47 | Context: ctx, 48 | } 49 | } 50 | 51 | // NewGetUserParamsWithHTTPClient creates a new GetUserParams object 52 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 53 | func NewGetUserParamsWithHTTPClient(client *http.Client) *GetUserParams { 54 | var () 55 | return &GetUserParams{ 56 | HTTPClient: client, 57 | } 58 | } 59 | 60 | /*GetUserParams contains all the parameters to send to the API endpoint 61 | for the get user operation typically these are written to a http.Request 62 | */ 63 | type GetUserParams struct { 64 | 65 | /*ID 66 | the user id 67 | 68 | */ 69 | ID int64 70 | 71 | timeout time.Duration 72 | Context context.Context 73 | HTTPClient *http.Client 74 | } 75 | 76 | // WithTimeout adds the timeout to the get user params 77 | func (o *GetUserParams) WithTimeout(timeout time.Duration) *GetUserParams { 78 | o.SetTimeout(timeout) 79 | return o 80 | } 81 | 82 | // SetTimeout adds the timeout to the get user params 83 | func (o *GetUserParams) SetTimeout(timeout time.Duration) { 84 | o.timeout = timeout 85 | } 86 | 87 | // WithContext adds the context to the get user params 88 | func (o *GetUserParams) WithContext(ctx context.Context) *GetUserParams { 89 | o.SetContext(ctx) 90 | return o 91 | } 92 | 93 | // SetContext adds the context to the get user params 94 | func (o *GetUserParams) SetContext(ctx context.Context) { 95 | o.Context = ctx 96 | } 97 | 98 | // WithHTTPClient adds the HTTPClient to the get user params 99 | func (o *GetUserParams) WithHTTPClient(client *http.Client) *GetUserParams { 100 | o.SetHTTPClient(client) 101 | return o 102 | } 103 | 104 | // SetHTTPClient adds the HTTPClient to the get user params 105 | func (o *GetUserParams) SetHTTPClient(client *http.Client) { 106 | o.HTTPClient = client 107 | } 108 | 109 | // WithID adds the id to the get user params 110 | func (o *GetUserParams) WithID(id int64) *GetUserParams { 111 | o.SetID(id) 112 | return o 113 | } 114 | 115 | // SetID adds the id to the get user params 116 | func (o *GetUserParams) SetID(id int64) { 117 | o.ID = id 118 | } 119 | 120 | // WriteToRequest writes these params to a swagger request 121 | func (o *GetUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 122 | 123 | if err := r.SetTimeout(o.timeout); err != nil { 124 | return err 125 | } 126 | var res []error 127 | 128 | // path param id 129 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 130 | return err 131 | } 132 | 133 | if len(res) > 0 { 134 | return errors.CompositeValidationError(res...) 135 | } 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/user/get_users_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewGetUsersParams creates a new GetUsersParams object 21 | // with the default values initialized. 22 | func NewGetUsersParams() *GetUsersParams { 23 | 24 | return &GetUsersParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewGetUsersParamsWithTimeout creates a new GetUsersParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewGetUsersParamsWithTimeout(timeout time.Duration) *GetUsersParams { 33 | 34 | return &GetUsersParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewGetUsersParamsWithContext creates a new GetUsersParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewGetUsersParamsWithContext(ctx context.Context) *GetUsersParams { 43 | 44 | return &GetUsersParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewGetUsersParamsWithHTTPClient creates a new GetUsersParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewGetUsersParamsWithHTTPClient(client *http.Client) *GetUsersParams { 53 | 54 | return &GetUsersParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*GetUsersParams contains all the parameters to send to the API endpoint 60 | for the get users operation typically these are written to a http.Request 61 | */ 62 | type GetUsersParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the get users params 69 | func (o *GetUsersParams) WithTimeout(timeout time.Duration) *GetUsersParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the get users params 75 | func (o *GetUsersParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the get users params 80 | func (o *GetUsersParams) WithContext(ctx context.Context) *GetUsersParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the get users params 86 | func (o *GetUsersParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the get users params 91 | func (o *GetUsersParams) WithHTTPClient(client *http.Client) *GetUsersParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the get users params 97 | func (o *GetUsersParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *GetUsersParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/user/get_users_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // GetUsersReader is a Reader for the GetUsers structure. 20 | type GetUsersReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *GetUsersReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewGetUsersOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 401: 36 | result := NewGetUsersUnauthorized() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 403: 43 | result := NewGetUsersForbidden() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | default: 50 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 51 | } 52 | } 53 | 54 | // NewGetUsersOK creates a GetUsersOK with default headers values 55 | func NewGetUsersOK() *GetUsersOK { 56 | return &GetUsersOK{} 57 | } 58 | 59 | /*GetUsersOK handles this case with default header values. 60 | 61 | Ok 62 | */ 63 | type GetUsersOK struct { 64 | Payload []*models.UserExternal 65 | } 66 | 67 | func (o *GetUsersOK) Error() string { 68 | return fmt.Sprintf("[GET /user][%d] getUsersOK %+v", 200, o.Payload) 69 | } 70 | 71 | func (o *GetUsersOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 72 | 73 | // response payload 74 | if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { 75 | return err 76 | } 77 | 78 | return nil 79 | } 80 | 81 | // NewGetUsersUnauthorized creates a GetUsersUnauthorized with default headers values 82 | func NewGetUsersUnauthorized() *GetUsersUnauthorized { 83 | return &GetUsersUnauthorized{} 84 | } 85 | 86 | /*GetUsersUnauthorized handles this case with default header values. 87 | 88 | Unauthorized 89 | */ 90 | type GetUsersUnauthorized struct { 91 | Payload *models.Error 92 | } 93 | 94 | func (o *GetUsersUnauthorized) Error() string { 95 | return fmt.Sprintf("[GET /user][%d] getUsersUnauthorized %+v", 401, o.Payload) 96 | } 97 | 98 | func (o *GetUsersUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 99 | 100 | o.Payload = new(models.Error) 101 | 102 | // response payload 103 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 104 | return err 105 | } 106 | 107 | return nil 108 | } 109 | 110 | // NewGetUsersForbidden creates a GetUsersForbidden with default headers values 111 | func NewGetUsersForbidden() *GetUsersForbidden { 112 | return &GetUsersForbidden{} 113 | } 114 | 115 | /*GetUsersForbidden handles this case with default header values. 116 | 117 | Forbidden 118 | */ 119 | type GetUsersForbidden struct { 120 | Payload *models.Error 121 | } 122 | 123 | func (o *GetUsersForbidden) Error() string { 124 | return fmt.Sprintf("[GET /user][%d] getUsersForbidden %+v", 403, o.Payload) 125 | } 126 | 127 | func (o *GetUsersForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 128 | 129 | o.Payload = new(models.Error) 130 | 131 | // response payload 132 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 133 | return err 134 | } 135 | 136 | return nil 137 | } 138 | -------------------------------------------------------------------------------- /client/user/update_current_user_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | 19 | models "github.com/gotify/go-api-client/v2/models" 20 | ) 21 | 22 | // NewUpdateCurrentUserParams creates a new UpdateCurrentUserParams object 23 | // with the default values initialized. 24 | func NewUpdateCurrentUserParams() *UpdateCurrentUserParams { 25 | var () 26 | return &UpdateCurrentUserParams{ 27 | 28 | timeout: cr.DefaultTimeout, 29 | } 30 | } 31 | 32 | // NewUpdateCurrentUserParamsWithTimeout creates a new UpdateCurrentUserParams object 33 | // with the default values initialized, and the ability to set a timeout on a request 34 | func NewUpdateCurrentUserParamsWithTimeout(timeout time.Duration) *UpdateCurrentUserParams { 35 | var () 36 | return &UpdateCurrentUserParams{ 37 | 38 | timeout: timeout, 39 | } 40 | } 41 | 42 | // NewUpdateCurrentUserParamsWithContext creates a new UpdateCurrentUserParams object 43 | // with the default values initialized, and the ability to set a context for a request 44 | func NewUpdateCurrentUserParamsWithContext(ctx context.Context) *UpdateCurrentUserParams { 45 | var () 46 | return &UpdateCurrentUserParams{ 47 | 48 | Context: ctx, 49 | } 50 | } 51 | 52 | // NewUpdateCurrentUserParamsWithHTTPClient creates a new UpdateCurrentUserParams object 53 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 54 | func NewUpdateCurrentUserParamsWithHTTPClient(client *http.Client) *UpdateCurrentUserParams { 55 | var () 56 | return &UpdateCurrentUserParams{ 57 | HTTPClient: client, 58 | } 59 | } 60 | 61 | /*UpdateCurrentUserParams contains all the parameters to send to the API endpoint 62 | for the update current user operation typically these are written to a http.Request 63 | */ 64 | type UpdateCurrentUserParams struct { 65 | 66 | /*Body 67 | the user 68 | 69 | */ 70 | Body *models.UserExternalPass 71 | 72 | timeout time.Duration 73 | Context context.Context 74 | HTTPClient *http.Client 75 | } 76 | 77 | // WithTimeout adds the timeout to the update current user params 78 | func (o *UpdateCurrentUserParams) WithTimeout(timeout time.Duration) *UpdateCurrentUserParams { 79 | o.SetTimeout(timeout) 80 | return o 81 | } 82 | 83 | // SetTimeout adds the timeout to the update current user params 84 | func (o *UpdateCurrentUserParams) SetTimeout(timeout time.Duration) { 85 | o.timeout = timeout 86 | } 87 | 88 | // WithContext adds the context to the update current user params 89 | func (o *UpdateCurrentUserParams) WithContext(ctx context.Context) *UpdateCurrentUserParams { 90 | o.SetContext(ctx) 91 | return o 92 | } 93 | 94 | // SetContext adds the context to the update current user params 95 | func (o *UpdateCurrentUserParams) SetContext(ctx context.Context) { 96 | o.Context = ctx 97 | } 98 | 99 | // WithHTTPClient adds the HTTPClient to the update current user params 100 | func (o *UpdateCurrentUserParams) WithHTTPClient(client *http.Client) *UpdateCurrentUserParams { 101 | o.SetHTTPClient(client) 102 | return o 103 | } 104 | 105 | // SetHTTPClient adds the HTTPClient to the update current user params 106 | func (o *UpdateCurrentUserParams) SetHTTPClient(client *http.Client) { 107 | o.HTTPClient = client 108 | } 109 | 110 | // WithBody adds the body to the update current user params 111 | func (o *UpdateCurrentUserParams) WithBody(body *models.UserExternalPass) *UpdateCurrentUserParams { 112 | o.SetBody(body) 113 | return o 114 | } 115 | 116 | // SetBody adds the body to the update current user params 117 | func (o *UpdateCurrentUserParams) SetBody(body *models.UserExternalPass) { 118 | o.Body = body 119 | } 120 | 121 | // WriteToRequest writes these params to a swagger request 122 | func (o *UpdateCurrentUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 123 | 124 | if err := r.SetTimeout(o.timeout); err != nil { 125 | return err 126 | } 127 | var res []error 128 | 129 | if o.Body != nil { 130 | if err := r.SetBodyParam(o.Body); err != nil { 131 | return err 132 | } 133 | } 134 | 135 | if len(res) > 0 { 136 | return errors.CompositeValidationError(res...) 137 | } 138 | return nil 139 | } 140 | -------------------------------------------------------------------------------- /client/user/update_current_user_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // UpdateCurrentUserReader is a Reader for the UpdateCurrentUser structure. 20 | type UpdateCurrentUserReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *UpdateCurrentUserReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewUpdateCurrentUserOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | case 400: 36 | result := NewUpdateCurrentUserBadRequest() 37 | if err := result.readResponse(response, consumer, o.formats); err != nil { 38 | return nil, err 39 | } 40 | return nil, result 41 | 42 | case 401: 43 | result := NewUpdateCurrentUserUnauthorized() 44 | if err := result.readResponse(response, consumer, o.formats); err != nil { 45 | return nil, err 46 | } 47 | return nil, result 48 | 49 | case 403: 50 | result := NewUpdateCurrentUserForbidden() 51 | if err := result.readResponse(response, consumer, o.formats); err != nil { 52 | return nil, err 53 | } 54 | return nil, result 55 | 56 | default: 57 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 58 | } 59 | } 60 | 61 | // NewUpdateCurrentUserOK creates a UpdateCurrentUserOK with default headers values 62 | func NewUpdateCurrentUserOK() *UpdateCurrentUserOK { 63 | return &UpdateCurrentUserOK{} 64 | } 65 | 66 | /*UpdateCurrentUserOK handles this case with default header values. 67 | 68 | Ok 69 | */ 70 | type UpdateCurrentUserOK struct { 71 | } 72 | 73 | func (o *UpdateCurrentUserOK) Error() string { 74 | return fmt.Sprintf("[POST /current/user/password][%d] updateCurrentUserOK ", 200) 75 | } 76 | 77 | func (o *UpdateCurrentUserOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 78 | 79 | return nil 80 | } 81 | 82 | // NewUpdateCurrentUserBadRequest creates a UpdateCurrentUserBadRequest with default headers values 83 | func NewUpdateCurrentUserBadRequest() *UpdateCurrentUserBadRequest { 84 | return &UpdateCurrentUserBadRequest{} 85 | } 86 | 87 | /*UpdateCurrentUserBadRequest handles this case with default header values. 88 | 89 | Bad Request 90 | */ 91 | type UpdateCurrentUserBadRequest struct { 92 | Payload *models.Error 93 | } 94 | 95 | func (o *UpdateCurrentUserBadRequest) Error() string { 96 | return fmt.Sprintf("[POST /current/user/password][%d] updateCurrentUserBadRequest %+v", 400, o.Payload) 97 | } 98 | 99 | func (o *UpdateCurrentUserBadRequest) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 100 | 101 | o.Payload = new(models.Error) 102 | 103 | // response payload 104 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 105 | return err 106 | } 107 | 108 | return nil 109 | } 110 | 111 | // NewUpdateCurrentUserUnauthorized creates a UpdateCurrentUserUnauthorized with default headers values 112 | func NewUpdateCurrentUserUnauthorized() *UpdateCurrentUserUnauthorized { 113 | return &UpdateCurrentUserUnauthorized{} 114 | } 115 | 116 | /*UpdateCurrentUserUnauthorized handles this case with default header values. 117 | 118 | Unauthorized 119 | */ 120 | type UpdateCurrentUserUnauthorized struct { 121 | Payload *models.Error 122 | } 123 | 124 | func (o *UpdateCurrentUserUnauthorized) Error() string { 125 | return fmt.Sprintf("[POST /current/user/password][%d] updateCurrentUserUnauthorized %+v", 401, o.Payload) 126 | } 127 | 128 | func (o *UpdateCurrentUserUnauthorized) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 129 | 130 | o.Payload = new(models.Error) 131 | 132 | // response payload 133 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 134 | return err 135 | } 136 | 137 | return nil 138 | } 139 | 140 | // NewUpdateCurrentUserForbidden creates a UpdateCurrentUserForbidden with default headers values 141 | func NewUpdateCurrentUserForbidden() *UpdateCurrentUserForbidden { 142 | return &UpdateCurrentUserForbidden{} 143 | } 144 | 145 | /*UpdateCurrentUserForbidden handles this case with default header values. 146 | 147 | Forbidden 148 | */ 149 | type UpdateCurrentUserForbidden struct { 150 | Payload *models.Error 151 | } 152 | 153 | func (o *UpdateCurrentUserForbidden) Error() string { 154 | return fmt.Sprintf("[POST /current/user/password][%d] updateCurrentUserForbidden %+v", 403, o.Payload) 155 | } 156 | 157 | func (o *UpdateCurrentUserForbidden) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 158 | 159 | o.Payload = new(models.Error) 160 | 161 | // response payload 162 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 163 | return err 164 | } 165 | 166 | return nil 167 | } 168 | -------------------------------------------------------------------------------- /client/user/update_user_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package user 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | "github.com/go-openapi/swag" 17 | 18 | strfmt "github.com/go-openapi/strfmt" 19 | 20 | models "github.com/gotify/go-api-client/v2/models" 21 | ) 22 | 23 | // NewUpdateUserParams creates a new UpdateUserParams object 24 | // with the default values initialized. 25 | func NewUpdateUserParams() *UpdateUserParams { 26 | var () 27 | return &UpdateUserParams{ 28 | 29 | timeout: cr.DefaultTimeout, 30 | } 31 | } 32 | 33 | // NewUpdateUserParamsWithTimeout creates a new UpdateUserParams object 34 | // with the default values initialized, and the ability to set a timeout on a request 35 | func NewUpdateUserParamsWithTimeout(timeout time.Duration) *UpdateUserParams { 36 | var () 37 | return &UpdateUserParams{ 38 | 39 | timeout: timeout, 40 | } 41 | } 42 | 43 | // NewUpdateUserParamsWithContext creates a new UpdateUserParams object 44 | // with the default values initialized, and the ability to set a context for a request 45 | func NewUpdateUserParamsWithContext(ctx context.Context) *UpdateUserParams { 46 | var () 47 | return &UpdateUserParams{ 48 | 49 | Context: ctx, 50 | } 51 | } 52 | 53 | // NewUpdateUserParamsWithHTTPClient creates a new UpdateUserParams object 54 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 55 | func NewUpdateUserParamsWithHTTPClient(client *http.Client) *UpdateUserParams { 56 | var () 57 | return &UpdateUserParams{ 58 | HTTPClient: client, 59 | } 60 | } 61 | 62 | /*UpdateUserParams contains all the parameters to send to the API endpoint 63 | for the update user operation typically these are written to a http.Request 64 | */ 65 | type UpdateUserParams struct { 66 | 67 | /*Body 68 | the updated user 69 | 70 | */ 71 | Body *models.UserExternalWithPass 72 | /*ID 73 | the user id 74 | 75 | */ 76 | ID int64 77 | 78 | timeout time.Duration 79 | Context context.Context 80 | HTTPClient *http.Client 81 | } 82 | 83 | // WithTimeout adds the timeout to the update user params 84 | func (o *UpdateUserParams) WithTimeout(timeout time.Duration) *UpdateUserParams { 85 | o.SetTimeout(timeout) 86 | return o 87 | } 88 | 89 | // SetTimeout adds the timeout to the update user params 90 | func (o *UpdateUserParams) SetTimeout(timeout time.Duration) { 91 | o.timeout = timeout 92 | } 93 | 94 | // WithContext adds the context to the update user params 95 | func (o *UpdateUserParams) WithContext(ctx context.Context) *UpdateUserParams { 96 | o.SetContext(ctx) 97 | return o 98 | } 99 | 100 | // SetContext adds the context to the update user params 101 | func (o *UpdateUserParams) SetContext(ctx context.Context) { 102 | o.Context = ctx 103 | } 104 | 105 | // WithHTTPClient adds the HTTPClient to the update user params 106 | func (o *UpdateUserParams) WithHTTPClient(client *http.Client) *UpdateUserParams { 107 | o.SetHTTPClient(client) 108 | return o 109 | } 110 | 111 | // SetHTTPClient adds the HTTPClient to the update user params 112 | func (o *UpdateUserParams) SetHTTPClient(client *http.Client) { 113 | o.HTTPClient = client 114 | } 115 | 116 | // WithBody adds the body to the update user params 117 | func (o *UpdateUserParams) WithBody(body *models.UserExternalWithPass) *UpdateUserParams { 118 | o.SetBody(body) 119 | return o 120 | } 121 | 122 | // SetBody adds the body to the update user params 123 | func (o *UpdateUserParams) SetBody(body *models.UserExternalWithPass) { 124 | o.Body = body 125 | } 126 | 127 | // WithID adds the id to the update user params 128 | func (o *UpdateUserParams) WithID(id int64) *UpdateUserParams { 129 | o.SetID(id) 130 | return o 131 | } 132 | 133 | // SetID adds the id to the update user params 134 | func (o *UpdateUserParams) SetID(id int64) { 135 | o.ID = id 136 | } 137 | 138 | // WriteToRequest writes these params to a swagger request 139 | func (o *UpdateUserParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 140 | 141 | if err := r.SetTimeout(o.timeout); err != nil { 142 | return err 143 | } 144 | var res []error 145 | 146 | if o.Body != nil { 147 | if err := r.SetBodyParam(o.Body); err != nil { 148 | return err 149 | } 150 | } 151 | 152 | // path param id 153 | if err := r.SetPathParam("id", swag.FormatInt64(o.ID)); err != nil { 154 | return err 155 | } 156 | 157 | if len(res) > 0 { 158 | return errors.CompositeValidationError(res...) 159 | } 160 | return nil 161 | } 162 | -------------------------------------------------------------------------------- /client/version/get_version_parameters.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package version 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "context" 10 | "net/http" 11 | "time" 12 | 13 | "github.com/go-openapi/errors" 14 | "github.com/go-openapi/runtime" 15 | cr "github.com/go-openapi/runtime/client" 16 | 17 | strfmt "github.com/go-openapi/strfmt" 18 | ) 19 | 20 | // NewGetVersionParams creates a new GetVersionParams object 21 | // with the default values initialized. 22 | func NewGetVersionParams() *GetVersionParams { 23 | 24 | return &GetVersionParams{ 25 | 26 | timeout: cr.DefaultTimeout, 27 | } 28 | } 29 | 30 | // NewGetVersionParamsWithTimeout creates a new GetVersionParams object 31 | // with the default values initialized, and the ability to set a timeout on a request 32 | func NewGetVersionParamsWithTimeout(timeout time.Duration) *GetVersionParams { 33 | 34 | return &GetVersionParams{ 35 | 36 | timeout: timeout, 37 | } 38 | } 39 | 40 | // NewGetVersionParamsWithContext creates a new GetVersionParams object 41 | // with the default values initialized, and the ability to set a context for a request 42 | func NewGetVersionParamsWithContext(ctx context.Context) *GetVersionParams { 43 | 44 | return &GetVersionParams{ 45 | 46 | Context: ctx, 47 | } 48 | } 49 | 50 | // NewGetVersionParamsWithHTTPClient creates a new GetVersionParams object 51 | // with the default values initialized, and the ability to set a custom HTTPClient for a request 52 | func NewGetVersionParamsWithHTTPClient(client *http.Client) *GetVersionParams { 53 | 54 | return &GetVersionParams{ 55 | HTTPClient: client, 56 | } 57 | } 58 | 59 | /*GetVersionParams contains all the parameters to send to the API endpoint 60 | for the get version operation typically these are written to a http.Request 61 | */ 62 | type GetVersionParams struct { 63 | timeout time.Duration 64 | Context context.Context 65 | HTTPClient *http.Client 66 | } 67 | 68 | // WithTimeout adds the timeout to the get version params 69 | func (o *GetVersionParams) WithTimeout(timeout time.Duration) *GetVersionParams { 70 | o.SetTimeout(timeout) 71 | return o 72 | } 73 | 74 | // SetTimeout adds the timeout to the get version params 75 | func (o *GetVersionParams) SetTimeout(timeout time.Duration) { 76 | o.timeout = timeout 77 | } 78 | 79 | // WithContext adds the context to the get version params 80 | func (o *GetVersionParams) WithContext(ctx context.Context) *GetVersionParams { 81 | o.SetContext(ctx) 82 | return o 83 | } 84 | 85 | // SetContext adds the context to the get version params 86 | func (o *GetVersionParams) SetContext(ctx context.Context) { 87 | o.Context = ctx 88 | } 89 | 90 | // WithHTTPClient adds the HTTPClient to the get version params 91 | func (o *GetVersionParams) WithHTTPClient(client *http.Client) *GetVersionParams { 92 | o.SetHTTPClient(client) 93 | return o 94 | } 95 | 96 | // SetHTTPClient adds the HTTPClient to the get version params 97 | func (o *GetVersionParams) SetHTTPClient(client *http.Client) { 98 | o.HTTPClient = client 99 | } 100 | 101 | // WriteToRequest writes these params to a swagger request 102 | func (o *GetVersionParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { 103 | 104 | if err := r.SetTimeout(o.timeout); err != nil { 105 | return err 106 | } 107 | var res []error 108 | 109 | if len(res) > 0 { 110 | return errors.CompositeValidationError(res...) 111 | } 112 | return nil 113 | } 114 | -------------------------------------------------------------------------------- /client/version/get_version_responses.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package version 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "fmt" 10 | "io" 11 | 12 | "github.com/go-openapi/runtime" 13 | 14 | strfmt "github.com/go-openapi/strfmt" 15 | 16 | models "github.com/gotify/go-api-client/v2/models" 17 | ) 18 | 19 | // GetVersionReader is a Reader for the GetVersion structure. 20 | type GetVersionReader struct { 21 | formats strfmt.Registry 22 | } 23 | 24 | // ReadResponse reads a server response into the received o. 25 | func (o *GetVersionReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { 26 | switch response.Code() { 27 | 28 | case 200: 29 | result := NewGetVersionOK() 30 | if err := result.readResponse(response, consumer, o.formats); err != nil { 31 | return nil, err 32 | } 33 | return result, nil 34 | 35 | default: 36 | return nil, runtime.NewAPIError("unknown error", response, response.Code()) 37 | } 38 | } 39 | 40 | // NewGetVersionOK creates a GetVersionOK with default headers values 41 | func NewGetVersionOK() *GetVersionOK { 42 | return &GetVersionOK{} 43 | } 44 | 45 | /*GetVersionOK handles this case with default header values. 46 | 47 | Ok 48 | */ 49 | type GetVersionOK struct { 50 | Payload *models.VersionInfo 51 | } 52 | 53 | func (o *GetVersionOK) Error() string { 54 | return fmt.Sprintf("[GET /version][%d] getVersionOK %+v", 200, o.Payload) 55 | } 56 | 57 | func (o *GetVersionOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { 58 | 59 | o.Payload = new(models.VersionInfo) 60 | 61 | // response payload 62 | if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { 63 | return err 64 | } 65 | 66 | return nil 67 | } 68 | -------------------------------------------------------------------------------- /client/version/version_client.go: -------------------------------------------------------------------------------- 1 | // Code generated by go-swagger; DO NOT EDIT. 2 | 3 | package version 4 | 5 | // This file was generated by the swagger tool. 6 | // Editing this file might prove futile when you re-run the swagger generate command 7 | 8 | import ( 9 | "github.com/go-openapi/runtime" 10 | 11 | strfmt "github.com/go-openapi/strfmt" 12 | ) 13 | 14 | // New creates a new version API client. 15 | func New(transport runtime.ClientTransport, formats strfmt.Registry) *Client { 16 | return &Client{transport: transport, formats: formats} 17 | } 18 | 19 | /* 20 | Client for version API 21 | */ 22 | type Client struct { 23 | transport runtime.ClientTransport 24 | formats strfmt.Registry 25 | } 26 | 27 | /* 28 | GetVersion gets version information 29 | */ 30 | func (a *Client) GetVersion(params *GetVersionParams) (*GetVersionOK, error) { 31 | // TODO: Validate the params before sending 32 | if params == nil { 33 | params = NewGetVersionParams() 34 | } 35 | 36 | result, err := a.transport.Submit(&runtime.ClientOperation{ 37 | ID: "getVersion", 38 | Method: "GET", 39 | PathPattern: "/version", 40 | ProducesMediaTypes: []string{"application/json"}, 41 | ConsumesMediaTypes: []string{"application/json"}, 42 | Schemes: []string{"http", "https"}, 43 | Params: params, 44 | Reader: &GetVersionReader{formats: a.formats}, 45 | Context: params.Context, 46 | Client: params.HTTPClient, 47 | }) 48 | if err != nil { 49 | return nil, err 50 | } 51 | return result.(*GetVersionOK), nil 52 | 53 | } 54 | 55 | // SetTransport changes the transport on the client 56 | func (a *Client) SetTransport(transport runtime.ClientTransport) { 57 | a.transport = transport 58 | } 59 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/gotify/go-api-client/v2 2 | 3 | require ( 4 | github.com/go-openapi/errors v0.17.2 5 | github.com/go-openapi/runtime v0.17.2 6 | github.com/go-openapi/strfmt v0.17.0 7 | github.com/go-openapi/swag v0.17.0 8 | ) 9 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/PuerkitoBio/purell v1.1.0 h1:rmGxhojJlM0tuKtfdvliR84CFHljx9ag64t2xmVkjK4= 2 | github.com/PuerkitoBio/purell v1.1.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= 3 | github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578 h1:d+Bc7a5rLufV/sSk/8dngufqelfh6jnri85riMAaF/M= 4 | github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= 5 | github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf h1:eg0MeVzsP1G42dRafH3vf+al2vQIJU0YHX+1Tw87oco= 6 | github.com/asaskevich/govalidator v0.0.0-20180720115003-f9ffefc3facf/go.mod h1:lB+ZfQJz7igIIfQNfa7Ml4HSf2uFQQRzpGGRXenZAgY= 7 | github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= 8 | github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 9 | github.com/docker/go-units v0.3.3/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= 10 | github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb h1:D4uzjWwKYQ5XnAvUbuvHW93esHg7F8N/OYeBBcJoTr0= 11 | github.com/globalsign/mgo v0.0.0-20180905125535-1ca0a4f7cbcb/go.mod h1:xkRDCp4j0OGD1HRkm4kmhM+pmpv3AKq5SU7GMg4oO/Q= 12 | github.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI= 13 | github.com/go-openapi/analysis v0.17.0 h1:8JV+dzJJiK46XqGLqqLav8ZfEiJECp8jlOFhpiCdZ+0= 14 | github.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik= 15 | github.com/go-openapi/errors v0.17.0/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= 16 | github.com/go-openapi/errors v0.17.2 h1:azEQ8Fnx0jmtFF2fxsnmd6I0x6rsweUF63qqSO1NmKk= 17 | github.com/go-openapi/errors v0.17.2/go.mod h1:LcZQpmvG4wyF5j4IhA73wkLFQg+QJXOQHVjmcZxhka0= 18 | github.com/go-openapi/jsonpointer v0.17.0 h1:nH6xp8XdXHx8dqveo0ZuJBluCO2qGrPbDNZ0dwoRHP0= 19 | github.com/go-openapi/jsonpointer v0.17.0/go.mod h1:cOnomiV+CVVwFLk0A/MExoFMjwdsUdVpsRhURCKh+3M= 20 | github.com/go-openapi/jsonreference v0.17.0 h1:yJW3HCkTHg7NOA+gZ83IPHzUSnUzGXhGmsdiCcMexbA= 21 | github.com/go-openapi/jsonreference v0.17.0/go.mod h1:g4xxGn04lDIRh0GJb5QlpE3HfopLOL6uZrK/VgnsK9I= 22 | github.com/go-openapi/loads v0.17.0 h1:H22nMs3GDQk4SwAaFQ+jLNw+0xoFeCueawhZlv8MBYs= 23 | github.com/go-openapi/loads v0.17.0/go.mod h1:72tmFy5wsWx89uEVddd0RjRWPZm92WRLhf7AC+0+OOU= 24 | github.com/go-openapi/runtime v0.0.0-20180920151709-4f900dc2ade9/go.mod h1:6v9a6LTXWQCdL8k1AO3cvqx5OtZY/Y9wKTgaoP6YRfA= 25 | github.com/go-openapi/runtime v0.17.2 h1:/ZK67ikFhQAMFFH/aPu2MaGH7QjP4wHBvHYOVIzDAw0= 26 | github.com/go-openapi/runtime v0.17.2/go.mod h1:QO936ZXeisByFmZEO1IS1Dqhtf4QV1sYYFtIq6Ld86Q= 27 | github.com/go-openapi/spec v0.17.0 h1:XNvrt8FlSVP8T1WuhbAFF6QDhJc0zsoWzX4wXARhhpE= 28 | github.com/go-openapi/spec v0.17.0/go.mod h1:XkF/MOi14NmjsfZ8VtAKf8pIlbZzyoTvZsdfssdxcBI= 29 | github.com/go-openapi/strfmt v0.17.0 h1:1isAxYf//QDTnVzbLAMrUK++0k1EjeLJU/gTOR0o3Mc= 30 | github.com/go-openapi/strfmt v0.17.0/go.mod h1:P82hnJI0CXkErkXi8IKjPbNBM6lV6+5pLP5l494TcyU= 31 | github.com/go-openapi/swag v0.17.0 h1:iqrgMg7Q7SvtbWLlltPrkMs0UBJI6oTSs79JFRUi880= 32 | github.com/go-openapi/swag v0.17.0/go.mod h1:AByQ+nYG6gQg71GINrmuDXCPWdL640yX49/kXLo40Tg= 33 | github.com/go-openapi/validate v0.17.0 h1:pqoViQz3YLOGIhAmD0N4Lt6pa/3Gnj3ymKqQwq8iS6U= 34 | github.com/go-openapi/validate v0.17.0/go.mod h1:Uh4HdOzKt19xGIGm1qHf/ofbX1YQ4Y+MYsct2VUrAJ4= 35 | github.com/google/uuid v1.0.0 h1:b4Gk+7WdP/d3HZH8EJsZpvV7EtDOgaZLtnaNGIu1adA= 36 | github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= 37 | github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329 h1:2gxZ0XQIU/5z3Z3bUBu+FXuk2pFbkN6tcwi/pjyaDic= 38 | github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= 39 | github.com/mitchellh/mapstructure v1.1.2 h1:fmNYVwqnSfB9mZU6OS2O6GsXM+wcskZDuKQzvN1EDeE= 40 | github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= 41 | github.com/pborman/uuid v1.2.0 h1:J7Q5mO4ysT1dv8hyrUGHb9+ooztCXu1D8MY8DZYsu3g= 42 | github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= 43 | github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= 44 | github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= 45 | github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= 46 | github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= 47 | golang.org/x/net v0.0.0-20181005035420-146acd28ed58 h1:otZG8yDCO4LVps5+9bxOeNiCvgmOyt96J3roHTYs7oE= 48 | golang.org/x/net v0.0.0-20181005035420-146acd28ed58/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= 49 | golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= 50 | golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= 51 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= 52 | gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= 53 | gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= 54 | gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= 55 | -------------------------------------------------------------------------------- /gotify/factory.go: -------------------------------------------------------------------------------- 1 | package gotify 2 | 3 | import ( 4 | "net/url" 5 | "net/http" 6 | api "github.com/gotify/go-api-client/v2/client" 7 | httptransport "github.com/go-openapi/runtime/client" 8 | ) 9 | 10 | func NewClient(url *url.URL, client *http.Client) *api.GotifyREST { 11 | runtime := httptransport.NewWithClient(url.Host, url.Path, []string{url.Scheme}, client) 12 | return api.New(runtime, nil) 13 | } -------------------------------------------------------------------------------- /models/application.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // Application Model 4 | // 5 | // The Application holds information about an app which can send notifications. 6 | // 7 | // swagger:model Application 8 | type Application struct { 9 | // The application id. 10 | // 11 | // read only: true 12 | // required: true 13 | // example: 5 14 | ID uint `gorm:"primary_key;unique_index;AUTO_INCREMENT" json:"id"` 15 | // The application token. Can be used as `appToken`. See Authentication. 16 | // 17 | // read only: true 18 | // required: true 19 | // example: AWH0wZ5r0Mbac.r 20 | Token string `gorm:"unique_index" json:"token"` 21 | UserID uint `gorm:"index" json:"-"` 22 | // The application name. This is how the application should be displayed to the user. 23 | // 24 | // required: true 25 | // example: Backup Server 26 | Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"` 27 | // The description of the application. 28 | // 29 | // required: true 30 | // example: Backup server for the interwebs 31 | Description string `gorm:"type:text" form:"description" query:"description" json:"description"` 32 | // Whether the application is an internal application. Internal applications should not be deleted. 33 | // 34 | // read only: true 35 | // required: true 36 | // example: false 37 | Internal bool `form:"internal" query:"internal" json:"internal"` 38 | // The image of the application. 39 | // 40 | // read only: true 41 | // required: true 42 | // example: image/image.jpeg 43 | Image string `gorm:"type:text" json:"image"` 44 | Messages []MessageExternal `json:"-"` 45 | } 46 | -------------------------------------------------------------------------------- /models/client.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // Client Model 4 | // 5 | // The Client holds information about a device which can receive notifications (and other stuff). 6 | // 7 | // swagger:model Client 8 | type Client struct { 9 | // The client id. 10 | // 11 | // read only: true 12 | // required: true 13 | // example: 5 14 | ID uint `gorm:"primary_key;unique_index;AUTO_INCREMENT" json:"id"` 15 | // The client token. Can be used as `clientToken`. See Authentication. 16 | // 17 | // read only: true 18 | // required: true 19 | // example: CWH0wZ5r0Mbac.r 20 | Token string `gorm:"unique_index" json:"token"` 21 | UserID uint `gorm:"index" json:"-"` 22 | // The client name. This is how the client should be displayed to the user. 23 | // 24 | // required: true 25 | // example: Android Phone 26 | Name string `gorm:"type:text" form:"name" query:"name" json:"name" binding:"required"` 27 | } 28 | -------------------------------------------------------------------------------- /models/error.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // Error Model 4 | // 5 | // The Error contains error relevant information. 6 | // 7 | // swagger:model Error 8 | type Error struct { 9 | // The general error message 10 | // 11 | // required: true 12 | // example: Unauthorized 13 | Error string `json:"error"` 14 | // The http error code. 15 | // 16 | // required: true 17 | // example: 401 18 | ErrorCode int `json:"errorCode"` 19 | // The http error code. 20 | // 21 | // required: true 22 | // example: you need to provide a valid access token or user credentials to access this api 23 | ErrorDescription string `json:"errorDescription"` 24 | } 25 | -------------------------------------------------------------------------------- /models/message.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | import ( 4 | "time" 5 | ) 6 | 7 | // MessageExternal Model 8 | // 9 | // The MessageExternal holds information about a message which was sent by an Application. 10 | // 11 | // swagger:model Message 12 | type MessageExternal struct { 13 | // The message id. 14 | // 15 | // read only: true 16 | // required: true 17 | // example: 25 18 | ID uint `json:"id"` 19 | // The application id that send this message. 20 | // 21 | // read only: true 22 | // required: true 23 | // example: 5 24 | ApplicationID uint `json:"appid"` 25 | // The message. Markdown (excluding html) is allowed. 26 | // 27 | // required: true 28 | // example: **Backup** was successfully finished. 29 | Message string `form:"message" query:"message" json:"message" binding:"required"` 30 | // The title of the message. 31 | // 32 | // example: Backup 33 | Title string `form:"title" query:"title" json:"title"` 34 | // The priority of the message. 35 | // 36 | // example: 2 37 | Priority int `form:"priority" query:"priority" json:"priority"` 38 | // The extra data sent along the message. 39 | // 40 | // The extra fields are stored in a key-value scheme. Only accepted in CreateMessage requests with application/json content-type. 41 | // 42 | // The keys should be in the following format: <top-namespace>::[<sub-namespace>::]<action> 43 | // 44 | // These namespaces are reserved and might be used in the official clients: gotify android ios web server client. Do not use them for other purposes. 45 | // 46 | // example: {"home::appliances::thermostat::change_temperature":{"temperature":23},"home::appliances::lighting::on":{"brightness":15}} 47 | Extras map[string]interface{} `form:"-" query:"-" json:"extras,omitempty"` 48 | // The date the message was created. 49 | // 50 | // read only: true 51 | // required: true 52 | // example: 2018-02-27T19:36:10.5045044+01:00 53 | Date time.Time `json:"date"` 54 | } 55 | -------------------------------------------------------------------------------- /models/paging.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // Paging Model 4 | // 5 | // The Paging holds holds information about the limit and making requests to the next page. 6 | // 7 | // swagger:model Paging 8 | type Paging struct { 9 | // The request url for the next page. Empty/Null when no next page is available. 10 | // 11 | // read only: true 12 | // required: false 13 | // example: http://example.com/message?limit=50&since=123456 14 | Next string `json:"next,omitempty"` 15 | // The amount of messages that got returned in the current request. 16 | // 17 | // read only: true 18 | // required: true 19 | // example: 5 20 | Size int `json:"size"` 21 | // The ID of the last message returned in the current request. Use this as alternative to the next link. 22 | // 23 | // read only: true 24 | // required: true 25 | // example: 5 26 | // min: 0 27 | Since uint `json:"since"` 28 | // The limit of the messages for the current request. 29 | // 30 | // read only: true 31 | // required: true 32 | // min: 1 33 | // max: 200 34 | // example: 123 35 | Limit int `json:"limit"` 36 | } 37 | 38 | // PagedMessages Model 39 | // 40 | // Wrapper for the paging and the messages 41 | // 42 | // swagger:model PagedMessages 43 | type PagedMessages struct { 44 | // The paging of the messages. 45 | // 46 | // read only: true 47 | // required: true 48 | Paging Paging `json:"paging"` 49 | // The messages. 50 | // 51 | // read only: true 52 | // required: true 53 | Messages []*MessageExternal `json:"messages"` 54 | } 55 | -------------------------------------------------------------------------------- /models/pluginconf.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // PluginConfExternal Model 4 | // 5 | // Holds information about a plugin instance for one user. 6 | // 7 | // swagger:model PluginConf 8 | type PluginConfExternal struct { 9 | // The plugin id. 10 | // 11 | // read only: true 12 | // required: true 13 | // example: 25 14 | ID uint `json:"id"` 15 | // The plugin name. 16 | // 17 | // read only: true 18 | // required: true 19 | // example: RSS poller 20 | Name string `json:"name"` 21 | // The user name. For login. 22 | // 23 | // required: true 24 | // example: P1234 25 | Token string `binding:"required" json:"token" query:"token" form:"token"` 26 | // The module path of the plugin. 27 | // 28 | // example: github.com/gotify/server/plugin/example/echo 29 | // read only: true 30 | // required: true 31 | ModulePath string `json:"modulePath" form:"modulePath" query:"modulePath"` 32 | // The author of the plugin. 33 | // 34 | // example: jmattheis 35 | // read only: true 36 | Author string `json:"author,omitempty" form:"author" query:"author"` 37 | // The website of the plugin. 38 | // 39 | // example: gotify.net 40 | // read only: true 41 | Website string `json:"website,omitempty" form:"website" query:"website"` 42 | // The license of the plugin. 43 | // 44 | // example: MIT 45 | // read only: true 46 | License string `json:"license,omitempty" form:"license" query:"license"` 47 | // Whether the plugin instance is enabled. 48 | // 49 | // example: true 50 | // required: true 51 | Enabled bool `json:"enabled"` 52 | // Capabilities the plugin provides 53 | // 54 | // example: ["webhook","display"] 55 | // required: true 56 | Capabilities []string `json:"capabilities"` 57 | } 58 | -------------------------------------------------------------------------------- /models/user.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // UserExternal Model 4 | // 5 | // The User holds information about permission and other stuff. 6 | // 7 | // swagger:model User 8 | type UserExternal struct { 9 | // The user id. 10 | // 11 | // read only: true 12 | // required: true 13 | // example: 25 14 | ID uint `json:"id"` 15 | // The user name. For login. 16 | // 17 | // required: true 18 | // example: unicorn 19 | Name string `binding:"required" json:"name" query:"name" form:"name"` 20 | // If the user is an administrator. 21 | // 22 | // example: true 23 | Admin bool `json:"admin" form:"admin" query:"admin"` 24 | } 25 | 26 | // UserExternalWithPass Model 27 | // 28 | // The UserWithPass holds information about the credentials and other stuff. 29 | // 30 | // swagger:model UserWithPass 31 | type UserExternalWithPass struct { 32 | UserExternal 33 | UserExternalPass 34 | } 35 | 36 | // UserExternalPass Model 37 | // 38 | // The Password for updating the user. 39 | // 40 | // swagger:model UserPass 41 | type UserExternalPass struct { 42 | // The user password. For login. 43 | // 44 | // required: true 45 | // example: nrocinu 46 | Pass string `json:"pass,omitempty" form:"pass" query:"pass" binding:"required"` 47 | } 48 | -------------------------------------------------------------------------------- /models/version.go: -------------------------------------------------------------------------------- 1 | package models 2 | 3 | // VersionInfo Model 4 | // 5 | // swagger:model VersionInfo 6 | type VersionInfo struct { 7 | // The current version. 8 | // 9 | // required: true 10 | // example: 5.2.6 11 | Version string `json:"version"` 12 | // The git commit hash on which this binary was built. 13 | // 14 | // required: true 15 | // example: ae9512b6b6feea56a110d59a3353ea3b9c293864 16 | Commit string `json:"commit"` 17 | // The date on which this binary was built. 18 | // 19 | // required: true 20 | // example: 2018-02-27T19:36:10.5045044+01:00 21 | BuildDate string `json:"buildDate"` 22 | } 23 | --------------------------------------------------------------------------------