hn-20-2/Apps/Api/swagger.json
2021-04-28 11:18:47 +02:00

359 lines
8.3 KiB
JSON

{
"x-generator": "NSwag v13.10.9.0 (NJsonSchema v10.4.1.0 (Newtonsoft.Json v12.0.0.0))",
"openapi": "3.0.0",
"info": {
"title": "Hacker News Clone API",
"version": "1.0.0"
},
"paths": {
"/api/Comments/{id}": {
"get": {
"tags": [
"Comments"
],
"summary": "Affiche un commentaire.",
"operationId": "Comments_Show",
"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": {
"post": {
"tags": [
"Comments"
],
"summary": "Publie un nouveau commentaire sur la plateforme.",
"operationId": "Comments_Create",
"requestBody": {
"x-name": "cmd",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PublishCommentCommand"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"404": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"201": {
"description": ""
}
}
}
},
"/api/links": {
"get": {
"tags": [
"Links"
],
"summary": "Récupère la liste liste des derniers liens publiés.",
"operationId": "Links_GetLatest",
"responses": {
"200": {
"description": "",
"content": {
"application/json": {
"schema": {
"type": "array",
"items": {
"$ref": "#/components/schemas/LinkDTO"
}
}
}
}
}
}
},
"post": {
"tags": [
"Links"
],
"summary": "Permet de publier un nouveau lien sur la plateforme.",
"operationId": "Links_Create",
"requestBody": {
"x-name": "cmd",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/PublishLinkCommand"
}
}
},
"required": true,
"x-position": 1
},
"responses": {
"400": {
"description": "",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ProblemDetails"
}
}
}
},
"201": {
"description": ""
}
}
}
},
"/api/links/{id}": {
"get": {
"tags": [
"Links"
],
"summary": "Récupère les détails d'un lien.",
"operationId": "Links_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/LinkDTO"
}
}
}
}
}
}
},
"/api/links/{id}/comments": {
"get": {
"tags": [
"Links"
],
"summary": "Récupère tous les commentaires associés à un lien.",
"operationId": "Links_Comments",
"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"
}
}
}
}
}
}
}
}
},
"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": {}
}
}
},
"CommentDTO": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"format": "guid"
},
"content": {
"type": "string",
"nullable": true
},
"upvotesCount": {
"type": "integer",
"format": "int32"
},
"downvotesCount": {
"type": "integer",
"format": "int32"
}
}
},
"PublishCommentCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"linkId",
"content"
],
"properties": {
"linkId": {
"type": "string",
"format": "guid",
"minLength": 1
},
"content": {
"type": "string",
"minLength": 1
}
}
},
"LinkDTO": {
"type": "object",
"additionalProperties": false,
"properties": {
"id": {
"type": "string",
"format": "guid"
},
"url": {
"type": "string",
"nullable": true
},
"createdAt": {
"type": "string",
"format": "date-time"
},
"upvotesCount": {
"type": "integer",
"format": "int32"
},
"downvotesCount": {
"type": "integer",
"format": "int32"
},
"commentsCount": {
"type": "integer",
"format": "int32"
}
}
},
"PublishLinkCommand": {
"type": "object",
"additionalProperties": false,
"required": [
"url"
],
"properties": {
"url": {
"type": "string",
"format": "uri",
"minLength": 1
}
}
}
}
}
}