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 - 854 fde1e4c
* Contact : hello @ vikunja . io
* Generated by : Swagger Codegen ( https : //github.com/swagger-api/swagger-codegen.git)
* /
package swagger
import (
2019-10-19 21:30:03 +00:00
"encoding/json"
"fmt"
"golang.org/x/net/context"
2019-10-19 20:53:41 +00:00
"io/ioutil"
"net/http"
2019-10-19 21:30:03 +00:00
"net/url"
2019-10-19 20:53:41 +00:00
"strings"
)
// Linger please
var (
_ context . Context
)
type NamespaceApiService service
/ * NamespaceApiService Updates a namespace
2019-10-19 21:30:03 +00:00
Updates a namespace .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param id Namespace ID
@ param namespace The namespace with updated values you want to update .
@ return ModelsNamespace * /
func ( a * NamespaceApiService ) NamespaceIdPost ( ctx context . Context , id int32 , namespace ModelsNamespace ) ( ModelsNamespace , * http . Response , error ) {
2019-10-19 20:53:41 +00:00
var (
localVarHttpMethod = strings . ToUpper ( "Post" )
2019-10-19 21:30:03 +00:00
localVarPostBody interface { }
localVarFileName string
localVarFileBytes [ ] byte
successPayload ModelsNamespace
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/namespace/{id}"
localVarPath = strings . Replace ( localVarPath , "{" + "id" + "}" , fmt . Sprintf ( "%v" , id ) , - 1 )
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
// to determine the Content-Type header
2019-10-19 21:30:03 +00:00
localVarHttpContentTypes := [ ] string { "application/json" }
2019-10-19 20:53:41 +00:00
// set Content-Type header
localVarHttpContentType := selectHeaderContentType ( localVarHttpContentTypes )
if localVarHttpContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := [ ] string {
"application/json" ,
2019-10-19 21:30:03 +00:00
}
2019-10-19 20:53:41 +00:00
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept ( localVarHttpHeaderAccepts )
if localVarHttpHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHttpHeaderAccept
}
// body params
localVarPostBody = & namespace
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHttpMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFileName , localVarFileBytes )
if err != nil {
return successPayload , nil , err
}
localVarHttpResponse , err := a . client . callAPI ( r )
if err != nil || localVarHttpResponse == nil {
return successPayload , localVarHttpResponse , err
}
defer localVarHttpResponse . Body . Close ( )
if localVarHttpResponse . StatusCode >= 300 {
bodyBytes , _ := ioutil . ReadAll ( localVarHttpResponse . Body )
return successPayload , localVarHttpResponse , reportError ( "Status: %v, Body: %s" , localVarHttpResponse . Status , bodyBytes )
}
if err = json . NewDecoder ( localVarHttpResponse . Body ) . Decode ( & successPayload ) ; err != nil {
return successPayload , localVarHttpResponse , err
}
return successPayload , localVarHttpResponse , err
}
/ * NamespaceApiService Get all namespaces a user has access to
2019-10-19 21:30:03 +00:00
Returns all namespaces a user has access to .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param optional ( nil or map [ string ] interface { } ) with one or more of :
@ param "p" ( int32 ) The page number . Used for pagination . If not provided , the first page of results is returned .
@ param "s" ( string ) Search namespaces by name .
@ return [ ] ModelsNamespaceWithLists * /
func ( a * NamespaceApiService ) NamespacesGet ( ctx context . Context , localVarOptionals map [ string ] interface { } ) ( [ ] ModelsNamespaceWithLists , * http . Response , error ) {
2019-10-19 20:53:41 +00:00
var (
localVarHttpMethod = strings . ToUpper ( "Get" )
2019-10-19 21:30:03 +00:00
localVarPostBody interface { }
localVarFileName string
localVarFileBytes [ ] byte
successPayload [ ] ModelsNamespaceWithLists
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/namespaces"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
if err := typeCheckParameter ( localVarOptionals [ "p" ] , "int32" , "p" ) ; err != nil {
return successPayload , nil , err
}
if err := typeCheckParameter ( localVarOptionals [ "s" ] , "string" , "s" ) ; err != nil {
return successPayload , nil , err
}
if localVarTempParam , localVarOk := localVarOptionals [ "p" ] . ( int32 ) ; localVarOk {
localVarQueryParams . Add ( "p" , parameterToString ( localVarTempParam , "" ) )
}
if localVarTempParam , localVarOk := localVarOptionals [ "s" ] . ( string ) ; localVarOk {
localVarQueryParams . Add ( "s" , parameterToString ( localVarTempParam , "" ) )
}
// to determine the Content-Type header
2019-10-19 21:30:03 +00:00
localVarHttpContentTypes := [ ] string { "application/json" }
2019-10-19 20:53:41 +00:00
// set Content-Type header
localVarHttpContentType := selectHeaderContentType ( localVarHttpContentTypes )
if localVarHttpContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := [ ] string {
"application/json" ,
2019-10-19 21:30:03 +00:00
}
2019-10-19 20:53:41 +00:00
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept ( localVarHttpHeaderAccepts )
if localVarHttpHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHttpHeaderAccept
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHttpMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFileName , localVarFileBytes )
if err != nil {
return successPayload , nil , err
}
localVarHttpResponse , err := a . client . callAPI ( r )
if err != nil || localVarHttpResponse == nil {
return successPayload , localVarHttpResponse , err
}
defer localVarHttpResponse . Body . Close ( )
if localVarHttpResponse . StatusCode >= 300 {
bodyBytes , _ := ioutil . ReadAll ( localVarHttpResponse . Body )
return successPayload , localVarHttpResponse , reportError ( "Status: %v, Body: %s" , localVarHttpResponse . Status , bodyBytes )
}
if err = json . NewDecoder ( localVarHttpResponse . Body ) . Decode ( & successPayload ) ; err != nil {
return successPayload , localVarHttpResponse , err
}
return successPayload , localVarHttpResponse , err
}
/ * NamespaceApiService Deletes a namespace
2019-10-19 21:30:03 +00:00
Delets a namespace
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param id Namespace ID
@ return ModelsMessage * /
func ( a * NamespaceApiService ) NamespacesIdDelete ( ctx context . Context , id int32 ) ( ModelsMessage , * http . Response , error ) {
2019-10-19 20:53:41 +00:00
var (
localVarHttpMethod = strings . ToUpper ( "Delete" )
2019-10-19 21:30:03 +00:00
localVarPostBody interface { }
localVarFileName string
localVarFileBytes [ ] byte
successPayload ModelsMessage
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/namespaces/{id}"
localVarPath = strings . Replace ( localVarPath , "{" + "id" + "}" , fmt . Sprintf ( "%v" , id ) , - 1 )
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
// to determine the Content-Type header
2019-10-19 21:30:03 +00:00
localVarHttpContentTypes := [ ] string { }
2019-10-19 20:53:41 +00:00
// set Content-Type header
localVarHttpContentType := selectHeaderContentType ( localVarHttpContentTypes )
if localVarHttpContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := [ ] string {
"application/json" ,
2019-10-19 21:30:03 +00:00
}
2019-10-19 20:53:41 +00:00
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept ( localVarHttpHeaderAccepts )
if localVarHttpHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHttpHeaderAccept
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHttpMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFileName , localVarFileBytes )
if err != nil {
return successPayload , nil , err
}
localVarHttpResponse , err := a . client . callAPI ( r )
if err != nil || localVarHttpResponse == nil {
return successPayload , localVarHttpResponse , err
}
defer localVarHttpResponse . Body . Close ( )
if localVarHttpResponse . StatusCode >= 300 {
bodyBytes , _ := ioutil . ReadAll ( localVarHttpResponse . Body )
return successPayload , localVarHttpResponse , reportError ( "Status: %v, Body: %s" , localVarHttpResponse . Status , bodyBytes )
}
if err = json . NewDecoder ( localVarHttpResponse . Body ) . Decode ( & successPayload ) ; err != nil {
return successPayload , localVarHttpResponse , err
}
return successPayload , localVarHttpResponse , err
}
/ * NamespaceApiService Gets one namespace
2019-10-19 21:30:03 +00:00
Returns a namespace by its ID .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param id Namespace ID
@ return ModelsNamespace * /
func ( a * NamespaceApiService ) NamespacesIdGet ( ctx context . Context , id int32 ) ( ModelsNamespace , * http . Response , error ) {
2019-10-19 20:53:41 +00:00
var (
localVarHttpMethod = strings . ToUpper ( "Get" )
2019-10-19 21:30:03 +00:00
localVarPostBody interface { }
localVarFileName string
localVarFileBytes [ ] byte
successPayload ModelsNamespace
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/namespaces/{id}"
localVarPath = strings . Replace ( localVarPath , "{" + "id" + "}" , fmt . Sprintf ( "%v" , id ) , - 1 )
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
// to determine the Content-Type header
2019-10-19 21:30:03 +00:00
localVarHttpContentTypes := [ ] string { "application/json" }
2019-10-19 20:53:41 +00:00
// set Content-Type header
localVarHttpContentType := selectHeaderContentType ( localVarHttpContentTypes )
if localVarHttpContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := [ ] string {
"application/json" ,
2019-10-19 21:30:03 +00:00
}
2019-10-19 20:53:41 +00:00
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept ( localVarHttpHeaderAccepts )
if localVarHttpHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHttpHeaderAccept
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHttpMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFileName , localVarFileBytes )
if err != nil {
return successPayload , nil , err
}
localVarHttpResponse , err := a . client . callAPI ( r )
if err != nil || localVarHttpResponse == nil {
return successPayload , localVarHttpResponse , err
}
defer localVarHttpResponse . Body . Close ( )
if localVarHttpResponse . StatusCode >= 300 {
bodyBytes , _ := ioutil . ReadAll ( localVarHttpResponse . Body )
return successPayload , localVarHttpResponse , reportError ( "Status: %v, Body: %s" , localVarHttpResponse . Status , bodyBytes )
}
if err = json . NewDecoder ( localVarHttpResponse . Body ) . Decode ( & successPayload ) ; err != nil {
return successPayload , localVarHttpResponse , err
}
return successPayload , localVarHttpResponse , err
}
/ * NamespaceApiService Get all lists in a namespace
2019-10-19 21:30:03 +00:00
Returns all lists inside of a namespace .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param id Namespace ID
@ return [ ] ModelsList * /
func ( a * NamespaceApiService ) NamespacesIdListsGet ( ctx context . Context , id int32 ) ( [ ] ModelsList , * http . Response , error ) {
2019-10-19 20:53:41 +00:00
var (
localVarHttpMethod = strings . ToUpper ( "Get" )
2019-10-19 21:30:03 +00:00
localVarPostBody interface { }
localVarFileName string
localVarFileBytes [ ] byte
successPayload [ ] ModelsList
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/namespaces/{id}/lists"
localVarPath = strings . Replace ( localVarPath , "{" + "id" + "}" , fmt . Sprintf ( "%v" , id ) , - 1 )
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
// to determine the Content-Type header
2019-10-19 21:30:03 +00:00
localVarHttpContentTypes := [ ] string { "application/json" }
2019-10-19 20:53:41 +00:00
// set Content-Type header
localVarHttpContentType := selectHeaderContentType ( localVarHttpContentTypes )
if localVarHttpContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := [ ] string {
"application/json" ,
2019-10-19 21:30:03 +00:00
}
2019-10-19 20:53:41 +00:00
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept ( localVarHttpHeaderAccepts )
if localVarHttpHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHttpHeaderAccept
}
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHttpMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFileName , localVarFileBytes )
if err != nil {
return successPayload , nil , err
}
localVarHttpResponse , err := a . client . callAPI ( r )
if err != nil || localVarHttpResponse == nil {
return successPayload , localVarHttpResponse , err
}
defer localVarHttpResponse . Body . Close ( )
if localVarHttpResponse . StatusCode >= 300 {
bodyBytes , _ := ioutil . ReadAll ( localVarHttpResponse . Body )
return successPayload , localVarHttpResponse , reportError ( "Status: %v, Body: %s" , localVarHttpResponse . Status , bodyBytes )
}
if err = json . NewDecoder ( localVarHttpResponse . Body ) . Decode ( & successPayload ) ; err != nil {
return successPayload , localVarHttpResponse , err
}
return successPayload , localVarHttpResponse , err
}
/ * NamespaceApiService Creates a new namespace
2019-10-19 21:30:03 +00:00
Creates a new namespace .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param namespace The namespace you want to create .
@ return ModelsNamespace * /
func ( a * NamespaceApiService ) NamespacesPut ( ctx context . Context , namespace ModelsNamespace ) ( ModelsNamespace , * http . Response , error ) {
2019-10-19 20:53:41 +00:00
var (
localVarHttpMethod = strings . ToUpper ( "Put" )
2019-10-19 21:30:03 +00:00
localVarPostBody interface { }
localVarFileName string
localVarFileBytes [ ] byte
successPayload ModelsNamespace
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/namespaces"
localVarHeaderParams := make ( map [ string ] string )
localVarQueryParams := url . Values { }
localVarFormParams := url . Values { }
// to determine the Content-Type header
2019-10-19 21:30:03 +00:00
localVarHttpContentTypes := [ ] string { "application/json" }
2019-10-19 20:53:41 +00:00
// set Content-Type header
localVarHttpContentType := selectHeaderContentType ( localVarHttpContentTypes )
if localVarHttpContentType != "" {
localVarHeaderParams [ "Content-Type" ] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := [ ] string {
"application/json" ,
2019-10-19 21:30:03 +00:00
}
2019-10-19 20:53:41 +00:00
// set Accept header
localVarHttpHeaderAccept := selectHeaderAccept ( localVarHttpHeaderAccepts )
if localVarHttpHeaderAccept != "" {
localVarHeaderParams [ "Accept" ] = localVarHttpHeaderAccept
}
// body params
localVarPostBody = & namespace
if ctx != nil {
// API Key Authentication
if auth , ok := ctx . Value ( ContextAPIKey ) . ( APIKey ) ; ok {
var key string
if auth . Prefix != "" {
key = auth . Prefix + " " + auth . Key
} else {
key = auth . Key
}
localVarHeaderParams [ "Authorization" ] = key
}
}
r , err := a . client . prepareRequest ( ctx , localVarPath , localVarHttpMethod , localVarPostBody , localVarHeaderParams , localVarQueryParams , localVarFormParams , localVarFileName , localVarFileBytes )
if err != nil {
return successPayload , nil , err
}
localVarHttpResponse , err := a . client . callAPI ( r )
if err != nil || localVarHttpResponse == nil {
return successPayload , localVarHttpResponse , err
}
defer localVarHttpResponse . Body . Close ( )
if localVarHttpResponse . StatusCode >= 300 {
bodyBytes , _ := ioutil . ReadAll ( localVarHttpResponse . Body )
return successPayload , localVarHttpResponse , reportError ( "Status: %v, Body: %s" , localVarHttpResponse . Status , bodyBytes )
}
if err = json . NewDecoder ( localVarHttpResponse . Body ) . Decode ( & successPayload ) ; err != nil {
return successPayload , localVarHttpResponse , err
}
return successPayload , localVarHttpResponse , err
}