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 AssigneesApiService service
/ * AssigneesApiService Add multiple new assignees to a task
2019-10-19 21:30:03 +00:00
Adds multiple new assignees to a task . The assignee needs to have access to the list , the doer must be able to edit this task . Every user not in the list will be unassigned from the task , pass an empty array to unassign everyone .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param assignee The array of assignees
@ param taskID Task ID
@ return ModelsTaskAssginee * /
func ( a * AssigneesApiService ) TasksTaskIDAssigneesBulkPost ( ctx context . Context , assignee ModelsBulkAssignees , taskID int32 ) ( ModelsTaskAssginee , * 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 ModelsTaskAssginee
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/tasks/{taskID}/assignees/bulk"
localVarPath = strings . Replace ( localVarPath , "{" + "taskID" + "}" , fmt . Sprintf ( "%v" , taskID ) , - 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 = & assignee
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
}
/ * AssigneesApiService Get all assignees for a task
2019-10-19 21:30:03 +00:00
Returns an array with all assignees for this task .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param taskID Task ID
@ 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 assignees by their username .
@ return [ ] ModelsUser * /
func ( a * AssigneesApiService ) TasksTaskIDAssigneesGet ( ctx context . Context , taskID int32 , localVarOptionals map [ string ] interface { } ) ( [ ] ModelsUser , * 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 [ ] ModelsUser
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/tasks/{taskID}/assignees"
localVarPath = strings . Replace ( localVarPath , "{" + "taskID" + "}" , fmt . Sprintf ( "%v" , taskID ) , - 1 )
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
}
/ * AssigneesApiService Add a new assignee to a task
2019-10-19 21:30:03 +00:00
Adds a new assignee to a task . The assignee needs to have access to the list , the doer must be able to edit this task .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param assignee The assingee object
@ param taskID Task ID
@ return ModelsTaskAssginee * /
func ( a * AssigneesApiService ) TasksTaskIDAssigneesPut ( ctx context . Context , assignee ModelsTaskAssginee , taskID int32 ) ( ModelsTaskAssginee , * 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 ModelsTaskAssginee
2019-10-19 20:53:41 +00:00
)
// create path and map variables
localVarPath := a . client . cfg . BasePath + "/tasks/{taskID}/assignees"
localVarPath = strings . Replace ( localVarPath , "{" + "taskID" + "}" , fmt . Sprintf ( "%v" , taskID ) , - 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 = & assignee
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
}
/ * AssigneesApiService Delete an assignee
2019-10-19 21:30:03 +00:00
Un - assign a user from a task .
* @ param ctx context . Context for authentication , logging , tracing , etc .
@ param taskID Task ID
@ param userID Assignee user ID
@ return ModelsMessage * /
func ( a * AssigneesApiService ) TasksTaskIDAssigneesUserIDDelete ( ctx context . Context , taskID int32 , userID 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 + "/tasks/{taskID}/assignees/{userID}"
localVarPath = strings . Replace ( localVarPath , "{" + "taskID" + "}" , fmt . Sprintf ( "%v" , taskID ) , - 1 )
localVarPath = strings . Replace ( localVarPath , "{" + "userID" + "}" , fmt . Sprintf ( "%v" , userID ) , - 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
}