mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
Merge pull request #291 from muety/swagger-api-patch
fix: swagger /api/api duplication
This commit is contained in:
commit
6712f0a390
|
@ -2,12 +2,13 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/muety/wakapi/models"
|
"github.com/muety/wakapi/models"
|
||||||
)
|
)
|
||||||
|
@ -41,7 +42,7 @@ func (h *DiagnosticsApiHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param diagnostics body models.Diagnostics true "A single diagnostics object sent by WakaTime CLI"
|
// @Param diagnostics body models.Diagnostics true "A single diagnostics object sent by WakaTime CLI"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/plugins/errors [post]
|
// @Router /plugins/errors [post]
|
||||||
func (h *DiagnosticsApiHandler) Post(w http.ResponseWriter, r *http.Request) {
|
func (h *DiagnosticsApiHandler) Post(w http.ResponseWriter, r *http.Request) {
|
||||||
var diagnostics models.Diagnostics
|
var diagnostics models.Diagnostics
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,10 @@ package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type HealthApiHandler struct {
|
type HealthApiHandler struct {
|
||||||
|
@ -25,7 +26,7 @@ func (h *HealthApiHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Tags misc
|
// @Tags misc
|
||||||
// @Produce plain
|
// @Produce plain
|
||||||
// @Success 200 {string} string
|
// @Success 200 {string} string
|
||||||
// @Router /api/health [get]
|
// @Router /health [get]
|
||||||
func (h *HealthApiHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *HealthApiHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
var dbStatus int
|
var dbStatus int
|
||||||
if sqlDb, err := h.db.DB(); err == nil {
|
if sqlDb, err := h.db.DB(); err == nil {
|
||||||
|
|
|
@ -3,6 +3,9 @@ package api
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"io/ioutil"
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
|
@ -10,8 +13,6 @@ import (
|
||||||
routeutils "github.com/muety/wakapi/routes/utils"
|
routeutils "github.com/muety/wakapi/routes/utils"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"io/ioutil"
|
|
||||||
"net/http"
|
|
||||||
|
|
||||||
"github.com/muety/wakapi/models"
|
"github.com/muety/wakapi/models"
|
||||||
)
|
)
|
||||||
|
@ -60,7 +61,7 @@ func (h *HeartbeatApiHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/heartbeat [post]
|
// @Router /heartbeat [post]
|
||||||
func (h *HeartbeatApiHandler) Post(w http.ResponseWriter, r *http.Request) {
|
func (h *HeartbeatApiHandler) Post(w http.ResponseWriter, r *http.Request) {
|
||||||
user, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
user, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -182,7 +183,7 @@ func constructSuccessResponse(n int) *heartbeatResponseVm {
|
||||||
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/v1/users/{user}/heartbeats [post]
|
// @Router /v1/users/{user}/heartbeats [post]
|
||||||
func (h *HeartbeatApiHandler) postAlias1() {}
|
func (h *HeartbeatApiHandler) postAlias1() {}
|
||||||
|
|
||||||
// @Summary Push a new heartbeat
|
// @Summary Push a new heartbeat
|
||||||
|
@ -192,7 +193,7 @@ func (h *HeartbeatApiHandler) postAlias1() {}
|
||||||
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/compat/wakatime/v1/users/{user}/heartbeats [post]
|
// @Router /compat/wakatime/v1/users/{user}/heartbeats [post]
|
||||||
func (h *HeartbeatApiHandler) postAlias2() {}
|
func (h *HeartbeatApiHandler) postAlias2() {}
|
||||||
|
|
||||||
// @Summary Push a new heartbeat
|
// @Summary Push a new heartbeat
|
||||||
|
@ -202,7 +203,7 @@ func (h *HeartbeatApiHandler) postAlias2() {}
|
||||||
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
// @Param heartbeat body models.Heartbeat true "A single heartbeat"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/users/{user}/heartbeats [post]
|
// @Router /users/{user}/heartbeats [post]
|
||||||
func (h *HeartbeatApiHandler) postAlias3() {}
|
func (h *HeartbeatApiHandler) postAlias3() {}
|
||||||
|
|
||||||
// @Summary Push new heartbeats
|
// @Summary Push new heartbeats
|
||||||
|
@ -212,7 +213,7 @@ func (h *HeartbeatApiHandler) postAlias3() {}
|
||||||
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/heartbeats [post]
|
// @Router /heartbeats [post]
|
||||||
func (h *HeartbeatApiHandler) postAlias4() {}
|
func (h *HeartbeatApiHandler) postAlias4() {}
|
||||||
|
|
||||||
// @Summary Push new heartbeats
|
// @Summary Push new heartbeats
|
||||||
|
@ -222,7 +223,7 @@ func (h *HeartbeatApiHandler) postAlias4() {}
|
||||||
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/v1/users/{user}/heartbeats.bulk [post]
|
// @Router /v1/users/{user}/heartbeats.bulk [post]
|
||||||
func (h *HeartbeatApiHandler) postAlias5() {}
|
func (h *HeartbeatApiHandler) postAlias5() {}
|
||||||
|
|
||||||
// @Summary Push new heartbeats
|
// @Summary Push new heartbeats
|
||||||
|
@ -232,7 +233,7 @@ func (h *HeartbeatApiHandler) postAlias5() {}
|
||||||
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/compat/wakatime/v1/users/{user}/heartbeats.bulk [post]
|
// @Router /compat/wakatime/v1/users/{user}/heartbeats.bulk [post]
|
||||||
func (h *HeartbeatApiHandler) postAlias6() {}
|
func (h *HeartbeatApiHandler) postAlias6() {}
|
||||||
|
|
||||||
// @Summary Push new heartbeats
|
// @Summary Push new heartbeats
|
||||||
|
@ -242,5 +243,5 @@ func (h *HeartbeatApiHandler) postAlias6() {}
|
||||||
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
// @Param heartbeat body []models.Heartbeat true "Multiple heartbeats"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 201
|
// @Success 201
|
||||||
// @Router /api/users/{user}/heartbeats.bulk [post]
|
// @Router /users/{user}/heartbeats.bulk [post]
|
||||||
func (h *HeartbeatApiHandler) postAlias7() {}
|
func (h *HeartbeatApiHandler) postAlias7() {}
|
||||||
|
|
|
@ -1,13 +1,14 @@
|
||||||
package api
|
package api
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
su "github.com/muety/wakapi/routes/utils"
|
su "github.com/muety/wakapi/routes/utils"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SummaryApiHandler struct {
|
type SummaryApiHandler struct {
|
||||||
|
@ -42,7 +43,7 @@ func (h *SummaryApiHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param recompute query bool false "Whether to recompute the summary from raw heartbeat or use cache"
|
// @Param recompute query bool false "Whether to recompute the summary from raw heartbeat or use cache"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 200 {object} models.Summary
|
// @Success 200 {object} models.Summary
|
||||||
// @Router /api/summary [get]
|
// @Router /summary [get]
|
||||||
func (h *SummaryApiHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *SummaryApiHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
summary, err, status := su.LoadUserSummary(h.summarySrvc, r)
|
summary, err, status := su.LoadUserSummary(h.summarySrvc, r)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -2,6 +2,10 @@ package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"net/http"
|
||||||
|
"regexp"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/models"
|
"github.com/muety/wakapi/models"
|
||||||
|
@ -9,9 +13,6 @@ import (
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"github.com/patrickmn/go-cache"
|
"github.com/patrickmn/go-cache"
|
||||||
"net/http"
|
|
||||||
"regexp"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -50,7 +51,7 @@ func (h *BadgeHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param interval path string true "Interval to aggregate data for" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any)
|
// @Param interval path string true "Interval to aggregate data for" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any)
|
||||||
// @Param filter path string true "Filter to apply (e.g. 'project:wakapi' or 'language:Go')"
|
// @Param filter path string true "Filter to apply (e.g. 'project:wakapi' or 'language:Go')"
|
||||||
// @Success 200 {object} v1.BadgeData
|
// @Success 200 {object} v1.BadgeData
|
||||||
// @Router /api/compat/shields/v1/{user}/{interval}/{filter} [get]
|
// @Router /compat/shields/v1/{user}/{interval}/{filter} [get]
|
||||||
func (h *BadgeHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *BadgeHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
intervalReg := regexp.MustCompile(intervalPattern)
|
intervalReg := regexp.MustCompile(intervalPattern)
|
||||||
entityFilterReg := regexp.MustCompile(entityFilterPattern)
|
entityFilterReg := regexp.MustCompile(entityFilterPattern)
|
||||||
|
|
|
@ -1,6 +1,10 @@
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
|
@ -9,9 +13,6 @@ import (
|
||||||
routeutils "github.com/muety/wakapi/routes/utils"
|
routeutils "github.com/muety/wakapi/routes/utils"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"net/http"
|
|
||||||
"net/url"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AllTimeHandler struct {
|
type AllTimeHandler struct {
|
||||||
|
@ -44,7 +45,7 @@ func (h *AllTimeHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param user path string true "User ID to fetch data for (or 'current')"
|
// @Param user path string true "User ID to fetch data for (or 'current')"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 200 {object} v1.AllTimeViewModel
|
// @Success 200 {object} v1.AllTimeViewModel
|
||||||
// @Router /api/compat/wakatime/v1/users/{user}/all_time_since_today [get]
|
// @Router /compat/wakatime/v1/users/{user}/all_time_since_today [get]
|
||||||
func (h *AllTimeHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *AllTimeHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
values, _ := url.ParseQuery(r.URL.RawQuery)
|
values, _ := url.ParseQuery(r.URL.RawQuery)
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
|
@ -9,8 +12,6 @@ import (
|
||||||
routeutils "github.com/muety/wakapi/routes/utils"
|
routeutils "github.com/muety/wakapi/routes/utils"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type ProjectsHandler struct {
|
type ProjectsHandler struct {
|
||||||
|
@ -44,7 +45,7 @@ func (h *ProjectsHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param q query string true "Query to filter projects by"
|
// @Param q query string true "Query to filter projects by"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 200 {object} v1.ProjectsViewModel
|
// @Success 200 {object} v1.ProjectsViewModel
|
||||||
// @Router /api/compat/wakatime/v1/users/{user}/projects [get]
|
// @Router /compat/wakatime/v1/users/{user}/projects [get]
|
||||||
func (h *ProjectsHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *ProjectsHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
user, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
user, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
|
@ -8,8 +11,6 @@ import (
|
||||||
v1 "github.com/muety/wakapi/models/compat/wakatime/v1"
|
v1 "github.com/muety/wakapi/models/compat/wakatime/v1"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"net/http"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type StatsHandler struct {
|
type StatsHandler struct {
|
||||||
|
@ -50,7 +51,7 @@ func (h *StatsHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param range path string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any)
|
// @Param range path string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any)
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 200 {object} v1.StatsViewModel
|
// @Success 200 {object} v1.StatsViewModel
|
||||||
// @Router /api/compat/wakatime/v1/users/{user}/stats/{range} [get]
|
// @Router /compat/wakatime/v1/users/{user}/stats/{range} [get]
|
||||||
func (h *StatsHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *StatsHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
var vars = mux.Vars(r)
|
var vars = mux.Vars(r)
|
||||||
var authorizedUser, requestedUser *models.User
|
var authorizedUser, requestedUser *models.User
|
||||||
|
|
|
@ -52,7 +52,7 @@ func (h *StatusBarHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param user path string true "User ID to fetch data for (or 'current')"
|
// @Param user path string true "User ID to fetch data for (or 'current')"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 200 {object} StatusBarViewModel
|
// @Success 200 {object} StatusBarViewModel
|
||||||
// @Router /api/users/{user}/statusbar/today [get]
|
// @Router /users/{user}/statusbar/today [get]
|
||||||
func (h *StatusBarHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *StatusBarHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
user, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
user, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -2,6 +2,10 @@ package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"errors"
|
"errors"
|
||||||
|
"net/http"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
|
@ -10,9 +14,6 @@ import (
|
||||||
routeutils "github.com/muety/wakapi/routes/utils"
|
routeutils "github.com/muety/wakapi/routes/utils"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"net/http"
|
|
||||||
"strings"
|
|
||||||
"time"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type SummariesHandler struct {
|
type SummariesHandler struct {
|
||||||
|
@ -53,7 +54,7 @@ func (h *SummariesHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param end query string false "End date (e.g. '2021-02-08')"
|
// @Param end query string false "End date (e.g. '2021-02-08')"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 200 {object} v1.SummariesViewModel
|
// @Success 200 {object} v1.SummariesViewModel
|
||||||
// @Router /api/compat/wakatime/v1/users/{user}/summaries [get]
|
// @Router /compat/wakatime/v1/users/{user}/summaries [get]
|
||||||
func (h *SummariesHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *SummariesHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
_, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
_, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
package v1
|
package v1
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"net/http"
|
||||||
|
|
||||||
"github.com/gorilla/mux"
|
"github.com/gorilla/mux"
|
||||||
conf "github.com/muety/wakapi/config"
|
conf "github.com/muety/wakapi/config"
|
||||||
"github.com/muety/wakapi/middlewares"
|
"github.com/muety/wakapi/middlewares"
|
||||||
|
@ -8,7 +10,6 @@ import (
|
||||||
routeutils "github.com/muety/wakapi/routes/utils"
|
routeutils "github.com/muety/wakapi/routes/utils"
|
||||||
"github.com/muety/wakapi/services"
|
"github.com/muety/wakapi/services"
|
||||||
"github.com/muety/wakapi/utils"
|
"github.com/muety/wakapi/utils"
|
||||||
"net/http"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type UsersHandler struct {
|
type UsersHandler struct {
|
||||||
|
@ -41,7 +42,7 @@ func (h *UsersHandler) RegisterRoutes(router *mux.Router) {
|
||||||
// @Param user path string true "User ID to fetch (or 'current')"
|
// @Param user path string true "User ID to fetch (or 'current')"
|
||||||
// @Security ApiKeyAuth
|
// @Security ApiKeyAuth
|
||||||
// @Success 200 {object} v1.UserViewModel
|
// @Success 200 {object} v1.UserViewModel
|
||||||
// @Router /api/compat/wakatime/v1/users/{user} [get]
|
// @Router /compat/wakatime/v1/users/{user} [get]
|
||||||
func (h *UsersHandler) Get(w http.ResponseWriter, r *http.Request) {
|
func (h *UsersHandler) Get(w http.ResponseWriter, r *http.Request) {
|
||||||
wakapiUser, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
wakapiUser, err := routeutils.CheckEffectiveUser(w, r, h.userSrvc, "current")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
// GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
// Package docs GENERATED BY THE COMMAND ABOVE; DO NOT EDIT
|
||||||
// This file was generated by swaggo/swag
|
// This file was generated by swaggo/swag
|
||||||
|
|
||||||
package docs
|
package docs
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"strings"
|
"strings"
|
||||||
|
"text/template"
|
||||||
|
|
||||||
"github.com/alecthomas/template"
|
|
||||||
"github.com/swaggo/swag"
|
"github.com/swaggo/swag"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -16,7 +15,7 @@ var doc = `{
|
||||||
"schemes": {{ marshal .Schemes }},
|
"schemes": {{ marshal .Schemes }},
|
||||||
"swagger": "2.0",
|
"swagger": "2.0",
|
||||||
"info": {
|
"info": {
|
||||||
"description": "{{.Description}}",
|
"description": "{{escape .Description}}",
|
||||||
"title": "{{.Title}}",
|
"title": "{{.Title}}",
|
||||||
"contact": {
|
"contact": {
|
||||||
"name": "Ferdinand Mütsch",
|
"name": "Ferdinand Mütsch",
|
||||||
|
@ -32,7 +31,7 @@ var doc = `{
|
||||||
"host": "{{.Host}}",
|
"host": "{{.Host}}",
|
||||||
"basePath": "{{.BasePath}}",
|
"basePath": "{{.BasePath}}",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/compat/shields/v1/{user}/{interval}/{filter}": {
|
"/compat/shields/v1/{user}/{interval}/{filter}": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Retrieve total time for a given entity (e.g. a project) within a given range (e.g. one week) in a format compatible with [Shields.io](https://shields.io/endpoint). Requires public data access to be allowed.",
|
"description": "Retrieve total time for a given entity (e.g. a project) within a given range (e.g. one week) in a format compatible with [Shields.io](https://shields.io/endpoint). Requires public data access to be allowed.",
|
||||||
"produces": [
|
"produces": [
|
||||||
|
@ -90,7 +89,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}": {
|
"/compat/wakatime/v1/users/{user}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -125,7 +124,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/all_time_since_today": {
|
"/compat/wakatime/v1/users/{user}/all_time_since_today": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -160,7 +159,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/heartbeats": {
|
"/compat/wakatime/v1/users/{user}/heartbeats": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -193,7 +192,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/heartbeats.bulk": {
|
"/compat/wakatime/v1/users/{user}/heartbeats.bulk": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -229,7 +228,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/projects": {
|
"/compat/wakatime/v1/users/{user}/projects": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -271,7 +270,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/stats/{range}": {
|
"/compat/wakatime/v1/users/{user}/stats/{range}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -326,7 +325,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/summaries": {
|
"/compat/wakatime/v1/users/{user}/summaries": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -393,7 +392,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/health": {
|
"/health": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"text/plain"
|
"text/plain"
|
||||||
|
@ -413,7 +412,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/heartbeat": {
|
"/heartbeat": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -446,7 +445,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/heartbeats": {
|
"/heartbeats": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -482,7 +481,7 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/plugins/errors": {
|
"/plugins/errors": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -515,244 +514,6 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/summary": {
|
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"summary"
|
|
||||||
],
|
|
||||||
"summary": "Retrieve a summary",
|
|
||||||
"operationId": "get-summary",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"enum": [
|
|
||||||
"today",
|
|
||||||
"yesterday",
|
|
||||||
"week",
|
|
||||||
"month",
|
|
||||||
"year",
|
|
||||||
"7_days",
|
|
||||||
"last_7_days",
|
|
||||||
"30_days",
|
|
||||||
"last_30_days",
|
|
||||||
"12_months",
|
|
||||||
"last_12_months",
|
|
||||||
"any"
|
|
||||||
],
|
|
||||||
"type": "string",
|
|
||||||
"description": "Interval identifier",
|
|
||||||
"name": "interval",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "Start date (e.g. '2021-02-07')",
|
|
||||||
"name": "from",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "End date (e.g. '2021-02-08')",
|
|
||||||
"name": "to",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Whether to recompute the summary from raw heartbeat or use cache",
|
|
||||||
"name": "recompute",
|
|
||||||
"in": "query"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.Summary"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/{user}/heartbeats": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push a new heartbeat",
|
|
||||||
"operationId": "post-heartbeat-4",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "A single heartbeat",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/{user}/heartbeats.bulk": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push new heartbeats",
|
|
||||||
"operationId": "post-heartbeat-8",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "Multiple heartbeats",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/{user}/statusbar/today": {
|
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Mimics https://wakatime.com/api/v1/users/current/statusbar/today. Have no official documentation",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"wakatime"
|
|
||||||
],
|
|
||||||
"summary": "Retrieve summary for statusbar",
|
|
||||||
"operationId": "statusbar",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "User ID to fetch data for (or 'current')",
|
|
||||||
"name": "user",
|
|
||||||
"in": "path",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/v1.StatusBarViewModel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/users/{user}/heartbeats": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push a new heartbeat",
|
|
||||||
"operationId": "post-heartbeat-2",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "A single heartbeat",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/users/{user}/heartbeats.bulk": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push new heartbeats",
|
|
||||||
"operationId": "post-heartbeat-6",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "Multiple heartbeats",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/relay": {
|
"/relay": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -904,6 +665,244 @@ var doc = `{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/summary": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"summary"
|
||||||
|
],
|
||||||
|
"summary": "Retrieve a summary",
|
||||||
|
"operationId": "get-summary",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"today",
|
||||||
|
"yesterday",
|
||||||
|
"week",
|
||||||
|
"month",
|
||||||
|
"year",
|
||||||
|
"7_days",
|
||||||
|
"last_7_days",
|
||||||
|
"30_days",
|
||||||
|
"last_30_days",
|
||||||
|
"12_months",
|
||||||
|
"last_12_months",
|
||||||
|
"any"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "Interval identifier",
|
||||||
|
"name": "interval",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Start date (e.g. '2021-02-07')",
|
||||||
|
"name": "from",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "End date (e.g. '2021-02-08')",
|
||||||
|
"name": "to",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether to recompute the summary from raw heartbeat or use cache",
|
||||||
|
"name": "recompute",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Summary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{user}/heartbeats": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push a new heartbeat",
|
||||||
|
"operationId": "post-heartbeat-4",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "A single heartbeat",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{user}/heartbeats.bulk": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push new heartbeats",
|
||||||
|
"operationId": "post-heartbeat-8",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Multiple heartbeats",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{user}/statusbar/today": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Mimics https://wakatime.com/api/v1/users/current/statusbar/today. Have no official documentation",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"wakatime"
|
||||||
|
],
|
||||||
|
"summary": "Retrieve summary for statusbar",
|
||||||
|
"operationId": "statusbar",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "User ID to fetch data for (or 'current')",
|
||||||
|
"name": "user",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/v1.StatusBarViewModel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/users/{user}/heartbeats": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push a new heartbeat",
|
||||||
|
"operationId": "post-heartbeat-2",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "A single heartbeat",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/users/{user}/heartbeats.bulk": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push new heartbeats",
|
||||||
|
"operationId": "post-heartbeat-6",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Multiple heartbeats",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
@ -1449,6 +1448,13 @@ func (s *s) ReadDoc() string {
|
||||||
a, _ := json.Marshal(v)
|
a, _ := json.Marshal(v)
|
||||||
return string(a)
|
return string(a)
|
||||||
},
|
},
|
||||||
|
"escape": func(v interface{}) string {
|
||||||
|
// escape tabs
|
||||||
|
str := strings.Replace(v.(string), "\t", "\\t", -1)
|
||||||
|
// replace " with \", and if that results in \\", replace that with \\\"
|
||||||
|
str = strings.Replace(str, "\"", "\\\"", -1)
|
||||||
|
return strings.Replace(str, "\\\\\"", "\\\\\\\"", -1)
|
||||||
|
},
|
||||||
}).Parse(doc)
|
}).Parse(doc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return doc
|
return doc
|
||||||
|
@ -1463,5 +1469,5 @@ func (s *s) ReadDoc() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
swag.Register(swag.Name, &s{})
|
swag.Register("swagger", &s{})
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
},
|
},
|
||||||
"basePath": "/api",
|
"basePath": "/api",
|
||||||
"paths": {
|
"paths": {
|
||||||
"/api/compat/shields/v1/{user}/{interval}/{filter}": {
|
"/compat/shields/v1/{user}/{interval}/{filter}": {
|
||||||
"get": {
|
"get": {
|
||||||
"description": "Retrieve total time for a given entity (e.g. a project) within a given range (e.g. one week) in a format compatible with [Shields.io](https://shields.io/endpoint). Requires public data access to be allowed.",
|
"description": "Retrieve total time for a given entity (e.g. a project) within a given range (e.g. one week) in a format compatible with [Shields.io](https://shields.io/endpoint). Requires public data access to be allowed.",
|
||||||
"produces": [
|
"produces": [
|
||||||
|
@ -74,7 +74,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}": {
|
"/compat/wakatime/v1/users/{user}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -109,7 +109,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/all_time_since_today": {
|
"/compat/wakatime/v1/users/{user}/all_time_since_today": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -144,7 +144,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/heartbeats": {
|
"/compat/wakatime/v1/users/{user}/heartbeats": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/heartbeats.bulk": {
|
"/compat/wakatime/v1/users/{user}/heartbeats.bulk": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -213,7 +213,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/projects": {
|
"/compat/wakatime/v1/users/{user}/projects": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/stats/{range}": {
|
"/compat/wakatime/v1/users/{user}/stats/{range}": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -310,7 +310,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/compat/wakatime/v1/users/{user}/summaries": {
|
"/compat/wakatime/v1/users/{user}/summaries": {
|
||||||
"get": {
|
"get": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -377,7 +377,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/health": {
|
"/health": {
|
||||||
"get": {
|
"get": {
|
||||||
"produces": [
|
"produces": [
|
||||||
"text/plain"
|
"text/plain"
|
||||||
|
@ -397,7 +397,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/heartbeat": {
|
"/heartbeat": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -430,7 +430,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/heartbeats": {
|
"/heartbeats": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -466,7 +466,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/plugins/errors": {
|
"/plugins/errors": {
|
||||||
"post": {
|
"post": {
|
||||||
"security": [
|
"security": [
|
||||||
{
|
{
|
||||||
|
@ -499,244 +499,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"/api/summary": {
|
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"summary"
|
|
||||||
],
|
|
||||||
"summary": "Retrieve a summary",
|
|
||||||
"operationId": "get-summary",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"enum": [
|
|
||||||
"today",
|
|
||||||
"yesterday",
|
|
||||||
"week",
|
|
||||||
"month",
|
|
||||||
"year",
|
|
||||||
"7_days",
|
|
||||||
"last_7_days",
|
|
||||||
"30_days",
|
|
||||||
"last_30_days",
|
|
||||||
"12_months",
|
|
||||||
"last_12_months",
|
|
||||||
"any"
|
|
||||||
],
|
|
||||||
"type": "string",
|
|
||||||
"description": "Interval identifier",
|
|
||||||
"name": "interval",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "Start date (e.g. '2021-02-07')",
|
|
||||||
"name": "from",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "End date (e.g. '2021-02-08')",
|
|
||||||
"name": "to",
|
|
||||||
"in": "query"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Whether to recompute the summary from raw heartbeat or use cache",
|
|
||||||
"name": "recompute",
|
|
||||||
"in": "query"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.Summary"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/{user}/heartbeats": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push a new heartbeat",
|
|
||||||
"operationId": "post-heartbeat-4",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "A single heartbeat",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/{user}/heartbeats.bulk": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push new heartbeats",
|
|
||||||
"operationId": "post-heartbeat-8",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "Multiple heartbeats",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/users/{user}/statusbar/today": {
|
|
||||||
"get": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"description": "Mimics https://wakatime.com/api/v1/users/current/statusbar/today. Have no official documentation",
|
|
||||||
"produces": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"wakatime"
|
|
||||||
],
|
|
||||||
"summary": "Retrieve summary for statusbar",
|
|
||||||
"operationId": "statusbar",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"description": "User ID to fetch data for (or 'current')",
|
|
||||||
"name": "user",
|
|
||||||
"in": "path",
|
|
||||||
"required": true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"200": {
|
|
||||||
"description": "OK",
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/v1.StatusBarViewModel"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/users/{user}/heartbeats": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push a new heartbeat",
|
|
||||||
"operationId": "post-heartbeat-2",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "A single heartbeat",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/api/v1/users/{user}/heartbeats.bulk": {
|
|
||||||
"post": {
|
|
||||||
"security": [
|
|
||||||
{
|
|
||||||
"ApiKeyAuth": []
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"consumes": [
|
|
||||||
"application/json"
|
|
||||||
],
|
|
||||||
"tags": [
|
|
||||||
"heartbeat"
|
|
||||||
],
|
|
||||||
"summary": "Push new heartbeats",
|
|
||||||
"operationId": "post-heartbeat-6",
|
|
||||||
"parameters": [
|
|
||||||
{
|
|
||||||
"description": "Multiple heartbeats",
|
|
||||||
"name": "heartbeat",
|
|
||||||
"in": "body",
|
|
||||||
"required": true,
|
|
||||||
"schema": {
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"$ref": "#/definitions/models.Heartbeat"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"responses": {
|
|
||||||
"201": {
|
|
||||||
"description": ""
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"/relay": {
|
"/relay": {
|
||||||
"get": {
|
"get": {
|
||||||
"tags": [
|
"tags": [
|
||||||
|
@ -888,6 +650,244 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"/summary": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"summary"
|
||||||
|
],
|
||||||
|
"summary": "Retrieve a summary",
|
||||||
|
"operationId": "get-summary",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"enum": [
|
||||||
|
"today",
|
||||||
|
"yesterday",
|
||||||
|
"week",
|
||||||
|
"month",
|
||||||
|
"year",
|
||||||
|
"7_days",
|
||||||
|
"last_7_days",
|
||||||
|
"30_days",
|
||||||
|
"last_30_days",
|
||||||
|
"12_months",
|
||||||
|
"last_12_months",
|
||||||
|
"any"
|
||||||
|
],
|
||||||
|
"type": "string",
|
||||||
|
"description": "Interval identifier",
|
||||||
|
"name": "interval",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "Start date (e.g. '2021-02-07')",
|
||||||
|
"name": "from",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "End date (e.g. '2021-02-08')",
|
||||||
|
"name": "to",
|
||||||
|
"in": "query"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether to recompute the summary from raw heartbeat or use cache",
|
||||||
|
"name": "recompute",
|
||||||
|
"in": "query"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Summary"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{user}/heartbeats": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push a new heartbeat",
|
||||||
|
"operationId": "post-heartbeat-4",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "A single heartbeat",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{user}/heartbeats.bulk": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push new heartbeats",
|
||||||
|
"operationId": "post-heartbeat-8",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Multiple heartbeats",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/users/{user}/statusbar/today": {
|
||||||
|
"get": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "Mimics https://wakatime.com/api/v1/users/current/statusbar/today. Have no official documentation",
|
||||||
|
"produces": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"wakatime"
|
||||||
|
],
|
||||||
|
"summary": "Retrieve summary for statusbar",
|
||||||
|
"operationId": "statusbar",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"description": "User ID to fetch data for (or 'current')",
|
||||||
|
"name": "user",
|
||||||
|
"in": "path",
|
||||||
|
"required": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"200": {
|
||||||
|
"description": "OK",
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/v1.StatusBarViewModel"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/users/{user}/heartbeats": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push a new heartbeat",
|
||||||
|
"operationId": "post-heartbeat-2",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "A single heartbeat",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"/v1/users/{user}/heartbeats.bulk": {
|
||||||
|
"post": {
|
||||||
|
"security": [
|
||||||
|
{
|
||||||
|
"ApiKeyAuth": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"consumes": [
|
||||||
|
"application/json"
|
||||||
|
],
|
||||||
|
"tags": [
|
||||||
|
"heartbeat"
|
||||||
|
],
|
||||||
|
"summary": "Push new heartbeats",
|
||||||
|
"operationId": "post-heartbeat-6",
|
||||||
|
"parameters": [
|
||||||
|
{
|
||||||
|
"description": "Multiple heartbeats",
|
||||||
|
"name": "heartbeat",
|
||||||
|
"in": "body",
|
||||||
|
"required": true,
|
||||||
|
"schema": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/definitions/models.Heartbeat"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"responses": {
|
||||||
|
"201": {
|
||||||
|
"description": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"definitions": {
|
"definitions": {
|
||||||
|
|
|
@ -351,7 +351,7 @@ info:
|
||||||
title: Wakapi API
|
title: Wakapi API
|
||||||
version: "1.0"
|
version: "1.0"
|
||||||
paths:
|
paths:
|
||||||
/api/compat/shields/v1/{user}/{interval}/{filter}:
|
/compat/shields/v1/{user}/{interval}/{filter}:
|
||||||
get:
|
get:
|
||||||
description: Retrieve total time for a given entity (e.g. a project) within
|
description: Retrieve total time for a given entity (e.g. a project) within
|
||||||
a given range (e.g. one week) in a format compatible with [Shields.io](https://shields.io/endpoint).
|
a given range (e.g. one week) in a format compatible with [Shields.io](https://shields.io/endpoint).
|
||||||
|
@ -396,7 +396,7 @@ paths:
|
||||||
summary: Get badge data
|
summary: Get badge data
|
||||||
tags:
|
tags:
|
||||||
- badges
|
- badges
|
||||||
/api/compat/wakatime/v1/users/{user}:
|
/compat/wakatime/v1/users/{user}:
|
||||||
get:
|
get:
|
||||||
description: Mimics https://wakatime.com/developers#users
|
description: Mimics https://wakatime.com/developers#users
|
||||||
operationId: get-wakatime-user
|
operationId: get-wakatime-user
|
||||||
|
@ -418,7 +418,7 @@ paths:
|
||||||
summary: Retrieve the given user
|
summary: Retrieve the given user
|
||||||
tags:
|
tags:
|
||||||
- wakatime
|
- wakatime
|
||||||
/api/compat/wakatime/v1/users/{user}/all_time_since_today:
|
/compat/wakatime/v1/users/{user}/all_time_since_today:
|
||||||
get:
|
get:
|
||||||
description: Mimics https://wakatime.com/developers#all_time_since_today
|
description: Mimics https://wakatime.com/developers#all_time_since_today
|
||||||
operationId: get-all-time
|
operationId: get-all-time
|
||||||
|
@ -440,7 +440,7 @@ paths:
|
||||||
summary: Retrieve summary for all time
|
summary: Retrieve summary for all time
|
||||||
tags:
|
tags:
|
||||||
- wakatime
|
- wakatime
|
||||||
/api/compat/wakatime/v1/users/{user}/heartbeats:
|
/compat/wakatime/v1/users/{user}/heartbeats:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
@ -460,7 +460,7 @@ paths:
|
||||||
summary: Push a new heartbeat
|
summary: Push a new heartbeat
|
||||||
tags:
|
tags:
|
||||||
- heartbeat
|
- heartbeat
|
||||||
/api/compat/wakatime/v1/users/{user}/heartbeats.bulk:
|
/compat/wakatime/v1/users/{user}/heartbeats.bulk:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
@ -482,7 +482,7 @@ paths:
|
||||||
summary: Push new heartbeats
|
summary: Push new heartbeats
|
||||||
tags:
|
tags:
|
||||||
- heartbeat
|
- heartbeat
|
||||||
/api/compat/wakatime/v1/users/{user}/projects:
|
/compat/wakatime/v1/users/{user}/projects:
|
||||||
get:
|
get:
|
||||||
description: Mimics https://wakatime.com/developers#projects
|
description: Mimics https://wakatime.com/developers#projects
|
||||||
operationId: get-wakatime-projects
|
operationId: get-wakatime-projects
|
||||||
|
@ -509,7 +509,7 @@ paths:
|
||||||
summary: Retrieve and fitler the user's projects
|
summary: Retrieve and fitler the user's projects
|
||||||
tags:
|
tags:
|
||||||
- wakatime
|
- wakatime
|
||||||
/api/compat/wakatime/v1/users/{user}/stats/{range}:
|
/compat/wakatime/v1/users/{user}/stats/{range}:
|
||||||
get:
|
get:
|
||||||
description: Mimics https://wakatime.com/developers#stats
|
description: Mimics https://wakatime.com/developers#stats
|
||||||
operationId: get-wakatimes-tats
|
operationId: get-wakatimes-tats
|
||||||
|
@ -548,7 +548,7 @@ paths:
|
||||||
summary: Retrieve statistics for a given user
|
summary: Retrieve statistics for a given user
|
||||||
tags:
|
tags:
|
||||||
- wakatime
|
- wakatime
|
||||||
/api/compat/wakatime/v1/users/{user}/summaries:
|
/compat/wakatime/v1/users/{user}/summaries:
|
||||||
get:
|
get:
|
||||||
description: Mimics https://wakatime.com/developers#summaries.
|
description: Mimics https://wakatime.com/developers#summaries.
|
||||||
operationId: get-wakatime-summaries
|
operationId: get-wakatime-summaries
|
||||||
|
@ -595,7 +595,7 @@ paths:
|
||||||
summary: Retrieve WakaTime-compatible summaries
|
summary: Retrieve WakaTime-compatible summaries
|
||||||
tags:
|
tags:
|
||||||
- wakatime
|
- wakatime
|
||||||
/api/health:
|
/health:
|
||||||
get:
|
get:
|
||||||
operationId: get-health
|
operationId: get-health
|
||||||
produces:
|
produces:
|
||||||
|
@ -608,7 +608,7 @@ paths:
|
||||||
summary: Check the application's health status
|
summary: Check the application's health status
|
||||||
tags:
|
tags:
|
||||||
- misc
|
- misc
|
||||||
/api/heartbeat:
|
/heartbeat:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
@ -628,7 +628,7 @@ paths:
|
||||||
summary: Push a new heartbeat
|
summary: Push a new heartbeat
|
||||||
tags:
|
tags:
|
||||||
- heartbeat
|
- heartbeat
|
||||||
/api/heartbeats:
|
/heartbeats:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
@ -650,7 +650,7 @@ paths:
|
||||||
summary: Push new heartbeats
|
summary: Push new heartbeats
|
||||||
tags:
|
tags:
|
||||||
- heartbeat
|
- heartbeat
|
||||||
/api/plugins/errors:
|
/plugins/errors:
|
||||||
post:
|
post:
|
||||||
consumes:
|
consumes:
|
||||||
- application/json
|
- application/json
|
||||||
|
@ -670,158 +670,6 @@ paths:
|
||||||
summary: Push a new diagnostics object
|
summary: Push a new diagnostics object
|
||||||
tags:
|
tags:
|
||||||
- diagnostics
|
- diagnostics
|
||||||
/api/summary:
|
|
||||||
get:
|
|
||||||
operationId: get-summary
|
|
||||||
parameters:
|
|
||||||
- description: Interval identifier
|
|
||||||
enum:
|
|
||||||
- today
|
|
||||||
- yesterday
|
|
||||||
- week
|
|
||||||
- month
|
|
||||||
- year
|
|
||||||
- 7_days
|
|
||||||
- last_7_days
|
|
||||||
- 30_days
|
|
||||||
- last_30_days
|
|
||||||
- 12_months
|
|
||||||
- last_12_months
|
|
||||||
- any
|
|
||||||
in: query
|
|
||||||
name: interval
|
|
||||||
type: string
|
|
||||||
- description: Start date (e.g. '2021-02-07')
|
|
||||||
in: query
|
|
||||||
name: from
|
|
||||||
type: string
|
|
||||||
- description: End date (e.g. '2021-02-08')
|
|
||||||
in: query
|
|
||||||
name: to
|
|
||||||
type: string
|
|
||||||
- description: Whether to recompute the summary from raw heartbeat or use cache
|
|
||||||
in: query
|
|
||||||
name: recompute
|
|
||||||
type: boolean
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/models.Summary'
|
|
||||||
security:
|
|
||||||
- ApiKeyAuth: []
|
|
||||||
summary: Retrieve a summary
|
|
||||||
tags:
|
|
||||||
- summary
|
|
||||||
/api/users/{user}/heartbeats:
|
|
||||||
post:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
operationId: post-heartbeat-4
|
|
||||||
parameters:
|
|
||||||
- description: A single heartbeat
|
|
||||||
in: body
|
|
||||||
name: heartbeat
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/models.Heartbeat'
|
|
||||||
responses:
|
|
||||||
"201":
|
|
||||||
description: ""
|
|
||||||
security:
|
|
||||||
- ApiKeyAuth: []
|
|
||||||
summary: Push a new heartbeat
|
|
||||||
tags:
|
|
||||||
- heartbeat
|
|
||||||
/api/users/{user}/heartbeats.bulk:
|
|
||||||
post:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
operationId: post-heartbeat-8
|
|
||||||
parameters:
|
|
||||||
- description: Multiple heartbeats
|
|
||||||
in: body
|
|
||||||
name: heartbeat
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/models.Heartbeat'
|
|
||||||
type: array
|
|
||||||
responses:
|
|
||||||
"201":
|
|
||||||
description: ""
|
|
||||||
security:
|
|
||||||
- ApiKeyAuth: []
|
|
||||||
summary: Push new heartbeats
|
|
||||||
tags:
|
|
||||||
- heartbeat
|
|
||||||
/api/users/{user}/statusbar/today:
|
|
||||||
get:
|
|
||||||
description: Mimics https://wakatime.com/api/v1/users/current/statusbar/today.
|
|
||||||
Have no official documentation
|
|
||||||
operationId: statusbar
|
|
||||||
parameters:
|
|
||||||
- description: User ID to fetch data for (or 'current')
|
|
||||||
in: path
|
|
||||||
name: user
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
responses:
|
|
||||||
"200":
|
|
||||||
description: OK
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/v1.StatusBarViewModel'
|
|
||||||
security:
|
|
||||||
- ApiKeyAuth: []
|
|
||||||
summary: Retrieve summary for statusbar
|
|
||||||
tags:
|
|
||||||
- wakatime
|
|
||||||
/api/v1/users/{user}/heartbeats:
|
|
||||||
post:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
operationId: post-heartbeat-2
|
|
||||||
parameters:
|
|
||||||
- description: A single heartbeat
|
|
||||||
in: body
|
|
||||||
name: heartbeat
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
$ref: '#/definitions/models.Heartbeat'
|
|
||||||
responses:
|
|
||||||
"201":
|
|
||||||
description: ""
|
|
||||||
security:
|
|
||||||
- ApiKeyAuth: []
|
|
||||||
summary: Push a new heartbeat
|
|
||||||
tags:
|
|
||||||
- heartbeat
|
|
||||||
/api/v1/users/{user}/heartbeats.bulk:
|
|
||||||
post:
|
|
||||||
consumes:
|
|
||||||
- application/json
|
|
||||||
operationId: post-heartbeat-6
|
|
||||||
parameters:
|
|
||||||
- description: Multiple heartbeats
|
|
||||||
in: body
|
|
||||||
name: heartbeat
|
|
||||||
required: true
|
|
||||||
schema:
|
|
||||||
items:
|
|
||||||
$ref: '#/definitions/models.Heartbeat'
|
|
||||||
type: array
|
|
||||||
responses:
|
|
||||||
"201":
|
|
||||||
description: ""
|
|
||||||
security:
|
|
||||||
- ApiKeyAuth: []
|
|
||||||
summary: Push new heartbeats
|
|
||||||
tags:
|
|
||||||
- heartbeat
|
|
||||||
/relay:
|
/relay:
|
||||||
delete:
|
delete:
|
||||||
operationId: relay-delete
|
operationId: relay-delete
|
||||||
|
@ -923,6 +771,158 @@ paths:
|
||||||
summary: Proxy an PUT API request to another Wakapi instance
|
summary: Proxy an PUT API request to another Wakapi instance
|
||||||
tags:
|
tags:
|
||||||
- relay
|
- relay
|
||||||
|
/summary:
|
||||||
|
get:
|
||||||
|
operationId: get-summary
|
||||||
|
parameters:
|
||||||
|
- description: Interval identifier
|
||||||
|
enum:
|
||||||
|
- today
|
||||||
|
- yesterday
|
||||||
|
- week
|
||||||
|
- month
|
||||||
|
- year
|
||||||
|
- 7_days
|
||||||
|
- last_7_days
|
||||||
|
- 30_days
|
||||||
|
- last_30_days
|
||||||
|
- 12_months
|
||||||
|
- last_12_months
|
||||||
|
- any
|
||||||
|
in: query
|
||||||
|
name: interval
|
||||||
|
type: string
|
||||||
|
- description: Start date (e.g. '2021-02-07')
|
||||||
|
in: query
|
||||||
|
name: from
|
||||||
|
type: string
|
||||||
|
- description: End date (e.g. '2021-02-08')
|
||||||
|
in: query
|
||||||
|
name: to
|
||||||
|
type: string
|
||||||
|
- description: Whether to recompute the summary from raw heartbeat or use cache
|
||||||
|
in: query
|
||||||
|
name: recompute
|
||||||
|
type: boolean
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.Summary'
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Retrieve a summary
|
||||||
|
tags:
|
||||||
|
- summary
|
||||||
|
/users/{user}/heartbeats:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
operationId: post-heartbeat-4
|
||||||
|
parameters:
|
||||||
|
- description: A single heartbeat
|
||||||
|
in: body
|
||||||
|
name: heartbeat
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.Heartbeat'
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: ""
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Push a new heartbeat
|
||||||
|
tags:
|
||||||
|
- heartbeat
|
||||||
|
/users/{user}/heartbeats.bulk:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
operationId: post-heartbeat-8
|
||||||
|
parameters:
|
||||||
|
- description: Multiple heartbeats
|
||||||
|
in: body
|
||||||
|
name: heartbeat
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/models.Heartbeat'
|
||||||
|
type: array
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: ""
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Push new heartbeats
|
||||||
|
tags:
|
||||||
|
- heartbeat
|
||||||
|
/users/{user}/statusbar/today:
|
||||||
|
get:
|
||||||
|
description: Mimics https://wakatime.com/api/v1/users/current/statusbar/today.
|
||||||
|
Have no official documentation
|
||||||
|
operationId: statusbar
|
||||||
|
parameters:
|
||||||
|
- description: User ID to fetch data for (or 'current')
|
||||||
|
in: path
|
||||||
|
name: user
|
||||||
|
required: true
|
||||||
|
type: string
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/v1.StatusBarViewModel'
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Retrieve summary for statusbar
|
||||||
|
tags:
|
||||||
|
- wakatime
|
||||||
|
/v1/users/{user}/heartbeats:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
operationId: post-heartbeat-2
|
||||||
|
parameters:
|
||||||
|
- description: A single heartbeat
|
||||||
|
in: body
|
||||||
|
name: heartbeat
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: '#/definitions/models.Heartbeat'
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: ""
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Push a new heartbeat
|
||||||
|
tags:
|
||||||
|
- heartbeat
|
||||||
|
/v1/users/{user}/heartbeats.bulk:
|
||||||
|
post:
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
operationId: post-heartbeat-6
|
||||||
|
parameters:
|
||||||
|
- description: Multiple heartbeats
|
||||||
|
in: body
|
||||||
|
name: heartbeat
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
items:
|
||||||
|
$ref: '#/definitions/models.Heartbeat'
|
||||||
|
type: array
|
||||||
|
responses:
|
||||||
|
"201":
|
||||||
|
description: ""
|
||||||
|
security:
|
||||||
|
- ApiKeyAuth: []
|
||||||
|
summary: Push new heartbeats
|
||||||
|
tags:
|
||||||
|
- heartbeat
|
||||||
securityDefinitions:
|
securityDefinitions:
|
||||||
ApiKeyAuth:
|
ApiKeyAuth:
|
||||||
in: header
|
in: header
|
||||||
|
|
Loading…
Reference in New Issue
Block a user