myhn/Apps/Api/swagger.json
2021-01-15 10:10:24 +01:00

717 lines
17 KiB
JSON

{
"x-generator": "NSwag v13.9.4.0 (NJsonSchema v10.3.1.0 (Newtonsoft.Json v12.0.0.0))",
"openapi": "3.0.0",
"info": {
"title": "MyHN API Documentation",
"version": "1.0.0"
},
"paths": {
"/api/accounts": {
"post": {
"tags": [
"Accounts"
],
"summary": "Permet de créer un nouveau compte utilisateur sur la plateforme.",
"operationId": "Accounts_Register",
"requestBody": {
"x-name": "request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/RegisterViewModel"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"204": {
"description": ""
}
}
}
},
"/api/accounts/token": {
"post": {
"tags": [
"Accounts"
],
"summary": "Permet de récupèrer un jeton pour un utilisateur afin d'effectuer des appels authentifiés.",
"operationId": "Accounts_Login",
"requestBody": {
"x-name": "request",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LoginViewModel"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/TokenViewModel"
}
}
}
}
}
}
},
"/api/comments": {
"post": {
"tags": [
"Comments"
],
"summary": "Permet de poster un commentaire sur un lien.",
"operationId": "Comments_CreateComment",
"requestBody": {
"x-name": "command",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommentLinkCommand"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"201": {
"description": ""
},
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"401": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/api/comments/{id}": {
"get": {
"tags": [
"Comments"
],
"operationId": "Comments_GetById",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CommentDto"
}
}
}
}
}
}
},
"/api/comments/{id}/upvote": {
"put": {
"tags": [
"Comments"
],
"summary": "Permet d'upvoter un commentaire.",
"operationId": "Comments_Upvote",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"204": {
"description": ""
},
"401": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/api/comments/{id}/downvote": {
"put": {
"tags": [
"Comments"
],
"summary": "Permet de downvoter un commentaire.",
"operationId": "Comments_Downvote",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"204": {
"description": ""
},
"401": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/api/links": {
"get": {
"tags": [
"Links"
],
"summary": "Récupère tous les liens publiés depuis la nuit des temps.",
"operationId": "Links_GetLinks",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/LinkDto"
}
}
}
}
}
}
},
"post": {
"tags": [
"Links"
],
"summary": "Permet la publication d'un nouveau lien sur la plateforme.",
"operationId": "Links_CreateLink",
"requestBody": {
"x-name": "command",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/CreateLinkCommand"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"401": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"201": {
"description": ""
}
}
}
},
"/api/links/{id}": {
"get": {
"tags": [
"Links"
],
"summary": "Récupère un lien unitairement.",
"operationId": "Links_GetLinkById",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/LinkDto"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/api/links/{id}/comments": {
"get": {
"tags": [
"Links"
],
"summary": "Récupère tous les commentaires d'un lien.",
"operationId": "Links_GetLinkComments",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/CommentDto"
}
}
}
}
}
}
}
},
"/api/links/{id}/upvote": {
"put": {
"tags": [
"Links"
],
"summary": "Permet d'upvoter un lien.",
"operationId": "Links_Upvote",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"204": {
"description": ""
},
"401": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
},
"/api/links/{id}/downvote": {
"put": {
"tags": [
"Links"
],
"summary": "Permet de downvoter un lien.",
"operationId": "Links_Downvote",
"parameters": [
{
"name": "id",
"in": "path",
"required": true,
"schema": {
"type": "string",
"format": "guid"
},
"x-position": 1
}
],
"responses": {
"204": {
"description": ""
},
"401": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
}
}
}
}
},
"components": {
"schemas": {
"ProblemDetails": {
"type": "object",
"additionalProperties": {
"nullable": true
},
"properties": {
"type": {
"type": "string",
"nullable": true
},
"title": {
"type": "string",
"nullable": true
},
"status": {
"type": "integer",
"format": "int32",
"nullable": true
},
"detail": {
"type": "string",
"nullable": true
},
"instance": {
"type": "string",
"nullable": true
},
"extensions": {
"type": "object",
"nullable": true,
"additionalProperties": {}
}
}
},
"RegisterViewModel": {
"type": "object",
"additionalProperties": false,
"required": [
"username",
"password",
"confirmPassword"
],
"properties": {
"username": {
"type": "string",
"minLength": 1
},
"password": {
"type": "string",
"minLength": 1
},
"confirmPassword": {
"type": "string",
"minLength": 1
}
}
},
"TokenViewModel": {
"type": "object",
"additionalProperties": false,
"required": [
"token",
"username"
],
"properties": {
"token": {
"type": "string",
"minLength": 1
},
"username": {
"type": "string",
"minLength": 1
}
}
},
"LoginViewModel": {
"type": "object",
"additionalProperties": false,
"required": [
"username",
"password"
],
"properties": {
"username": {
"type": "string",
"minLength": 1
},
"password": {
"type": "string",
"minLength": 1
}
}
},
"CommentLinkCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"linkId",
"content"
],
"properties": {
"linkId": {
"type": "string",
"format": "guid",
"minLength": 1
},
"content": {
"type": "string",
"minLength": 1
}
}
},
"CommentDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"format": "guid"
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"content": {
"type": "string",
"nullable": true
},
"upvotesCount": {
"type": "integer",
"format": "int32"
},
"downvotesCount": {
"type": "integer",
"format": "int32"
}
}
},
"LinkDto": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"format": "guid"
},
"url": {
"type": "string",
"nullable": true
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"createdByName": {
"type": "string",
"nullable": true
},
"upvotesCount": {
"type": "integer",
"format": "int32"
},
"downvotesCount": {
"type": "integer",
"format": "int32"
}
}
},
"CreateLinkCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"url"
],
"properties": {
"url": {
"type": "string",
"format": "uri",
"minLength": 1
}
}
}
},
"securitySchemes": {
"JWT": {
"type": "apiKey",
"description": "Renseigner votre jeton: Bearer {votre jeton}",
"name": "Authorization",
"in": "header"
}
}
},
"security": [
{
"JWT": []
}
]
}