418 lines
9.4 KiB
JSON
418 lines
9.4 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": "Hacker news like API in .Net",
|
|
"version": "1.0.0"
|
|
},
|
|
"paths": {
|
|
"/api/accounts/login": {
|
|
"post": {
|
|
"tags": [
|
|
"Accounts"
|
|
],
|
|
"operationId": "Accounts_Login",
|
|
"requestBody": {
|
|
"x-name": "command",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/LoginViewModel"
|
|
}
|
|
}
|
|
},
|
|
"required": true,
|
|
"x-position": 1
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"content": {
|
|
"application/octet-stream": {
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "binary"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/links": {
|
|
"get": {
|
|
"tags": [
|
|
"Links"
|
|
],
|
|
"summary": "Récupère tous les liens postés.",
|
|
"operationId": "Links_GetLinks",
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"type": "array",
|
|
"items": {
|
|
"$ref": "#/components/schemas/LinkDto"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"400": {
|
|
"description": "",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/ProblemDetails"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Links"
|
|
],
|
|
"summary": "Poste un nouveau lien.",
|
|
"operationId": "Links_CreateLink",
|
|
"requestBody": {
|
|
"x-name": "command",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/AddLinkCommand"
|
|
}
|
|
}
|
|
},
|
|
"required": true,
|
|
"x-position": 1
|
|
},
|
|
"responses": {
|
|
"200": {
|
|
"description": "",
|
|
"content": {
|
|
"application/octet-stream": {
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "binary"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/links/{id}": {
|
|
"get": {
|
|
"tags": [
|
|
"Links"
|
|
],
|
|
"summary": "Récupère um lien particulier.",
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/links/{id}/upvote": {
|
|
"put": {
|
|
"tags": [
|
|
"Links"
|
|
],
|
|
"summary": "Upvote un lien particulier.",
|
|
"operationId": "Links_Upvote",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "guid"
|
|
},
|
|
"x-position": 1
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": ""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/links/{id}/downvote": {
|
|
"put": {
|
|
"tags": [
|
|
"Links"
|
|
],
|
|
"summary": "Downvote un lien particulier.",
|
|
"operationId": "Links_Downvote",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "guid"
|
|
},
|
|
"x-position": 1
|
|
}
|
|
],
|
|
"responses": {
|
|
"204": {
|
|
"description": ""
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"/api/links/{id}/comments": {
|
|
"get": {
|
|
"tags": [
|
|
"Links"
|
|
],
|
|
"summary": "Récupère les commentaires d'un lien particulier.",
|
|
"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"
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"post": {
|
|
"tags": [
|
|
"Links"
|
|
],
|
|
"summary": "Poste un nouveau commentaire sur un lien.",
|
|
"operationId": "Links_AddComment",
|
|
"parameters": [
|
|
{
|
|
"name": "id",
|
|
"in": "path",
|
|
"required": true,
|
|
"schema": {
|
|
"type": "string",
|
|
"format": "guid"
|
|
},
|
|
"x-position": 1
|
|
}
|
|
],
|
|
"requestBody": {
|
|
"x-name": "command",
|
|
"content": {
|
|
"application/json": {
|
|
"schema": {
|
|
"$ref": "#/components/schemas/AddCommentViewModel"
|
|
}
|
|
}
|
|
},
|
|
"required": true,
|
|
"x-position": 2
|
|
},
|
|
"responses": {
|
|
"201": {
|
|
"description": ""
|
|
}
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"components": {
|
|
"schemas": {
|
|
"LoginViewModel": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"username",
|
|
"password"
|
|
],
|
|
"properties": {
|
|
"username": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
},
|
|
"password": {
|
|
"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"
|
|
},
|
|
"createdByName": {
|
|
"type": "string",
|
|
"nullable": true
|
|
},
|
|
"upVotes": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"downVotes": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
},
|
|
"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
|
|
},
|
|
"createdAt": {
|
|
"type": "string",
|
|
"format": "date-time"
|
|
},
|
|
"upVotes": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
},
|
|
"downVotes": {
|
|
"type": "integer",
|
|
"format": "int32"
|
|
}
|
|
}
|
|
},
|
|
"AddCommentViewModel": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"content"
|
|
],
|
|
"properties": {
|
|
"content": {
|
|
"type": "string",
|
|
"minLength": 1
|
|
}
|
|
}
|
|
},
|
|
"AddLinkCommand": {
|
|
"type": "object",
|
|
"additionalProperties": false,
|
|
"required": [
|
|
"url"
|
|
],
|
|
"properties": {
|
|
"url": {
|
|
"type": "string",
|
|
"format": "uri",
|
|
"minLength": 1
|
|
}
|
|
}
|
|
}
|
|
},
|
|
"securitySchemes": {
|
|
"JWT": {
|
|
"type": "apiKey",
|
|
"description": "Type into the textbox: Bearer {your JWT token}.",
|
|
"name": "Authorization",
|
|
"in": "header"
|
|
}
|
|
}
|
|
},
|
|
"security": [
|
|
{
|
|
"JWT": []
|
|
}
|
|
]
|
|
} |