newsbot-api/docs/swagger.json

1503 lines
49 KiB
JSON

{
"swagger": "2.0",
"info": {
"contact": {}
},
"paths": {
"/v1/articles": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Lists the top 25 records ordering from newest to oldest.",
"parameters": [
{
"type": "integer",
"description": "page number",
"name": "page",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.ArticleResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/articles/by/source/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Finds the articles based on the SourceID provided. Returns the top 25.",
"parameters": [
{
"type": "string",
"description": "source id",
"name": "id",
"in": "path",
"required": true
},
{
"type": "integer",
"description": "Page to query",
"name": "page",
"in": "query"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.ArticleResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/articles/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Returns an article based on defined ID.",
"parameters": [
{
"type": "string",
"description": "int",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.ArticleResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/articles/{id}/details": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Returns an article and source based on defined ID.",
"parameters": [
{
"type": "string",
"description": "int",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.ArticleDetailedResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/discord/webhooks": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"DiscordWebhook"
],
"summary": "Returns the top 100",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
}
}
}
},
"/v1/discord/webhooks/by/serverAndChannel": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"DiscordWebhook"
],
"summary": "Returns all the known web hooks based on the Server and Channel given.",
"parameters": [
{
"type": "string",
"description": "Fancy Server",
"name": "server",
"in": "query",
"required": true
},
{
"type": "string",
"description": "memes",
"name": "channel",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
}
}
}
},
"/v1/discord/webhooks/new": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"DiscordWebhook"
],
"summary": "Creates a new record for a discord web hook to post data to.",
"parameters": [
{
"type": "string",
"description": "url",
"name": "url",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Server name",
"name": "server",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
}
}
}
},
"/v1/discord/webhooks/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"DiscordWebhook"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
"parameters": [
{
"type": "integer",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
}
}
},
"delete": {
"security": [
{
"Bearer": []
}
],
"tags": [
"DiscordWebhook"
],
"summary": "Deletes a record by ID.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
}
}
}
},
"/v1/discord/webhooks/{id}/disable": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"DiscordWebhook"
],
"summary": "Disables a Webhook from being used.",
"parameters": [
{
"type": "integer",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
}
}
}
},
"/v1/discord/webhooks/{id}/enable": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"DiscordWebhook"
],
"summary": "Enables a source to continue processing.",
"parameters": [
{
"type": "integer",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.DiscordWebhookResponse"
}
}
}
}
},
"/v1/sources": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Lists the top 50 records",
"parameters": [
{
"type": "string",
"description": "page number",
"name": "page",
"in": "query"
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Unable to reach SQL or Data problems",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/by/source": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Lists the top 50 records based on the name given. Example: reddit",
"parameters": [
{
"type": "string",
"description": "Source Name",
"name": "source",
"in": "query",
"required": true
},
{
"type": "string",
"description": "page number",
"name": "page",
"in": "query"
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/by/sourceAndName": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Returns a single entity by ID",
"parameters": [
{
"type": "string",
"description": "dadjokes",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "reddit",
"name": "source",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/sources/new/reddit": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Source"
],
"summary": "Creates a new reddit source to monitor.",
"parameters": [
{
"type": "string",
"description": "name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "url",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/new/rss": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Source"
],
"summary": "Creates a new rss source to monitor.",
"parameters": [
{
"description": "body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.NewSourceParamRequest"
}
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/new/twitch": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Source"
],
"summary": "Creates a new twitch source to monitor.",
"parameters": [
{
"type": "string",
"description": "name",
"name": "name",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/new/youtube": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Source"
],
"summary": "Creates a new youtube source to monitor.",
"parameters": [
{
"type": "string",
"description": "name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "url",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/{id}": {
"get": {
"security": [
{
"Bearer": []
}
],
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Returns a single entity by ID",
"parameters": [
{
"type": "integer",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
},
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Source"
],
"summary": "Marks a source as deleted based on its ID value.",
"parameters": [
{
"type": "integer",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/{id}/disable": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Source"
],
"summary": "Disables a source from processing.",
"parameters": [
{
"type": "integer",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/sources/{id}/enable": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Source"
],
"summary": "Enables a source to continue processing.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.SourcesResponse"
}
}
}
}
},
"/v1/users/login": {
"post": {
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Logs into the API and returns a bearer token if successful",
"parameters": [
{
"type": "string",
"name": "password",
"in": "formData"
},
{
"type": "string",
"name": "username",
"in": "formData"
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.LoginResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.LoginResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.LoginResponse"
}
}
}
}
},
"/v1/users/refresh/sessionToken": {
"post": {
"security": [
{
"Bearer": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Revokes the current session token and replaces it with a new one.",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/users/refresh/token": {
"post": {
"security": [
{
"Bearer": []
}
],
"tags": [
"Users"
],
"summary": "Generates a new token",
"parameters": [
{
"description": "body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.RefreshTokenRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.LoginResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/users/register": {
"post": {
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Creates a new user",
"parameters": [
{
"type": "string",
"name": "password",
"in": "formData"
},
{
"type": "string",
"name": "username",
"in": "formData"
}
],
"responses": {
"201": {
"description": "Created",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/users/scopes/add": {
"post": {
"security": [
{
"Bearer": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Adds a new scope to a user account",
"parameters": [
{
"description": "body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.UpdateScopesRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
},
"/v1/users/scopes/remove": {
"post": {
"security": [
{
"Bearer": []
}
],
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Users"
],
"summary": "Adds a new scope to a user account",
"parameters": [
{
"description": "body",
"name": "request",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/domain.UpdateScopesRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
},
"500": {
"description": "Internal Server Error",
"schema": {
"$ref": "#/definitions/domain.BaseResponse"
}
}
}
}
}
},
"definitions": {
"domain.ArticleAndSourceModel": {
"type": "object",
"properties": {
"article": {
"$ref": "#/definitions/domain.ArticleDto"
},
"source": {
"$ref": "#/definitions/domain.SourceDto"
}
}
},
"domain.ArticleDetailedResponse": {
"type": "object",
"properties": {
"isError": {
"type": "boolean"
},
"message": {
"type": "string"
},
"payload": {
"$ref": "#/definitions/domain.ArticleAndSourceModel"
}
}
},
"domain.ArticleDto": {
"type": "object",
"properties": {
"authorImage": {
"type": "string"
},
"authorName": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "integer"
},
"isVideo": {
"type": "boolean"
},
"pubDate": {
"type": "string"
},
"sourceId": {
"type": "integer"
},
"tags": {
"type": "string"
},
"thumbnail": {
"type": "string"
},
"title": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"domain.ArticleResponse": {
"type": "object",
"properties": {
"isError": {
"type": "boolean"
},
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.ArticleDto"
}
}
}
},
"domain.BaseResponse": {
"type": "object",
"properties": {
"isError": {
"type": "boolean"
},
"message": {
"type": "string"
}
}
},
"domain.DiscordWebHookDto": {
"type": "object",
"properties": {
"channel": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"server": {
"type": "string"
},
"url": {
"description": "Name string `json:\"name\"`\nKey string `json:\"key\"`",
"type": "string"
}
}
},
"domain.DiscordWebhookResponse": {
"type": "object",
"properties": {
"isError": {
"type": "boolean"
},
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.DiscordWebHookDto"
}
}
}
},
"domain.LoginResponse": {
"type": "object",
"properties": {
"isError": {
"type": "boolean"
},
"message": {
"type": "string"
},
"refreshToken": {
"type": "string"
},
"token": {
"type": "string"
},
"type": {
"type": "string"
}
}
},
"domain.NewSourceParamRequest": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"tags": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"domain.RefreshTokenRequest": {
"type": "object",
"properties": {
"refreshToken": {
"type": "string"
},
"username": {
"type": "string"
}
}
},
"domain.SourceDto": {
"type": "object",
"properties": {
"enabled": {
"type": "boolean"
},
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"source": {
"type": "string"
},
"tags": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"domain.SourcesResponse": {
"type": "object",
"properties": {
"isError": {
"type": "boolean"
},
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/domain.SourceDto"
}
}
}
},
"domain.UpdateScopesRequest": {
"type": "object",
"required": [
"scopes"
],
"properties": {
"scopes": {
"type": "array",
"items": {
"type": "string"
}
},
"username": {
"type": "string"
}
}
}
}
}