Browse Source

Initial commit

master
kolaente 2 years ago
commit
d1bd0237ad
Signed by: konrad GPG Key ID: F40E70337AB24C9B
  1. 24
      .gitignore
  2. 23
      .swagger-codegen-ignore
  3. 1
      .swagger-codegen/VERSION
  4. 8
      .travis.yml
  5. 166
      README.md
  6. 4700
      api/swagger.yaml
  7. 445
      api_client.go
  8. 44
      api_response.go
  9. 361
      assignees_api.go
  10. 18
      code_vikunja_io_web_http_error.go
  11. 73
      configuration.go
  12. 137
      docs/AssigneesApi.md
  13. 11
      docs/CodeVikunjaIoWebHttpError.md
  14. 14
      docs/FilesFile.md
  15. 291
      docs/LabelsApi.md
  16. 201
      docs/ListApi.md
  17. 13
      docs/ModelsApiUserPassword.md
  18. 10
      docs/ModelsBulkAssignees.md
  19. 31
      docs/ModelsBulkTask.md
  20. 10
      docs/ModelsEmailConfirm.md
  21. 16
      docs/ModelsLabel.md
  22. 11
      docs/ModelsLabelTask.md
  23. 10
      docs/ModelsLabelTaskBulk.md
  24. 16
      docs/ModelsLinkSharing.md
  25. 16
      docs/ModelsList.md
  26. 14
      docs/ModelsListUser.md
  27. 10
      docs/ModelsMessage.md
  28. 15
      docs/ModelsNamespace.md
  29. 14
      docs/ModelsNamespaceUser.md
  30. 16
      docs/ModelsNamespaceWithLists.md
  31. 11
      docs/ModelsPasswordReset.md
  32. 10
      docs/ModelsPasswordTokenRequest.md
  33. 9
      docs/ModelsRelatedTaskMap.md
  34. 30
      docs/ModelsTask.md
  35. 11
      docs/ModelsTaskAssginee.md
  36. 14
      docs/ModelsTaskAttachment.md
  37. 14
      docs/ModelsTaskRelation.md
  38. 16
      docs/ModelsTeam.md
  39. 14
      docs/ModelsTeamList.md
  40. 13
      docs/ModelsTeamMember.md
  41. 14
      docs/ModelsTeamNamespace.md
  42. 16
      docs/ModelsTeamUser.md
  43. 17
      docs/ModelsTeamWithRight.md
  44. 15
      docs/ModelsUser.md
  45. 11
      docs/ModelsUserLogin.md
  46. 16
      docs/ModelsUserWithRight.md
  47. 191
      docs/NamespaceApi.md
  48. 33
      docs/ServiceApi.md
  49. 686
      docs/SharingApi.md
  50. 343
      docs/TaskApi.md
  51. 193
      docs/TeamApi.md
  52. 243
      docs/UserApi.md
  53. 10
      docs/V1Token.md
  54. 11
      docs/V1UserPassword.md
  55. 14
      docs/V1VikunjaInfos.md
  56. 24
      files_file.go
  57. 52
      git_push.sh
  58. 763
      labels_api.go
  59. 519
      list_api.go
  60. 26
      models_api_user_password.go
  61. 17
      models_bulk_assignees.go
  62. 80
      models_bulk_task.go
  63. 17
      models_email_confirm.go
  64. 35
      models_label.go
  65. 20
      models_label_task.go
  66. 17
      models_label_task_bulk.go
  67. 35
      models_link_sharing.go
  68. 35
      models_list.go
  69. 29
      models_list_user.go
  70. 17
      models_message.go
  71. 32
      models_namespace.go
  72. 29
      models_namespace_user.go
  73. 34
      models_namespace_with_lists.go
  74. 20
      models_password_reset.go
  75. 16
      models_password_token_request.go
  76. 14
      models_related_task_map.go
  77. 77
      models_task.go
  78. 18
      models_task_assginee.go
  79. 24
      models_task_attachment.go
  80. 29
      models_task_relation.go
  81. 35
      models_team.go
  82. 29
      models_team_list.go
  83. 26
      models_team_member.go
  84. 29
      models_team_namespace.go
  85. 35
      models_team_user.go
  86. 37
      models_team_with_right.go
  87. 32
      models_user.go
  88. 20
      models_user_login.go
  89. 34
      models_user_with_right.go
  90. 509
      namespace_api.go
  91. 92
      service_api.go
  92. 1757
      sharing_api.go
  93. 923
      task_api.go
  94. 514
      team_api.go
  95. 595
      user_api.go
  96. 16
      v1_token.go
  97. 18
      v1_user_password.go
  98. 24
      v1_vikunja_infos.go

24
.gitignore

@ -0,0 +1,24 @@
# Compiled Object files, Static and Dynamic libs (Shared Objects)
*.o
*.a
*.so
# Folders
_obj
_test
# Architecture specific extensions/prefixes
*.[568vq]
[568vq].out
*.cgo1.go
*.cgo2.c
_cgo_defun.c
_cgo_gotypes.go
_cgo_export.*
_testmain.go
*.exe
*.test
*.prof

23
.swagger-codegen-ignore

@ -0,0 +1,23 @@
# Swagger Codegen Ignore
# Generated by swagger-codegen https://github.com/swagger-api/swagger-codegen
# Use this file to prevent files from being overwritten by the generator.
# The patterns follow closely to .gitignore or .dockerignore.
# As an example, the C# client generator defines ApiClient.cs.
# You can make changes and tell Swagger Codgen to ignore just this file by uncommenting the following line:
#ApiClient.cs
# You can match any string of characters against a directory, file or extension with a single asterisk (*):
#foo/*/qux
# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux
# You can recursively match patterns against a directory, file or extension with a double asterisk (**):
#foo/**/qux
# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux
# You can also negate patterns with an exclamation (!).
# For example, you can ignore all files in a docs folder with the file extension .md:
#docs/*.md
# Then explicitly reverse the ignore rule for a single file:
#!docs/README.md

