1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

fix: swagger /api/api duplication

Resolves #289
This commit is contained in:
Steven Tang
2022-01-02 11:22:58 +11:00
parent aaa907a7b2
commit 9950da3e7e
14 changed files with 722 additions and 706 deletions

View File

@ -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
package docs
import (
"bytes"
"encoding/json"
"strings"
"text/template"
"github.com/alecthomas/template"
"github.com/swaggo/swag"
)
@ -16,7 +15,7 @@ var doc = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{.Description}}",
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {
"name": "Ferdinand Mütsch",
@ -32,7 +31,7 @@ var doc = `{
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/api/compat/shields/v1/{user}/{interval}/{filter}": {
"/compat/shields/v1/{user}/{interval}/{filter}": {
"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.",
"produces": [
@ -90,7 +89,7 @@ var doc = `{
}
}
},
"/api/compat/wakatime/v1/users/{user}": {
"/compat/wakatime/v1/users/{user}": {
"get": {
"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": {
"security": [
{
@ -160,7 +159,7 @@ var doc = `{
}
}
},
"/api/compat/wakatime/v1/users/{user}/heartbeats": {
"/compat/wakatime/v1/users/{user}/heartbeats": {
"post": {
"security": [
{
@ -193,7 +192,7 @@ var doc = `{
}
}
},
"/api/compat/wakatime/v1/users/{user}/heartbeats.bulk": {
"/compat/wakatime/v1/users/{user}/heartbeats.bulk": {
"post": {
"security": [
{
@ -229,7 +228,7 @@ var doc = `{
}
}
},
"/api/compat/wakatime/v1/users/{user}/projects": {
"/compat/wakatime/v1/users/{user}/projects": {
"get": {
"security": [
{
@ -271,7 +270,7 @@ var doc = `{
}
}
},
"/api/compat/wakatime/v1/users/{user}/stats/{range}": {
"/compat/wakatime/v1/users/{user}/stats/{range}": {
"get": {
"security": [
{
@ -326,7 +325,7 @@ var doc = `{
}
}
},
"/api/compat/wakatime/v1/users/{user}/summaries": {
"/compat/wakatime/v1/users/{user}/summaries": {
"get": {
"security": [
{
@ -393,7 +392,7 @@ var doc = `{
}
}
},
"/api/health": {
"/health": {
"get": {
"produces": [
"text/plain"
@ -413,7 +412,7 @@ var doc = `{
}
}
},
"/api/heartbeat": {
"/heartbeat": {
"post": {
"security": [
{
@ -446,7 +445,7 @@ var doc = `{
}
}
},
"/api/heartbeats": {
"/heartbeats": {
"post": {
"security": [
{
@ -482,7 +481,7 @@ var doc = `{
}
}
},
"/api/plugins/errors": {
"/plugins/errors": {
"post": {
"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": {
"get": {
"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": {
@ -1449,6 +1448,13 @@ func (s *s) ReadDoc() string {
a, _ := json.Marshal(v)
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)
if err != nil {
return doc
@ -1463,5 +1469,5 @@ func (s *s) ReadDoc() string {
}
func init() {
swag.Register(swag.Name, &s{})
swag.Register("swagger", &s{})
}