This repository has been archived on 2023-05-07. You can view files and clone it, but cannot push or open issues or pull requests.
go-sdk/api_response.go

45 lines
1.7 KiB
Go
Raw Normal View History

2019-10-19 20:53:41 +00:00
/*
* Vikunja API
*
* This is the documentation for the [Vikunja](http://vikunja.io) API. Vikunja is a cross-plattform Todo-application with a lot of features, such as sharing lists with users or teams. <!-- ReDoc-Inject: <security-definitions> --> # Authorization **JWT-Auth:** Main authorization method, used for most of the requests. Needs `Authorization: Bearer <jwt-token>`-header to authenticate successfully. **BasicAuth:** Only used when requesting tasks via caldav. <!-- ReDoc-Inject: <security-definitions> -->
*
* API version: 0.8+21-854fde1e4c
* Contact: hello@vikunja.io
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
*/
package swagger
import (
"net/http"
)
type APIResponse struct {
*http.Response `json:"-"`
2019-10-19 21:30:03 +00:00
Message string `json:"message,omitempty"`
2019-10-19 20:53:41 +00:00
// Operation is the name of the swagger operation.
2019-10-19 21:30:03 +00:00
Operation string `json:"operation,omitempty"`
2019-10-19 20:53:41 +00:00
// RequestURL is the request URL. This value is always available, even if the
// embedded *http.Response is nil.
2019-10-19 21:30:03 +00:00
RequestURL string `json:"url,omitempty"`
2019-10-19 20:53:41 +00:00
// Method is the HTTP method used for the request. This value is always
// available, even if the embedded *http.Response is nil.
2019-10-19 21:30:03 +00:00
Method string `json:"method,omitempty"`
2019-10-19 20:53:41 +00:00
// Payload holds the contents of the response body (which may be nil or empty).
// This is provided here as the raw response.Body() reader will have already
// been drained.
Payload []byte `json:"-"`
}
func NewAPIResponse(r *http.Response) *APIResponse {
response := &APIResponse{Response: r}
return response
}
func NewAPIResponseWithError(errorMessage string) *APIResponse {
response := &APIResponse{Message: errorMessage}
return response
}