1
.swagger-codegen/VERSION

@ -0,0 +1 @@
2.3.1

8
.travis.yml

@ -0,0 +1,8 @@
language: go
install:
- go get -d -v .
script:
- go build -v ./

166
README.md

@ -0,0 +1,166 @@
# Go API client for swagger
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> -->
## Overview
This API client was generated by the [swagger-codegen](https://github.com/swagger-api/swagger-codegen) project. By using the [swagger-spec](https://github.com/swagger-api/swagger-spec) from a remote server, you can easily generate an API client.
- API version: 0.8+21-854fde1e4c
- Package version: 1.0.0
- Build package: io.swagger.codegen.languages.GoClientCodegen
For more information, please visit [http://vikunja.io/en/contact/](http://vikunja.io/en/contact/)
## Installation
Put the package under your project folder and add the following in import:
```
"./swagger"
```
## Documentation for API Endpoints
All URIs are relative to *https://localhost/api/v1*
Class | Method | HTTP request | Description
------------ | ------------- | ------------- | -------------
*AssigneesApi* | [**TasksTaskIDAssigneesBulkPost**](docs/AssigneesApi.md#taskstaskidassigneesbulkpost) | **Post** /tasks/{taskID}/assignees/bulk | Add multiple new assignees to a task
*AssigneesApi* | [**TasksTaskIDAssigneesGet**](docs/AssigneesApi.md#taskstaskidassigneesget) | **Get** /tasks/{taskID}/assignees | Get all assignees for a task
*AssigneesApi* | [**TasksTaskIDAssigneesPut**](docs/AssigneesApi.md#taskstaskidassigneesput) | **Put** /tasks/{taskID}/assignees | Add a new assignee to a task
*AssigneesApi* | [**TasksTaskIDAssigneesUserIDDelete**](docs/AssigneesApi.md#taskstaskidassigneesuseriddelete) | **Delete** /tasks/{taskID}/assignees/{userID} | Delete an assignee
*LabelsApi* | [**LabelsGet**](docs/LabelsApi.md#labelsget) | **Get** /labels | Get all labels a user has access to
*LabelsApi* | [**LabelsIdDelete**](docs/LabelsApi.md#labelsiddelete) | **Delete** /labels/{id} | Delete a label
*LabelsApi* | [**LabelsIdGet**](docs/LabelsApi.md#labelsidget) | **Get** /labels/{id} | Gets one label
*LabelsApi* | [**LabelsIdPut**](docs/LabelsApi.md#labelsidput) | **Put** /labels/{id} | Update a label
*LabelsApi* | [**LabelsPut**](docs/LabelsApi.md#labelsput) | **Put** /labels | Create a label
*LabelsApi* | [**TasksTaskIDLabelsBulkPost**](docs/LabelsApi.md#taskstaskidlabelsbulkpost) | **Post** /tasks/{taskID}/labels/bulk | Update all labels on a task.
*LabelsApi* | [**TasksTaskLabelsGet**](docs/LabelsApi.md#taskstasklabelsget) | **Get** /tasks/{task}/labels | Get all labels on a task
*LabelsApi* | [**TasksTaskLabelsLabelDelete**](docs/LabelsApi.md#taskstasklabelslabeldelete) | **Delete** /tasks/{task}/labels/{label} | Remove a label from a task
*LabelsApi* | [**TasksTaskLabelsPut**](docs/LabelsApi.md#taskstasklabelsput) | **Put** /tasks/{task}/labels | Add a label to a task
*ListApi* | [**ListsGet**](docs/ListApi.md#listsget) | **Get** /lists | Get all lists a user has access to
*ListApi* | [**ListsIdDelete**](docs/ListApi.md#listsiddelete) | **Delete** /lists/{id} | Deletes a list
*ListApi* | [**ListsIdGet**](docs/ListApi.md#listsidget) | **Get** /lists/{id} | Gets one list
*ListApi* | [**ListsIdListusersGet**](docs/ListApi.md#listsidlistusersget) | **Get** /lists/{id}/listusers | Get users
*ListApi* | [**ListsIdPost**](docs/ListApi.md#listsidpost) | **Post** /lists/{id} | Updates a list
*ListApi* | [**NamespacesNamespaceIDListsPut**](docs/ListApi.md#namespacesnamespaceidlistsput) | **Put** /namespaces/{namespaceID}/lists | Creates a new list
*NamespaceApi* | [**NamespaceIdPost**](docs/NamespaceApi.md#namespaceidpost) | **Post** /namespace/{id} | Updates a namespace
*NamespaceApi* | [**NamespacesGet**](docs/NamespaceApi.md#namespacesget) | **Get** /namespaces | Get all namespaces a user has access to
*NamespaceApi* | [**NamespacesIdDelete**](docs/NamespaceApi.md#namespacesiddelete) | **Delete** /namespaces/{id} | Deletes a namespace
*NamespaceApi* | [**NamespacesIdGet**](docs/NamespaceApi.md#namespacesidget) | **Get** /namespaces/{id} | Gets one namespace
*NamespaceApi* | [**NamespacesIdListsGet**](docs/NamespaceApi.md#namespacesidlistsget) | **Get** /namespaces/{id}/lists | Get all lists in a namespace
*NamespaceApi* | [**NamespacesPut**](docs/NamespaceApi.md#namespacesput) | **Put** /namespaces | Creates a new namespace
*ServiceApi* | [**InfoGet**](docs/ServiceApi.md#infoget) | **Get** /info | Info
*SharingApi* | [**ListsIdTeamsGet**](docs/SharingApi.md#listsidteamsget) | **Get** /lists/{id}/teams | Get teams on a list
*SharingApi* | [**ListsIdTeamsPut**](docs/SharingApi.md#listsidteamsput) | **Put** /lists/{id}/teams | Add a team to a list
*SharingApi* | [**ListsIdUsersGet**](docs/SharingApi.md#listsidusersget) | **Get** /lists/{id}/users | Get users on a list
*SharingApi* | [**ListsIdUsersPut**](docs/SharingApi.md#listsidusersput) | **Put** /lists/{id}/users | Add a user to a list
*SharingApi* | [**ListsListIDTeamsTeamIDDelete**](docs/SharingApi.md#listslistidteamsteamiddelete) | **Delete** /lists/{listID}/teams/{teamID} | Delete a team from a list
*SharingApi* | [**ListsListIDTeamsTeamIDPost**](docs/SharingApi.md#listslistidteamsteamidpost) | **Post** /lists/{listID}/teams/{teamID} | Update a team &lt;-&gt; list relation
*SharingApi* | [**ListsListIDUsersUserIDDelete**](docs/SharingApi.md#listslistidusersuseriddelete) | **Delete** /lists/{listID}/users/{userID} | Delete a user from a list
*SharingApi* | [**ListsListIDUsersUserIDPost**](docs/SharingApi.md#listslistidusersuseridpost) | **Post** /lists/{listID}/users/{userID} | Update a user &lt;-&gt; list relation
*SharingApi* | [**ListsListSharesGet**](docs/SharingApi.md#listslistsharesget) | **Get** /lists/{list}/shares | Get all link shares for a list
*SharingApi* | [**ListsListSharesPut**](docs/SharingApi.md#listslistsharesput) | **Put** /lists/{list}/shares | Share a list via link
*SharingApi* | [**ListsListSharesShareDelete**](docs/SharingApi.md#listslistsharessharedelete) | **Delete** /lists/{list}/shares/{share} | Remove a link share
*SharingApi* | [**ListsListSharesShareGet**](docs/SharingApi.md#listslistsharesshareget) | **Get** /lists/{list}/shares/{share} | Get one link shares for a list
*SharingApi* | [**NamespacesIdTeamsGet**](docs/SharingApi.md#namespacesidteamsget) | **Get** /namespaces/{id}/teams | Get teams on a namespace
*SharingApi* | [**NamespacesIdTeamsPut**](docs/SharingApi.md#namespacesidteamsput) | **Put** /namespaces/{id}/teams | Add a team to a namespace
*SharingApi* | [**NamespacesIdUsersGet**](docs/SharingApi.md#namespacesidusersget) | **Get** /namespaces/{id}/users | Get users on a namespace
*SharingApi* | [**NamespacesIdUsersPut**](docs/SharingApi.md#namespacesidusersput) | **Put** /namespaces/{id}/users | Add a user to a namespace
*SharingApi* | [**NamespacesNamespaceIDTeamsTeamIDDelete**](docs/SharingApi.md#namespacesnamespaceidteamsteamiddelete) | **Delete** /namespaces/{namespaceID}/teams/{teamID} | Delete a team from a namespace
*SharingApi* | [**NamespacesNamespaceIDTeamsTeamIDPost**](docs/SharingApi.md#namespacesnamespaceidteamsteamidpost) | **Post** /namespaces/{namespaceID}/teams/{teamID} | Update a team &lt;-&gt; namespace relation
*SharingApi* | [**NamespacesNamespaceIDUsersUserIDDelete**](docs/SharingApi.md#namespacesnamespaceidusersuseriddelete) | **Delete** /namespaces/{namespaceID}/users/{userID} | Delete a user from a namespace
*SharingApi* | [**NamespacesNamespaceIDUsersUserIDPost**](docs/SharingApi.md#namespacesnamespaceidusersuseridpost) | **Post** /namespaces/{namespaceID}/users/{userID} | Update a user &lt;-&gt; namespace relation
*SharingApi* | [**SharesShareAuthPost**](docs/SharingApi.md#sharesshareauthpost) | **Post** /shares/{share}/auth | Get an auth token for a share
*TaskApi* | [**ListsIdPut**](docs/TaskApi.md#listsidput) | **Put** /lists/{id} | Create a task
*TaskApi* | [**TasksAllGet**](docs/TaskApi.md#tasksallget) | **Get** /tasks/all | Get tasks
*TaskApi* | [**TasksBulkPost**](docs/TaskApi.md#tasksbulkpost) | **Post** /tasks/bulk | Update a bunch of tasks at once
*TaskApi* | [**TasksIdAttachmentsAttachmentIDDelete**](docs/TaskApi.md#tasksidattachmentsattachmentiddelete) | **Delete** /tasks/{id}/attachments/{attachmentID} | Delete an attachment
*TaskApi* | [**TasksIdAttachmentsAttachmentIDGet**](docs/TaskApi.md#tasksidattachmentsattachmentidget) | **Get** /tasks/{id}/attachments/{attachmentID} | Get one attachment.
*TaskApi* | [**TasksIdAttachmentsGet**](docs/TaskApi.md#tasksidattachmentsget) | **Get** /tasks/{id}/attachments | Get all attachments for one task.
*TaskApi* | [**TasksIdAttachmentsPut**](docs/TaskApi.md#tasksidattachmentsput) | **Put** /tasks/{id}/attachments | Upload a task attachment
*TaskApi* | [**TasksIdDelete**](docs/TaskApi.md#tasksiddelete) | **Delete** /tasks/{id} | Delete a task
*TaskApi* | [**TasksIdPost**](docs/TaskApi.md#tasksidpost) | **Post** /tasks/{id} | Update a task
*TaskApi* | [**TasksTaskIDRelationsDelete**](docs/TaskApi.md#taskstaskidrelationsdelete) | **Delete** /tasks/{taskID}/relations | Remove a task relation
*TaskApi* | [**TasksTaskIDRelationsPut**](docs/TaskApi.md#taskstaskidrelationsput) | **Put** /tasks/{taskID}/relations | Create a new relation between two tasks
*TeamApi* | [**TeamsGet**](docs/TeamApi.md#teamsget) | **Get** /teams | Get teams
*TeamApi* | [**TeamsIdDelete**](docs/TeamApi.md#teamsiddelete) | **Delete** /teams/{id} | Deletes a team
*TeamApi* | [**TeamsIdMembersPut**](docs/TeamApi.md#teamsidmembersput) | **Put** /teams/{id}/members | Add a user to a team
*TeamApi* | [**TeamsIdMembersUserIDDelete**](docs/TeamApi.md#teamsidmembersuseriddelete) | **Delete** /teams/{id}/members/{userID} | Remove a user from a team
*TeamApi* | [**TeamsIdPost**](docs/TeamApi.md#teamsidpost) | **Post** /teams/{id} | Updates a team
*TeamApi* | [**TeamsPut**](docs/TeamApi.md#teamsput) | **Put** /teams | Creates a new team
*UserApi* | [**LoginPost**](docs/UserApi.md#loginpost) | **Post** /login | Login
*UserApi* | [**RegisterPost**](docs/UserApi.md#registerpost) | **Post** /register | Register
*UserApi* | [**UserConfirmPost**](docs/UserApi.md#userconfirmpost) | **Post** /user/confirm | Confirm the email of a new user
*UserApi* | [**UserGet**](docs/UserApi.md#userget) | **Get** /user | Get user information
*UserApi* | [**UserPasswordPost**](docs/UserApi.md#userpasswordpost) | **Post** /user/password | Change password
*UserApi* | [**UserPasswordResetPost**](docs/UserApi.md#userpasswordresetpost) | **Post** /user/password/reset | Resets a password
*UserApi* | [**UserPasswordTokenPost**](docs/UserApi.md#userpasswordtokenpost) | **Post** /user/password/token | Request password reset token
*UserApi* | [**UsersGet**](docs/UserApi.md#usersget) | **Get** /users | Get users
## Documentation For Models
- [CodeVikunjaIoWebHttpError](docs/CodeVikunjaIoWebHttpError.md)
- [FilesFile](docs/FilesFile.md)
- [ModelsApiUserPassword](docs/ModelsApiUserPassword.md)
- [ModelsBulkAssignees](docs/ModelsBulkAssignees.md)
- [ModelsBulkTask](docs/ModelsBulkTask.md)
- [ModelsEmailConfirm](docs/ModelsEmailConfirm.md)
- [ModelsLabel](docs/ModelsLabel.md)
- [ModelsLabelTask](docs/ModelsLabelTask.md)
- [ModelsLabelTaskBulk](docs/ModelsLabelTaskBulk.md)
- [ModelsLinkSharing](docs/ModelsLinkSharing.md)
- [ModelsList](docs/ModelsList.md)
- [ModelsListUser](docs/ModelsListUser.md)
- [ModelsMessage](docs/ModelsMessage.md)
- [ModelsNamespace](docs/ModelsNamespace.md)
- [ModelsNamespaceUser](docs/ModelsNamespaceUser.md)
- [ModelsNamespaceWithLists](docs/ModelsNamespaceWithLists.md)
- [ModelsPasswordReset](docs/ModelsPasswordReset.md)
- [ModelsPasswordTokenRequest](docs/ModelsPasswordTokenRequest.md)
- [ModelsRelatedTaskMap](docs/ModelsRelatedTaskMap.md)
- [ModelsTask](docs/ModelsTask.md)
- [ModelsTaskAssginee](docs/ModelsTaskAssginee.md)
- [ModelsTaskAttachment](docs/ModelsTaskAttachment.md)
- [ModelsTaskRelation](docs/ModelsTaskRelation.md)
- [ModelsTeam](docs/ModelsTeam.md)
- [ModelsTeamList](docs/ModelsTeamList.md)
- [ModelsTeamMember](docs/ModelsTeamMember.md)
- [ModelsTeamNamespace](docs/ModelsTeamNamespace.md)
- [ModelsTeamUser](docs/ModelsTeamUser.md)
- [ModelsTeamWithRight](docs/ModelsTeamWithRight.md)
- [ModelsUser](docs/ModelsUser.md)
- [ModelsUserLogin](docs/ModelsUserLogin.md)
- [ModelsUserWithRight](docs/ModelsUserWithRight.md)
- [V1Token](docs/V1Token.md)
- [V1UserPassword](docs/V1UserPassword.md)
- [V1VikunjaInfos](docs/V1VikunjaInfos.md)
## Documentation For Authorization
## BasicAuth
- **Type**: HTTP basic authentication
Example
```
auth := context.WithValue(context.Background(), sw.ContextBasicAuth, sw.BasicAuth{
UserName: "username",
Password: "password",
})
r, err := client.Service.Operation(auth, args)
```
## JWTKeyAuth
- **Type**: API key
Example
```
auth := context.WithValue(context.Background(), sw.ContextAPIKey, sw.APIKey{
Key: "APIKEY",
Prefix: "Bearer", // Omit if not necessary.
})
r, err := client.Service.Operation(auth, args)
```
## Author
hello@vikunja.io

4700
api/swagger.yaml

File diff suppressed because it is too large

445
api_client.go

@ -0,0 +1,445 @@
/*
* 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 (
"bytes"
"encoding/json"
"encoding/xml"
"fmt"
"errors"
"io"
"mime/multipart"
"golang.org/x/oauth2"
"golang.org/x/net/context"
"net/http"
"net/url"
"time"
"os"
"path/filepath"
"reflect"
"regexp"
"strings"
"unicode/utf8"
"strconv"
)
var (
jsonCheck = regexp.MustCompile("(?i:[application|text]/json)")
xmlCheck = regexp.MustCompile("(?i:[application|text]/xml)")
)
// APIClient manages communication with the Vikunja API API v0.8+21-854fde1e4c
// In most cases there should be only one, shared, APIClient.
type APIClient struct {
cfg *Configuration
common service // Reuse a single struct instead of allocating one for each service on the heap.
// API Services
AssigneesApi *AssigneesApiService
LabelsApi *LabelsApiService
ListApi *ListApiService
NamespaceApi *NamespaceApiService
ServiceApi *ServiceApiService
SharingApi *SharingApiService
TaskApi *TaskApiService
TeamApi *TeamApiService
UserApi *UserApiService
}
type service struct {
client *APIClient
}
// NewAPIClient creates a new API client. Requires a userAgent string describing your application.
// optionally a custom http.Client to allow for advanced features such as caching.
func NewAPIClient(cfg *Configuration) *APIClient {
if cfg.HTTPClient == nil {
cfg.HTTPClient = http.DefaultClient
}
c := &APIClient{}
c.cfg = cfg
c.common.client = c
// API Services
c.AssigneesApi = (*AssigneesApiService)(&c.common)
c.LabelsApi = (*LabelsApiService)(&c.common)
c.ListApi = (*ListApiService)(&c.common)
c.NamespaceApi = (*NamespaceApiService)(&c.common)
c.ServiceApi = (*ServiceApiService)(&c.common)
c.SharingApi = (*SharingApiService)(&c.common)
c.TaskApi = (*TaskApiService)(&c.common)
c.TeamApi = (*TeamApiService)(&c.common)
c.UserApi = (*UserApiService)(&c.common)
return c
}
func atoi(in string) (int, error) {
return strconv.Atoi(in)
}
// selectHeaderContentType select a content type from the available list.
func selectHeaderContentType(contentTypes []string) string {
if len(contentTypes) == 0 {
return ""
}
if contains(contentTypes, "application/json") {
return "application/json"
}
return contentTypes[0] // use the first content type specified in 'consumes'
}
// selectHeaderAccept join all accept types and return
func selectHeaderAccept(accepts []string) string {
if len(accepts) == 0 {
return ""
}
if contains(accepts, "application/json") {
return "application/json"
}
return strings.Join(accepts, ",")
}
// contains is a case insenstive match, finding needle in a haystack
func contains(haystack []string, needle string) bool {
for _, a := range haystack {
if strings.ToLower(a) == strings.ToLower(needle) {
return true
}
}
return false
}
// Verify optional parameters are of the correct type.
func typeCheckParameter(obj interface{}, expected string, name string) error {
// Make sure there is an object.
if obj == nil {
return nil
}
// Check the type is as expected.
if reflect.TypeOf(obj).String() != expected {
return fmt.Errorf("Expected %s to be of type %s but received %s.", name, expected, reflect.TypeOf(obj).String())
}
return nil
}
// parameterToString convert interface{} parameters to string, using a delimiter if format is provided.
func parameterToString(obj interface{}, collectionFormat string) string {
var delimiter string
switch collectionFormat {
case "pipes":
delimiter = "|"
case "ssv":
delimiter = " "
case "tsv":
delimiter = "\t"
case "csv":
delimiter = ","
}
if reflect.TypeOf(obj).Kind() == reflect.Slice {
return strings.Trim(strings.Replace(fmt.Sprint(obj), " ", delimiter, -1), "[]")
}
return fmt.Sprintf("%v", obj)
}
// callAPI do the request.
func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) {
return c.cfg.HTTPClient.Do(request)
}
// Change base path to allow switching to mocks
func (c *APIClient) ChangeBasePath (path string) {
c.cfg.BasePath = path
}
// prepareRequest build the request
func (c *APIClient) prepareRequest (
ctx context.Context,
path string, method string,
postBody interface{},
headerParams map[string]string,
queryParams url.Values,
formParams url.Values,
fileName string,
fileBytes []byte) (localVarRequest *http.Request, err error) {
var body *bytes.Buffer
// Detect postBody type and post.
if postBody != nil {
contentType := headerParams["Content-Type"]
if contentType == "" {
contentType = detectContentType(postBody)
headerParams["Content-Type"] = contentType
}
body, err = setBody(postBody, contentType)
if err != nil {
return nil, err
}
}
// add form parameters and file if available.
if len(formParams) > 0 || (len(fileBytes) > 0 && fileName != "") {
if body != nil {
return nil, errors.New("Cannot specify postBody and multipart form at the same time.")
}
body = &bytes.Buffer{}
w := multipart.NewWriter(body)
for k, v := range formParams {
for _, iv := range v {
if strings.HasPrefix(k, "@") { // file
err = addFile(w, k[1:], iv)
if err != nil {
return nil, err
}
} else { // form value
w.WriteField(k, iv)
}
}
}
if len(fileBytes) > 0 && fileName != "" {
w.Boundary()
//_, fileNm := filepath.Split(fileName)
part, err := w.CreateFormFile("file", filepath.Base(fileName))
if err != nil {
return nil, err
}
_, err = part.Write(fileBytes)
if err != nil {
return nil, err
}
// Set the Boundary in the Content-Type
headerParams["Content-Type"] = w.FormDataContentType()
}
// Set Content-Length
headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len())
w.Close()
}
// Setup path and query parameters
url, err := url.Parse(path)
if err != nil {
return nil, err
}
// Adding Query Param
query := url.Query()
for k, v := range queryParams {
for _, iv := range v {
query.Add(k, iv)
}
}
// Encode the parameters.
url.RawQuery = query.Encode()
// Generate a new request
if body != nil {
localVarRequest, err = http.NewRequest(method, url.String(), body)
} else {
localVarRequest, err = http.NewRequest(method, url.String(), nil)
}
if err != nil {
return nil, err
}
// add header parameters, if any
if len(headerParams) > 0 {
headers := http.Header{}
for h, v := range headerParams {
headers.Set(h, v)
}
localVarRequest.Header = headers
}
// Override request host, if applicable
if c.cfg.Host != "" {
localVarRequest.Host = c.cfg.Host
}
// Add the user agent to the request.
localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent)
if ctx != nil {
// add context to the request
localVarRequest = localVarRequest.WithContext(ctx)
// Walk through any authentication.
// OAuth2 authentication
if tok, ok := ctx.Value(ContextOAuth2).(oauth2.TokenSource); ok {
// We were able to grab an oauth2 token from the context
var latestToken *oauth2.Token
if latestToken, err = tok.Token(); err != nil {
return nil, err
}
latestToken.SetAuthHeader(localVarRequest)
}
// Basic HTTP Authentication
if auth, ok := ctx.Value(ContextBasicAuth).(BasicAuth); ok {
localVarRequest.SetBasicAuth(auth.UserName, auth.Password)
}
// AccessToken Authentication
if auth, ok := ctx.Value(ContextAccessToken).(string); ok {
localVarRequest.Header.Add("Authorization", "Bearer " + auth)
}
}
for header, value := range c.cfg.DefaultHeader {
localVarRequest.Header.Add(header, value)
}
return localVarRequest, nil
}
// Add a file to the multipart request
func addFile(w *multipart.Writer, fieldName, path string) error {
file, err := os.Open(path)
if err != nil {
return err
}
defer file.Close()
part, err := w.CreateFormFile(fieldName, filepath.Base(path))
if err != nil {
return err
}
_, err = io.Copy(part, file)
return err
}
// Prevent trying to import "fmt"
func reportError(format string, a ...interface{}) (error) {
return fmt.Errorf(format, a...)
}
// Set request body from an interface{}
func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) {
if bodyBuf == nil {
bodyBuf = &bytes.Buffer{}
}
if reader, ok := body.(io.Reader); ok {
_, err = bodyBuf.ReadFrom(reader)
} else if b, ok := body.([]byte); ok {
_, err = bodyBuf.Write(b)
} else if s, ok := body.(string); ok {
_, err = bodyBuf.WriteString(s)
} else if jsonCheck.MatchString(contentType) {
err = json.NewEncoder(bodyBuf).Encode(body)
} else if xmlCheck.MatchString(contentType) {
xml.NewEncoder(bodyBuf).Encode(body)
}
if err != nil {
return nil, err
}
if bodyBuf.Len() == 0 {
err = fmt.Errorf("Invalid body type %s\n", contentType)
return nil, err
}
return bodyBuf, nil
}
// detectContentType method is used to figure out `Request.Body` content type for request header
func detectContentType(body interface{}) string {
contentType := "text/plain; charset=utf-8"
kind := reflect.TypeOf(body).Kind()
switch kind {
case reflect.Struct, reflect.Map, reflect.Ptr:
contentType = "application/json; charset=utf-8"
case reflect.String:
contentType = "text/plain; charset=utf-8"
default:
if b, ok := body.([]byte); ok {
contentType = http.DetectContentType(b)
} else if kind == reflect.Slice {
contentType = "application/json; charset=utf-8"
}
}
return contentType
}
// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go
type cacheControl map[string]string
func parseCacheControl(headers http.Header) cacheControl {
cc := cacheControl{}
ccHeader := headers.Get("Cache-Control")
for _, part := range strings.Split(ccHeader, ",") {
part = strings.Trim(part, " ")
if part == "" {
continue
}
if strings.ContainsRune(part, '=') {
keyval := strings.Split(part, "=")
cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",")
} else {
cc[part] = ""
}
}
return cc
}
// CacheExpires helper function to determine remaining time before repeating a request.
func CacheExpires(r *http.Response) (time.Time) {
// Figure out when the cache expires.
var expires time.Time
now, err := time.Parse(time.RFC1123, r.Header.Get("date"))
if err != nil {
return time.Now()
}
respCacheControl := parseCacheControl(r.Header)
if maxAge, ok := respCacheControl["max-age"]; ok {
lifetime, err := time.ParseDuration(maxAge + "s")
if err != nil {
expires = now
}
expires = now.Add(lifetime)
} else {
expiresHeader := r.Header.Get("Expires")
if expiresHeader != "" {
expires, err = time.Parse(time.RFC1123, expiresHeader)
if err != nil {
expires = now
}
}
}
return expires
}
func strlen(s string) (int) {
return utf8.RuneCountInString(s)
}

44
api_response.go

@ -0,0 +1,44 @@
/*
* 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:"-"`
Message string `json:"message,omitempty"`
// Operation is the name of the swagger operation.
Operation string `json:"operation,omitempty"`
// RequestURL is the request URL. This value is always available, even if the
// embedded *http.Response is nil.
RequestURL string `json:"url,omitempty"`
// Method is the HTTP method used for the request. This value is always
// available, even if the embedded *http.Response is nil.
Method string `json:"method,omitempty"`
// 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
}

361
assignees_api.go

@ -0,0 +1,361 @@
/*
* 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 (
"io/ioutil"
"net/url"
"net/http"
"strings"
"golang.org/x/net/context"
"encoding/json"
"fmt"
)
// Linger please
var (
_ context.Context
)
type AssigneesApiService service
/* AssigneesApiService Add multiple new assignees to a task
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) {
var (
localVarHttpMethod = strings.ToUpper("Post")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload ModelsTaskAssginee
)
// 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
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// 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
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) {
var (
localVarHttpMethod = strings.ToUpper("Get")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload []ModelsUser
)
// 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
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// 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
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) {
var (
localVarHttpMethod = strings.ToUpper("Put")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload ModelsTaskAssginee
)
// 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
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// 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
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) {
var (
localVarHttpMethod = strings.ToUpper("Delete")
localVarPostBody interface{}
localVarFileName string
localVarFileBytes []byte
successPayload ModelsMessage
)
// 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
localVarHttpContentTypes := []string{ "application/json", }
// set Content-Type header
localVarHttpContentType := selectHeaderContentType(localVarHttpContentTypes)
if localVarHttpContentType != "" {
localVarHeaderParams["Content-Type"] = localVarHttpContentType
}
// to determine the Accept header
localVarHttpHeaderAccepts := []string{
"application/json",
}
// 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
}

18
code_vikunja_io_web_http_error.go

@ -0,0 +1,18 @@
/*
* 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
type CodeVikunjaIoWebHttpError struct {
Code int32 `json:"code,omitempty"`
Message string `json:"message,omitempty"`
}

73
configuration.go

@ -0,0 +1,73 @@
/*
* 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"
)
// contextKeys are used to identify the type of value in the context.
// Since these are string, it is possible to get a short description of the
// context key for logging and debugging using key.String().
type contextKey string
func (c contextKey) String() string {
return "auth " + string(c)
}
var (
// ContextOAuth2 takes a oauth2.TokenSource as authentication for the request.
ContextOAuth2 = contextKey("token")
// ContextBasicAuth takes BasicAuth as authentication for the request.
ContextBasicAuth = contextKey("basic")
// ContextAccessToken takes a string oauth2 access token as authentication for the request.
ContextAccessToken = contextKey("accesstoken")
// ContextAPIKey takes an APIKey as authentication for the request
ContextAPIKey = contextKey("apikey")
)
// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth
type BasicAuth struct {
UserName string `json:"userName,omitempty"`
Password string `json:"password,omitempty"`
}
// APIKey provides API key based authentication to a request passed via context using ContextAPIKey
type APIKey struct {
Key string
Prefix string
}
type Configuration struct {
BasePath string `json:"basePath,omitempty"`
Host string `json:"host,omitempty"`
Scheme string `json:"scheme,omitempty"`
DefaultHeader map[string]string `json:"defaultHeader,omitempty"`
UserAgent string `json:"userAgent,omitempty"`
HTTPClient *http.Client
}
func NewConfiguration() *Configuration {
cfg := &Configuration{
BasePath: "https://localhost/api/v1",
DefaultHeader: make(map[string]string),
UserAgent: "Swagger-Codegen/1.0.0/go",
}
return cfg
}
func (c *Configuration) AddDefaultHeader(key string, value string) {
c.DefaultHeader[key] = value
}

137
docs/AssigneesApi.md

@ -0,0 +1,137 @@
# \AssigneesApi
All URIs are relative to *https://localhost/api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**TasksTaskIDAssigneesBulkPost**](AssigneesApi.md#TasksTaskIDAssigneesBulkPost) | **Post** /tasks/{taskID}/assignees/bulk | Add multiple new assignees to a task
[**TasksTaskIDAssigneesGet**](AssigneesApi.md#TasksTaskIDAssigneesGet) | **Get** /tasks/{taskID}/assignees | Get all assignees for a task
[**TasksTaskIDAssigneesPut**](AssigneesApi.md#TasksTaskIDAssigneesPut) | **Put** /tasks/{taskID}/assignees | Add a new assignee to a task
[**TasksTaskIDAssigneesUserIDDelete**](AssigneesApi.md#TasksTaskIDAssigneesUserIDDelete) | **Delete** /tasks/{taskID}/assignees/{userID} | Delete an assignee
# **TasksTaskIDAssigneesBulkPost**
> ModelsTaskAssginee TasksTaskIDAssigneesBulkPost(ctx, assignee, taskID)
Add multiple new assignees to a task
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.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**assignee** | [**ModelsBulkAssignees**](ModelsBulkAssignees.md)| The array of assignees |
**taskID** | **int32**| Task ID |
### Return type
[**ModelsTaskAssginee**](models.TaskAssginee.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **TasksTaskIDAssigneesGet**
> []ModelsUser TasksTaskIDAssigneesGet(ctx, taskID, optional)
Get all assignees for a task
Returns an array with all assignees for this task.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**taskID** | **int32**| Task ID |
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**taskID** | **int32**| Task ID |
**p** | **int32**| The page number. Used for pagination. If not provided, the first page of results is returned. |
**s** | **string**| Search assignees by their username. |
### Return type
[**[]ModelsUser**](models.User.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **TasksTaskIDAssigneesPut**
> ModelsTaskAssginee TasksTaskIDAssigneesPut(ctx, assignee, taskID)
Add a new assignee to a task
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.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**assignee** | [**ModelsTaskAssginee**](ModelsTaskAssginee.md)| The assingee object |
**taskID** | **int32**| Task ID |
### Return type
[**ModelsTaskAssginee**](models.TaskAssginee.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **TasksTaskIDAssigneesUserIDDelete**
> ModelsMessage TasksTaskIDAssigneesUserIDDelete(ctx, taskID, userID)
Delete an assignee
Un-assign a user from a task.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**taskID** | **int32**| Task ID |
**userID** | **int32**| Assignee user ID |
### Return type
[**ModelsMessage**](models.Message.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)

11
docs/CodeVikunjaIoWebHttpError.md

@ -0,0 +1,11 @@
# CodeVikunjaIoWebHttpError
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Code** | **int32** | | [optional] [default to null]
**Message** | **string** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

14
docs/FilesFile.md

@ -0,0 +1,14 @@
# FilesFile
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**Created** | **string** | | [optional] [default to null]
**Id** | **int32** | | [optional] [default to null]
**Mime** | **string** | | [optional] [default to null]
**Name** | **string** | | [optional] [default to null]
**Size** | **int32** | | [optional] [default to null]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

291
docs/LabelsApi.md

@ -0,0 +1,291 @@
# \LabelsApi
All URIs are relative to *https://localhost/api/v1*
Method | HTTP request | Description
------------- | ------------- | -------------
[**LabelsGet**](LabelsApi.md#LabelsGet) | **Get** /labels | Get all labels a user has access to
[**LabelsIdDelete**](LabelsApi.md#LabelsIdDelete) | **Delete** /labels/{id} | Delete a label
[**LabelsIdGet**](LabelsApi.md#LabelsIdGet) | **Get** /labels/{id} | Gets one label
[**LabelsIdPut**](LabelsApi.md#LabelsIdPut) | **Put** /labels/{id} | Update a label
[**LabelsPut**](LabelsApi.md#LabelsPut) | **Put** /labels | Create a label
[**TasksTaskIDLabelsBulkPost**](LabelsApi.md#TasksTaskIDLabelsBulkPost) | **Post** /tasks/{taskID}/labels/bulk | Update all labels on a task.
[**TasksTaskLabelsGet**](LabelsApi.md#TasksTaskLabelsGet) | **Get** /tasks/{task}/labels | Get all labels on a task
[**TasksTaskLabelsLabelDelete**](LabelsApi.md#TasksTaskLabelsLabelDelete) | **Delete** /tasks/{task}/labels/{label} | Remove a label from a task
[**TasksTaskLabelsPut**](LabelsApi.md#TasksTaskLabelsPut) | **Put** /tasks/{task}/labels | Add a label to a task
# **LabelsGet**
> []ModelsLabel LabelsGet(ctx, optional)
Get all labels a user has access to
Returns all labels which are either created by the user or associated with a task the user has at least read-access to.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**p** | **int32**| The page number. Used for pagination. If not provided, the first page of results is returned. |
**s** | **string**| Search labels by label text. |
### Return type
[**[]ModelsLabel**](models.Label.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **LabelsIdDelete**
> ModelsLabel LabelsIdDelete(ctx, id)
Delete a label
Delete an existing label. The user needs to be the creator of the label to be able to do this.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**id** | **int32**| Label ID |
### Return type
[**ModelsLabel**](models.Label.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **LabelsIdGet**
> ModelsLabel LabelsIdGet(ctx, id)
Gets one label
Returns one label by its ID.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**id** | **int32**| Label ID |
### Return type
[**ModelsLabel**](models.Label.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **LabelsIdPut**
> ModelsLabel LabelsIdPut(ctx, id, label)
Update a label
Update an existing label. The user needs to be the creator of the label to be able to do this.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**id** | **int32**| Label ID |
**label** | [**ModelsLabel**](ModelsLabel.md)| The label object |
### Return type
[**ModelsLabel**](models.Label.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **LabelsPut**
> ModelsLabel LabelsPut(ctx, label)
Create a label
Creates a new label.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**label** | [**ModelsLabel**](ModelsLabel.md)| The label object |
### Return type
[**ModelsLabel**](models.Label.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **TasksTaskIDLabelsBulkPost**
> ModelsLabelTaskBulk TasksTaskIDLabelsBulkPost(ctx, label, taskID)
Update all labels on a task.
Updates all labels on a task. Every label which is not passed but exists on the task will be deleted. Every label which does not exist on the task will be added. All labels which are passed and already exist on the task won't be touched.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**label** | [**ModelsLabelTaskBulk**](ModelsLabelTaskBulk.md)| The array of labels |
**taskID** | **int32**| Task ID |
### Return type
[**ModelsLabelTaskBulk**](models.LabelTaskBulk.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **TasksTaskLabelsGet**
> []ModelsLabel TasksTaskLabelsGet(ctx, task, optional)
Get all labels on a task
Returns all labels which are assicociated with a given task.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**task** | **int32**| Task ID |
**optional** | **map[string]interface{}** | optional parameters | nil if no parameters
### Optional Parameters
Optional parameters are passed through a map[string]interface{}.
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**task** | **int32**| Task ID |
**p** | **int32**| The page number. Used for pagination. If not provided, the first page of results is returned. |
**s** | **string**| Search labels by label text. |
### Return type
[**[]ModelsLabel**](models.Label.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **TasksTaskLabelsLabelDelete**
> ModelsMessage TasksTaskLabelsLabelDelete(ctx, task, label)
Remove a label from a task
Remove a label from a task. The user needs to have write-access to the list to be able do this.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**task** | **int32**| Task ID |
**label** | **int32**| Label ID |
### Return type
[**ModelsMessage**](models.Message.md)
### Authorization
[JWTKeyAuth](../README.md#JWTKeyAuth)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **TasksTaskLabelsPut**
> ModelsLabelTask TasksTaskLabelsPut(ctx, task, label)
Add a label to a task
Add a label to a task. The user needs to have write-access to the list to be able do this.
### Required Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**ctx** | **context.Context** | context for logging, tracing, authentication, etc.
**task** | **int32**| Task ID |
**label** | [**ModelsLabelTask**](ModelsLabelTask.md)| The label object |
### Return type