vikunja
Index
- func ConsumeWebhookCallback(body io.ReadCloser, callback func(webhook WebhookCallback) error) error
- func RegisterVikunjaWebhookHandler(path string, callback func(Webhook WebhookCallback, c *Client) error) error
- type Client
- func GetVikunjaAPIClient(token, apiURL string) (*Client, error)
- func (c *Client) AddLabelToTask(taskID, labelID int) (LabelID, error)
- func (c *Client) CreateProjectWebhook(projectID int, webhook Webhook) (Webhook, error)
- func (c *Client) DeleteProjectWebhook(projectID, webhookID int) (Webhook, error)
- func (c *Client) GetAllLabels() ([]Label, error)
- func (c *Client) GetProject(projectID int) (Project, error)
- func (c *Client) GetProjectTasks(projectID int) ([]Task, error)
- func (c *Client) GetProjectWebhooks(projectID int) ([]Webhook, error)
- func (c *Client) GetProjects() ([]Project, error)
- func (c *Client) GetTask(taskID int) (Task, error)
- func (c *Client) GetTaskComments(taskID int) ([]Comment, error)
- func (c *Client) GetUsersOnAProject(projectID int) ([]User, error)
- func (c *Client) UpdateProject(project Project) (Project, error)
- func (c *Client) UpdateProjectWebhook(projectID int, webhook Webhook) (Webhook, error)
- func (c *Client) UpdateTask(task Task) (Task, error)
- type Comment
- func GetLatestComment(comments []Comment) (Comment, error)
- type Label
- func LabelsWithGivenTitles(labels []Label, titles []string) ([]Label, error)
- type LabelID
- type Project
- type Task
- type User
- type VikunjaWebhookEventType
- type Webhook
- type WebhookCallback
- type WebhookCallbackData
func ConsumeWebhookCallback
ConsumeWebhookCallback consumes a webhook callback and calls the callback function
func RegisterVikunjaWebhookHandler
func RegisterVikunjaWebhookHandler(path string, callback func(Webhook WebhookCallback, c *Client) error) error
RegisterVikunjaWebhookHandler registers a webhook handler for Vikunja Webhook
Typical usage is something like: l := utils.GetInitLogger()
if err := vikunja.RegisterVikunjaWebhookHandler("/", SomeWebhookHandler); err != nil {
log.Fatal(err)
}
utils.RunAPIServer(8080)
type Client
Client is the interface for the Vikunja API client
func GetVikunjaAPIClient
GetVikunjaAPIClient returns a new Vikunja API client
func (*Client) AddLabelToTask
AddLabelToTask adds a label to a task
func (*Client) CreateProjectWebhook
CreateProjectWebhook creates a webhook for a project
func (*Client) DeleteProjectWebhook
DeleteProjectWebhook deletes a webhook for a project
func (*Client) GetAllLabels
GetAllLabels returns a list of labels for a task
func (*Client) GetProject
GetProject returns a specific project
func (*Client) GetProjectTasks
GetProjectTasks returns a list of tasks for a project
func (*Client) GetProjectWebhooks
GetProjectWebhooks returns a list of webhooks for a project
func (*Client) GetProjects
GetProjects returns a list of projects
func (*Client) GetTask
GetTask returns a task
func (*Client) GetTaskComments
GetTaskComments returns a list of comments for a task
func (*Client) GetUsersOnAProject
GetUsersOnAProject returns a list of users added to a project
func (*Client) UpdateProject
UpdateProject updates a project
func (*Client) UpdateProjectWebhook
UpdateProjectWebhook updates a webhook for a project, only can update events (nothing else)
func (*Client) UpdateTask
UpdateTask updates a task
type Comment
type Comment struct {
ID int `json:"id"`
Comment string `json:"comment"`
Author User `json:"author"`
Created string `json:"created"`
Updated string `json:"updated"`
}
func GetLatestComment
GetLatestComment returns the latest comment from a list of comments
type Label
type Label struct {
ID int `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
HexColor string `json:"hex_color"`
CreatedBy User `json:"created_by"`
Created string `json:"created"`
Updated string `json:"updated"`
}
func LabelsWithGivenTitles
LabelsWithGivenTitles returns a list of labels with the given titles If the title of a label is not found, an error is returned, it is expected that you only provide valid titles
type LabelID
LabelID is a struct used to communicate to vikunja which label you are after. It is not the ID field in Label though.
type Project
Project is a struct that represents a project in Vikunja
type Project struct {
ID int `json:"id"`
Title string `json:"title"`
HexColor string `json:"hex_color"`
BackgroundBlurHash string `json:"background_blur_hash"`
Position float64 `json:"position"`
Created string `json:"created"`
Updated string `json:"updated"`
Description string `json:"description"`
DefaultBucketID int `json:"default_bucket_id"`
DoneBucketID int `json:"done_bucket_id"`
Identifier string `json:"identifier"`
IsArchived bool `json:"is_archived"`
IsFavorite bool `json:"is_favorite"`
Owner User `json:"owner"`
ParentProjectID int `json:"parent_project_id"`
BackgroundInformation interface{} `json:"background_information"`
}
type Task
Task represents a task in Vikunja
type Task struct {
ID int `json:"id"`
Title string `json:"title"`
Description string `json:"description"`
Done bool `json:"done"`
DoneAt string `json:"done_at"`
DueDate string `json:"due_date"`
Reminders interface{} `json:"reminders"`
ProjectID int `json:"project_id"`
RepeatAfter int `json:"repeat_after"`
RepeatMode int `json:"repeat_mode"`
Priority int `json:"priority"`
StartDate string `json:"start_date"`
EndDate string `json:"end_date"`
Assignees []User `json:"assignees"`
Labels []Label `json:"labels"`
HexColor string `json:"hex_color"`
PercentDone float32 `json:"percent_done"`
Identifier string `json:"identifier"`
Index int `json:"index"`
RelatedTasks map[string][]interface{} `json:"related_tasks,omitempty"` // Marking this with []Task instead of interface{} causes parsing errors...
Attachments interface{} `json:"attachments"`
CoverImageAttachmentID int `json:"cover_image_attachment_id"`
IsFavorite bool `json:"is_favorite"`
Created string `json:"created"`
Updated string `json:"updated"`
BucketID int `json:"bucket_id"`
Position float64 `json:"position"`
KanbanPosition float64 `json:"kanban_position"`
CreatedBy User `json:"created_by"`
}
type User
User is a struct that represents a user in Vikunja
type User struct {
ID int `json:"id"`
Name string `json:"name"`
Username string `json:"username"`
Created string `json:"created"`
Updated string `json:"updated"`
}
type VikunjaWebhookEventType
const (
ProjectDeleted VikunjaWebhookEventType = "project.deleted"
TaskAssigneeCreated VikunjaWebhookEventType = "task.assignee.created"
TaskCommentCreated VikunjaWebhookEventType = "task.comment.created"
TaskDeleted VikunjaWebhookEventType = "task.deleted"
TaskRelationCreated VikunjaWebhookEventType = "task.relation.created"
TaskCommentDeleted VikunjaWebhookEventType = "task.comment.deleted"
TaskAssigneeDeleted VikunjaWebhookEventType = "task.assignee.deleted"
ProjectSharedTeam VikunjaWebhookEventType = "project.shared.team"
ProjectSharedUser VikunjaWebhookEventType = "project.shared.user"
TaskAttachmentCreated VikunjaWebhookEventType = "task.attachment.created"
TaskCommentEdited VikunjaWebhookEventType = "task.comment.edited"
TaskRelationDeleted VikunjaWebhookEventType = "task.relation.deleted"
TaskUpdated VikunjaWebhookEventType = "task.updated"
TaskCreated VikunjaWebhookEventType = "task.created"
TaskAttachmentDeleted VikunjaWebhookEventType = "task.attachment.deleted"
ProjectUpdated VikunjaWebhookEventType = "project.updated"
)
type Webhook
Webhook represents a webhook in Vikunja
type Webhook struct {
ID int `json:"id"`
TargetURL string `json:"target_url"`
Events []string `json:"events"`
ProjectID int `json:"project_id"`
Secret *string `json:"secret,omitempty"`
Created *string `json:"created,omitempty"`
Updated *string `json:"updated,omitempty"`
CreatedBy *User `json:"created_by,omitempty"`
}
type WebhookCallback
WebhookCallback represents a webhook callback
type WebhookCallback struct {
EventName VikunjaWebhookEventType `json:"event_name"`
Time string `json:"time"`
Data WebhookCallbackData `json:"data"`
}
type WebhookCallbackData
WebhookCallbackData represents the data that is sent to a webhook callback
Generated by gomarkdoc