2024-05-11 14:43:57 +03:00
|
|
|
|
2024-04-10 12:14:55 +03:00
|
|
|
/*
|
2024-05-11 14:43:57 +03:00
|
|
|
* Firefly III API v2.0.14
|
2024-04-10 12:14:55 +03:00
|
|
|
*
|
2024-05-11 14:43:57 +03:00
|
|
|
* This is the documentation of the Firefly III API. You can find accompanying documentation on the website of Firefly III itself (see below). Please report any bugs or issues. You may use the \"Authorize\" button to try the API below. This file was last generated on 2024-04-20T05:28:29+00:00 Please keep in mind that the demo site does not accept requests from curl, colly, wget, etc. You must use a browser or a tool like Postman to make requests. Too many script kiddies out there, sorry about that.
|
2024-04-10 12:14:55 +03:00
|
|
|
*
|
2024-05-11 14:43:57 +03:00
|
|
|
* API version: 2.0.14
|
2024-04-10 12:14:55 +03:00
|
|
|
* Contact: james@firefly-iii.org
|
|
|
|
* Generated by: Swagger Codegen (https://github.com/swagger-api/swagger-codegen.git)
|
|
|
|
*/
|
2024-05-11 14:43:57 +03:00
|
|
|
package swagger
|
2024-04-10 12:14:55 +03:00
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"io/ioutil"
|
|
|
|
"net/http"
|
|
|
|
"net/url"
|
|
|
|
"strings"
|
2024-05-11 14:43:57 +03:00
|
|
|
"github.com/antihax/optional"
|
2024-04-10 12:14:55 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
// Linger please
|
|
|
|
var (
|
|
|
|
_ context.Context
|
|
|
|
)
|
|
|
|
|
|
|
|
type SummaryApiService service
|
|
|
|
/*
|
|
|
|
SummaryApiService Returns basic sums of the users data.
|
2024-05-11 14:43:57 +03:00
|
|
|
Returns basic sums of the users data, like the net worth, spent and earned amounts. It is multi-currency, and is used in Firefly III to populate the dashboard.
|
2024-04-10 12:14:55 +03:00
|
|
|
* @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background().
|
2024-05-11 14:43:57 +03:00
|
|
|
* @param start A date formatted YYYY-MM-DD.
|
|
|
|
* @param end A date formatted YYYY-MM-DD.
|
2024-04-10 12:14:55 +03:00
|
|
|
* @param optional nil or *SummaryApiGetBasicSummaryOpts - Optional Parameters:
|
|
|
|
* @param "XTraceId" (optional.Interface of string) - Unique identifier associated with this request.
|
2024-05-11 14:43:57 +03:00
|
|
|
* @param "CurrencyCode" (optional.String) - A currency code like EUR or USD, to filter the result.
|
2024-04-10 12:14:55 +03:00
|
|
|
@return map[string]BasicSummaryEntry
|
|
|
|
*/
|
|
|
|
|
|
|
|
type SummaryApiGetBasicSummaryOpts struct {
|
2024-05-11 14:43:57 +03:00
|
|
|
XTraceId optional.Interface
|
|
|
|
CurrencyCode optional.String
|
2024-04-10 12:14:55 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
func (a *SummaryApiService) GetBasicSummary(ctx context.Context, start string, end string, localVarOptionals *SummaryApiGetBasicSummaryOpts) (map[string]BasicSummaryEntry, *http.Response, error) {
|
|
|
|
var (
|
2024-05-11 14:43:57 +03:00
|
|
|
localVarHttpMethod = strings.ToUpper("Get")
|
|
|
|
localVarPostBody interface{}
|
|
|
|
localVarFileName string
|
|
|
|
localVarFileBytes []byte
|
2024-04-10 12:14:55 +03:00
|
|
|
localVarReturnValue map[string]BasicSummaryEntry
|
|
|
|
)
|
|
|
|
|
|
|
|
// create path and map variables
|
|
|
|
localVarPath := a.client.cfg.BasePath + "/v1/summary/basic"
|
|
|
|
|
|
|
|
localVarHeaderParams := make(map[string]string)
|
|
|
|
localVarQueryParams := url.Values{}
|
|
|
|
localVarFormParams := url.Values{}
|
|
|
|
|
|
|
|
localVarQueryParams.Add("start", parameterToString(start, ""))
|
|
|
|
localVarQueryParams.Add("end", parameterToString(end, ""))
|
|
|
|
if localVarOptionals != nil && localVarOptionals.CurrencyCode.IsSet() {
|
|
|
|
localVarQueryParams.Add("currency_code", parameterToString(localVarOptionals.CurrencyCode.Value(), ""))
|
|
|
|
}
|
|
|
|
// to determine the Content-Type header
|
|
|
|
localVarHttpContentTypes := []string{}
|
|
|
|
|
|
|
|
// set Content-Type header
|
|
|
|
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
|
|
|
|
if localVarHttpContentType != "" {
|
|
|
|
localVarHeaderParams["Content-Type"] = localVarHttpContentType
|
|
|
|
}
|
|
|
|
|
|
|
|
// to determine the Accept header
|
2024-05-11 14:43:57 +03:00
|
|
|
localVarHttpHeaderAccepts := []string{"application/vnd.api+json", "application/json"}
|
2024-04-10 12:14:55 +03:00
|
|
|
|
|
|
|
// set Accept header
|
|
|
|
localVarHttpHeaderAccept := selectHeaderAccept(localVarHttpHeaderAccepts)
|
|
|
|
if localVarHttpHeaderAccept != "" {
|
|
|
|
localVarHeaderParams["Accept"] = localVarHttpHeaderAccept
|
|
|
|
}
|
|
|
|
if localVarOptionals != nil && localVarOptionals.XTraceId.IsSet() {
|
|
|
|
localVarHeaderParams["X-Trace-Id"] = parameterToString(localVarOptionals.XTraceId.Value(), "")
|
|
|
|
}
|
|
|
|
r, err := a.client.prepareRequest(ctx, localVarPath, localVarHttpMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFileName, localVarFileBytes)
|
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, nil, err
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarHttpResponse, err := a.client.callAPI(r)
|
|
|
|
if err != nil || localVarHttpResponse == nil {
|
|
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
|
|
}
|
|
|
|
|
|
|
|
localVarBody, err := ioutil.ReadAll(localVarHttpResponse.Body)
|
|
|
|
localVarHttpResponse.Body.Close()
|
|
|
|
if err != nil {
|
|
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
|
|
}
|
|
|
|
|
|
|
|
if localVarHttpResponse.StatusCode < 300 {
|
|
|
|
// If we succeed, return the data, otherwise pass on to decode error.
|
2024-05-11 14:43:57 +03:00
|
|
|
err = a.client.decode(&localVarReturnValue, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
|
|
|
if err == nil {
|
2024-04-10 12:14:55 +03:00
|
|
|
return localVarReturnValue, localVarHttpResponse, err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if localVarHttpResponse.StatusCode >= 300 {
|
|
|
|
newErr := GenericSwaggerError{
|
2024-05-11 14:43:57 +03:00
|
|
|
body: localVarBody,
|
2024-04-10 12:14:55 +03:00
|
|
|
error: localVarHttpResponse.Status,
|
|
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode == 200 {
|
|
|
|
var v map[string]BasicSummaryEntry
|
2024-05-11 14:43:57 +03:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
newErr.model = v
|
2024-04-10 12:14:55 +03:00
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode == 401 {
|
|
|
|
var v UnauthenticatedResponse
|
2024-05-11 14:43:57 +03:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
newErr.model = v
|
2024-04-10 12:14:55 +03:00
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode == 404 {
|
|
|
|
var v NotFoundResponse
|
2024-05-11 14:43:57 +03:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
newErr.model = v
|
2024-04-10 12:14:55 +03:00
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode == 400 {
|
|
|
|
var v BadRequestResponse
|
2024-05-11 14:43:57 +03:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
newErr.model = v
|
2024-04-10 12:14:55 +03:00
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
if localVarHttpResponse.StatusCode == 500 {
|
|
|
|
var v InternalExceptionResponse
|
2024-05-11 14:43:57 +03:00
|
|
|
err = a.client.decode(&v, localVarBody, localVarHttpResponse.Header.Get("Content-Type"));
|
|
|
|
if err != nil {
|
|
|
|
newErr.error = err.Error()
|
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
newErr.model = v
|
2024-04-10 12:14:55 +03:00
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
return localVarReturnValue, localVarHttpResponse, newErr
|
|
|
|
}
|
|
|
|
|
|
|
|
return localVarReturnValue, localVarHttpResponse, nil
|
|
|
|
}
|