Most of the api endpoints/features of Vikunja are using the common web handler. This is a library created by Vikunja in an effort to facilitate the creation of REST endpoints.
This works by abstracting the handling of CRUD-Requests, including rights check.
You can learn more about the web handler on the project's repo.
Helper for pagination #
Pagination limits can be calculated with a helper function, getLimitFromPageIndex(pageIndex)
(only available in the models
package) from any page number. It returns the limit
(max-length) and offset
parameters needed for SQL-Queries.
You can feed this function directly into xorm's Limit
-Function like so:
projects := []*Project{}
err := x.Limit(getLimitFromPageIndex(pageIndex, itemsPerPage)).Find(&projects)
// TODO: Add a full example from start to finish, like a tutorial on how to create a new endpoint?