mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
feat: implement wakatime users endpoint (resolve #193)
This commit is contained in:
@ -90,6 +90,41 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mimics https://wakatime.com/developers#users",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"wakatime"
|
||||
],
|
||||
"summary": "Retrieve the given user",
|
||||
"operationId": "get-wakatime-user",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "User ID to fetch (or 'current')",
|
||||
"name": "user",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1.UserViewModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}/all_time_since_today": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -125,6 +160,61 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}/stats/{range}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mimics https://wakatime.com/developers#stats",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"wakatime"
|
||||
],
|
||||
"summary": "Retrieve statistics for a given user",
|
||||
"operationId": "get-wakatimes-tats",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "User ID to fetch data for (or 'current')",
|
||||
"name": "user",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"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": "Range interval identifier",
|
||||
"name": "range",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1.StatsViewModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}/summaries": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -309,57 +399,6 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/users/{user}/stats/{range}": {
|
||||
"get": {
|
||||
"description": "Mimics https://wakatime.com/developers#stats. Requires public data access to be allowed.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"wakatime"
|
||||
],
|
||||
"summary": "Retrieve stats",
|
||||
"operationId": "get-stats",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "User ID to fetch data for (or 'current')",
|
||||
"name": "user",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"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": "Range interval identifier",
|
||||
"name": "range",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1.StatsViewModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@ -372,6 +411,10 @@ var doc = `{
|
||||
"category": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"description": "https://gorm.io/docs/conventions.html#CreatedAt",
|
||||
"type": "number"
|
||||
},
|
||||
"editor": {
|
||||
"description": "ignored because editor might be parsed differently by wakatime",
|
||||
"type": "string"
|
||||
@ -473,6 +516,9 @@ var doc = `{
|
||||
"description": "true if the stats are up to date; when false, a 202 response code is returned and stats will be refreshed soon\u003e",
|
||||
"type": "boolean"
|
||||
},
|
||||
"range": {
|
||||
"$ref": "#/definitions/v1.AllTimeRange"
|
||||
},
|
||||
"text": {
|
||||
"description": "total time logged since account created as human readable string\u003e",
|
||||
"type": "string"
|
||||
@ -483,6 +529,26 @@ var doc = `{
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.AllTimeRange": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"end": {
|
||||
"type": "string"
|
||||
},
|
||||
"end_date": {
|
||||
"type": "string"
|
||||
},
|
||||
"start": {
|
||||
"type": "string"
|
||||
},
|
||||
"start_date": {
|
||||
"type": "string"
|
||||
},
|
||||
"timezone": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.AllTimeViewModel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -710,6 +776,61 @@ var doc = `{
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.User": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"full_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_email_confirmed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"is_email_public": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"last_heartbeat_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_plugin_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_project": {
|
||||
"type": "string"
|
||||
},
|
||||
"modified_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"timezone": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
},
|
||||
"website": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.UserViewModel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/v1.User"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
@ -74,6 +74,41 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mimics https://wakatime.com/developers#users",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"wakatime"
|
||||
],
|
||||
"summary": "Retrieve the given user",
|
||||
"operationId": "get-wakatime-user",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "User ID to fetch (or 'current')",
|
||||
"name": "user",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1.UserViewModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}/all_time_since_today": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -109,6 +144,61 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}/stats/{range}": {
|
||||
"get": {
|
||||
"security": [
|
||||
{
|
||||
"ApiKeyAuth": []
|
||||
}
|
||||
],
|
||||
"description": "Mimics https://wakatime.com/developers#stats",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"wakatime"
|
||||
],
|
||||
"summary": "Retrieve statistics for a given user",
|
||||
"operationId": "get-wakatimes-tats",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "User ID to fetch data for (or 'current')",
|
||||
"name": "user",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"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": "Range interval identifier",
|
||||
"name": "range",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1.StatsViewModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/compat/wakatime/v1/users/{user}/summaries": {
|
||||
"get": {
|
||||
"security": [
|
||||
@ -293,57 +383,6 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"/v1/users/{user}/stats/{range}": {
|
||||
"get": {
|
||||
"description": "Mimics https://wakatime.com/developers#stats. Requires public data access to be allowed.",
|
||||
"produces": [
|
||||
"application/json"
|
||||
],
|
||||
"tags": [
|
||||
"wakatime"
|
||||
],
|
||||
"summary": "Retrieve stats",
|
||||
"operationId": "get-stats",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "User ID to fetch data for (or 'current')",
|
||||
"name": "user",
|
||||
"in": "path",
|
||||
"required": true
|
||||
},
|
||||
{
|
||||
"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": "Range interval identifier",
|
||||
"name": "range",
|
||||
"in": "path",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "OK",
|
||||
"schema": {
|
||||
"$ref": "#/definitions/v1.StatsViewModel"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"definitions": {
|
||||
@ -356,6 +395,10 @@
|
||||
"category": {
|
||||
"type": "string"
|
||||
},
|
||||
"created_at": {
|
||||
"description": "https://gorm.io/docs/conventions.html#CreatedAt",
|
||||
"type": "number"
|
||||
},
|
||||
"editor": {
|
||||
"description": "ignored because editor might be parsed differently by wakatime",
|
||||
"type": "string"
|
||||
@ -457,6 +500,9 @@
|
||||
"description": "true if the stats are up to date; when false, a 202 response code is returned and stats will be refreshed soon\u003e",
|
||||
"type": "boolean"
|
||||
},
|
||||
"range": {
|
||||
"$ref": "#/definitions/v1.AllTimeRange"
|
||||
},
|
||||
"text": {
|
||||
"description": "total time logged since account created as human readable string\u003e",
|
||||
"type": "string"
|
||||
@ -467,6 +513,26 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.AllTimeRange": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"end": {
|
||||
"type": "string"
|
||||
},
|
||||
"end_date": {
|
||||
"type": "string"
|
||||
},
|
||||
"start": {
|
||||
"type": "string"
|
||||
},
|
||||
"start_date": {
|
||||
"type": "string"
|
||||
},
|
||||
"timezone": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.AllTimeViewModel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
@ -694,6 +760,61 @@
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.User": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"created_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"display_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"email": {
|
||||
"type": "string"
|
||||
},
|
||||
"full_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"id": {
|
||||
"type": "string"
|
||||
},
|
||||
"is_email_confirmed": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"is_email_public": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"last_heartbeat_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_plugin_name": {
|
||||
"type": "string"
|
||||
},
|
||||
"last_project": {
|
||||
"type": "string"
|
||||
},
|
||||
"modified_at": {
|
||||
"type": "string"
|
||||
},
|
||||
"timezone": {
|
||||
"type": "string"
|
||||
},
|
||||
"username": {
|
||||
"type": "string"
|
||||
},
|
||||
"website": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
},
|
||||
"v1.UserViewModel": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"data": {
|
||||
"$ref": "#/definitions/v1.User"
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"securityDefinitions": {
|
||||
|
@ -6,6 +6,9 @@ definitions:
|
||||
type: string
|
||||
category:
|
||||
type: string
|
||||
created_at:
|
||||
description: https://gorm.io/docs/conventions.html#CreatedAt
|
||||
type: number
|
||||
editor:
|
||||
description: ignored because editor might be parsed differently by wakatime
|
||||
type: string
|
||||
@ -76,6 +79,8 @@ definitions:
|
||||
description: true if the stats are up to date; when false, a 202 response
|
||||
code is returned and stats will be refreshed soon>
|
||||
type: boolean
|
||||
range:
|
||||
$ref: '#/definitions/v1.AllTimeRange'
|
||||
text:
|
||||
description: total time logged since account created as human readable string>
|
||||
type: string
|
||||
@ -83,6 +88,19 @@ definitions:
|
||||
description: total number of seconds logged since account created
|
||||
type: number
|
||||
type: object
|
||||
v1.AllTimeRange:
|
||||
properties:
|
||||
end:
|
||||
type: string
|
||||
end_date:
|
||||
type: string
|
||||
start:
|
||||
type: string
|
||||
start_date:
|
||||
type: string
|
||||
timezone:
|
||||
type: string
|
||||
type: object
|
||||
v1.AllTimeViewModel:
|
||||
properties:
|
||||
data:
|
||||
@ -232,6 +250,42 @@ definitions:
|
||||
start:
|
||||
type: string
|
||||
type: object
|
||||
v1.User:
|
||||
properties:
|
||||
created_at:
|
||||
type: string
|
||||
display_name:
|
||||
type: string
|
||||
email:
|
||||
type: string
|
||||
full_name:
|
||||
type: string
|
||||
id:
|
||||
type: string
|
||||
is_email_confirmed:
|
||||
type: boolean
|
||||
is_email_public:
|
||||
type: boolean
|
||||
last_heartbeat_at:
|
||||
type: string
|
||||
last_plugin_name:
|
||||
type: string
|
||||
last_project:
|
||||
type: string
|
||||
modified_at:
|
||||
type: string
|
||||
timezone:
|
||||
type: string
|
||||
username:
|
||||
type: string
|
||||
website:
|
||||
type: string
|
||||
type: object
|
||||
v1.UserViewModel:
|
||||
properties:
|
||||
data:
|
||||
$ref: '#/definitions/v1.User'
|
||||
type: object
|
||||
info:
|
||||
contact:
|
||||
email: ferdinand@muetsch.io
|
||||
@ -294,6 +348,28 @@ paths:
|
||||
summary: Get badge data
|
||||
tags:
|
||||
- badges
|
||||
/compat/wakatime/v1/users/{user}:
|
||||
get:
|
||||
description: Mimics https://wakatime.com/developers#users
|
||||
operationId: get-wakatime-user
|
||||
parameters:
|
||||
- description: User ID to fetch (or 'current')
|
||||
in: path
|
||||
name: user
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/v1.UserViewModel'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Retrieve the given user
|
||||
tags:
|
||||
- wakatime
|
||||
/compat/wakatime/v1/users/{user}/all_time_since_today:
|
||||
get:
|
||||
description: Mimics https://wakatime.com/developers#all_time_since_today
|
||||
@ -316,6 +392,45 @@ paths:
|
||||
summary: Retrieve summary for all time
|
||||
tags:
|
||||
- wakatime
|
||||
/compat/wakatime/v1/users/{user}/stats/{range}:
|
||||
get:
|
||||
description: Mimics https://wakatime.com/developers#stats
|
||||
operationId: get-wakatimes-tats
|
||||
parameters:
|
||||
- description: User ID to fetch data for (or 'current')
|
||||
in: path
|
||||
name: user
|
||||
required: true
|
||||
type: string
|
||||
- description: Range 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: range
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/v1.StatsViewModel'
|
||||
security:
|
||||
- ApiKeyAuth: []
|
||||
summary: Retrieve statistics for a given user
|
||||
tags:
|
||||
- wakatime
|
||||
/compat/wakatime/v1/users/{user}/summaries:
|
||||
get:
|
||||
description: Mimics https://wakatime.com/developers#summaries.
|
||||
@ -441,45 +556,6 @@ paths:
|
||||
summary: Retrieve a summary
|
||||
tags:
|
||||
- summary
|
||||
/v1/users/{user}/stats/{range}:
|
||||
get:
|
||||
description: Mimics https://wakatime.com/developers#stats. Requires public data
|
||||
access to be allowed.
|
||||
operationId: get-stats
|
||||
parameters:
|
||||
- description: User ID to fetch data for (or 'current')
|
||||
in: path
|
||||
name: user
|
||||
required: true
|
||||
type: string
|
||||
- description: Range 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: path
|
||||
name: range
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
"200":
|
||||
description: OK
|
||||
schema:
|
||||
$ref: '#/definitions/v1.StatsViewModel'
|
||||
summary: Retrieve stats
|
||||
tags:
|
||||
- wakatime
|
||||
securityDefinitions:
|
||||
ApiKeyAuth:
|
||||
in: header
|
||||
|
Reference in New Issue
Block a user