making profile endpoint accessible with ape keys and adding the relev… (#3317)

* making profile endpoint accessible with ape keys and adding the relevant documentation #3256

* withApeRateLimiter middleware added #3265

* fixed documentation errors #3256

* fixed documentation errors #3256
This commit is contained in:
Aayush Paurana 2022-07-20 14:52:27 +05:30 committed by GitHub
parent 8a9a0ac3c5
commit 725a074bd8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 182 additions and 1 deletions

View file

@ -418,8 +418,9 @@ router.get(
requireProfilesEnabled,
authenticateRequest({
isPublic: true,
acceptApeKeys: true,
}),
RateLimit.userProfileGet,
withApeRateLimiter(RateLimit.userProfileGet),
validateRequest({
params: {
uid: joi.string().required(),

View file

@ -72,6 +72,29 @@
}
}
},
"/users/:uid/profile": {
"get": {
"tags": ["users"],
"summary": "Gets a user's profile",
"parameters": [
{
"name": "uid",
"in": "query",
"description": "The User ID",
"required": true,
"type": "string"
}
],
"responses": {
"200": {
"description": "",
"schema": {
"$ref": "#/definitions/Profile"
}
}
}
}
},
"/results/last": {
"get": {
"tags": ["results"],
@ -236,6 +259,163 @@
}
}
},
"Profile": {
"type": "object",
"properties": {
"name": {
"type": "string",
"example": "example_name"
},
"banned": {
"type": "boolean",
"example": true
},
"addedAt": {
"type": "integer",
"example": 1644438189583
},
"typingStats": {
"type": "object",
"properties": {
"startedTests": {
"type": "integer",
"example": 578
},
"completedTests": {
"type": "integer",
"example": 451
},
"timeTyping": {
"type": "number",
"format": "double",
"example": 3941.6
}
}
},
"personalBests": {
"type": "object",
"properties": {
"time": {
"type": "object",
"properties": {
"15": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
},
"30": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
},
"60": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
},
"120": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
}
}
},
"words": {
"type": "object",
"properties": {
"10": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
},
"25": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
},
"50": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
},
"100": {
"type": "array",
"items": {
"$ref": "#/definitions/PersonalBest"
}
}
}
}
}
},
"discordId": {
"type": "string",
"example": "974761412044437307"
},
"discordAvatar": {
"type": "string",
"example": "6226b17aebc27a4a8d1ce04b"
},
"inventory": {
"type": "object",
"properties": {
"badges": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "integer",
"example": 1
},
"selected": {
"type": "boolean",
"example": true
}
}
}
}
}
},
"details": {
"type": "object",
"properties": {
"bio": {
"type": "string",
"example": "I love MonkeyType!"
},
"keyboard": {
"type": "string",
"example": "Keychron V4"
},
"socialProfiles": {
"type": "object",
"properties": {
"twitter": {
"type": "string",
"example": "monkeytype"
},
"github": {
"type": "string",
"example": "monkeytype"
},
"website": {
"type": "string",
"example": "https://monkeytype.com/"
}
}
}
}
}
}
},
"Stats": {
"type": "object",
"properties": {