newsbot-api/docs/swagger.json

952 lines
30 KiB
JSON
Raw Normal View History

{
"swagger": "2.0",
"info": {
"title": "NewsBot collector",
"contact": {},
"version": "0.1"
},
"basePath": "/api",
"paths": {
"/articles": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Lists the top 50 records",
"responses": {}
}
},
"/articles/by/sourceid": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Finds the articles based on the SourceID provided. Returns the top 50.",
"parameters": [
{
"type": "string",
"description": "Source ID UUID",
"name": "id",
"in": "query",
"required": true
}
],
"responses": {}
}
},
"/articles/by/tag": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Finds the articles based on the SourceID provided. Returns the top 50.",
"parameters": [
{
"type": "string",
"description": "Tag name",
"name": "tag",
"in": "query",
"required": true
}
],
"responses": {}
}
},
"/articles/{ID}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Returns an article based on defined ID.",
"parameters": [
{
"type": "string",
"description": "uuid",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/discord/webhooks": {
"get": {
"produces": [
"application/json"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Returns the top 100 entries from the queue to be processed.",
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/discord/webhooks/by/serverAndChannel": {
"get": {
"produces": [
"application/json"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Returns all the known web hooks based on the Server and Channel given.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "Fancy Server",
"name": "server",
"in": "query",
"required": true
},
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "memes",
"name": "channel",
"in": "query",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/discord/webhooks/new": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Creates a new record for a discord web hook to post data to.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "url",
"name": "url",
"in": "query",
"required": true
},
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "Server name",
"name": "server",
"in": "query",
"required": true
},
{
"type": "string",
"description": "Channel name",
"name": "channel",
"in": "query",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/discord/webhooks/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Returns the top 100 entries from the queue to be processed.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
2022-12-11 09:48:44 -08:00
},
"delete": {
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Deletes a record by ID.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
2022-12-11 09:48:44 -08:00
},
"patch": {
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Updates a valid discord webhook ID based on the body given.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
2022-12-11 09:48:44 -08:00
}
},
"/discord/webhooks/{id}/disable": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Disables a Webhook from being used.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/discord/webhooks/{id}/enable": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Discord",
"Webhook"
],
2022-12-11 09:48:44 -08:00
"summary": "Enables a source to continue processing.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/hello/{who}": {
"get": {
"produces": [
"text/plain"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Debug"
],
2022-12-11 09:48:44 -08:00
"summary": "Responds back with \"Hello x\" depending on param passed in.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "Who",
"name": "who",
"in": "path",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/helloworld": {
"get": {
"produces": [
2022-12-11 09:48:44 -08:00
"text/plain"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Debug"
],
2022-12-11 09:48:44 -08:00
"summary": "Responds back with \"Hello world!\"",
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/ping": {
"get": {
"produces": [
"text/plain"
],
"tags": [
"Debug"
],
"summary": "Sends back \"pong\". Good to test with.",
"responses": {}
}
},
"/queue/discord/webhooks": {
"get": {
"produces": [
"application/json"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Queue"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
2022-12-11 09:48:44 -08:00
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListDiscordWebHooksQueueResults"
}
}
}
}
},
2022-12-11 09:48:44 -08:00
"/settings/{key}": {
"get": {
"produces": [
"application/json"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Settings"
],
2022-12-11 09:48:44 -08:00
"summary": "Returns a object based on the Key that was given.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "Settings Key value",
"name": "key",
"in": "path",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/sources": {
"get": {
"produces": [
"application/json"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Lists the top 50 records",
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSourcesResults"
}
},
"400": {
"description": "Unable to reach SQL or Data problems",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
}
}
}
},
"/sources/by/source": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Lists the top 50 records based on the name given. Example: reddit",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "Source Name",
"name": "source",
"in": "query",
"required": true
2022-12-11 09:48:44 -08:00
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSourcesResults"
}
},
2022-12-11 09:48:44 -08:00
"400": {
"description": "Unable to query SQL.",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
},
"500": {
"description": "Problems with data.",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
}
}
}
},
"/sources/by/sourceAndName": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Returns a single entity by ID",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "dadjokes",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "reddit",
"name": "source",
"in": "query",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/sources/new/reddit": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Creates a new reddit source to monitor.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "url",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {}
2022-12-11 09:48:44 -08:00
}
},
"/sources/new/twitch": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Creates a new twitch source to monitor.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "name",
"name": "name",
"in": "query",
"required": true
}
],
"responses": {}
2022-12-11 09:48:44 -08:00
}
},
"/sources/new/youtube": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Creates a new youtube source to monitor.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "name",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "url",
"name": "url",
"in": "query",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/sources/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Returns a single entity by ID",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "uuid",
"name": "id",
"in": "path",
"required": true
}
],
2022-12-11 09:48:44 -08:00
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.GetSourceResult"
}
},
"204": {
"description": "No record found.",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
},
"400": {
"description": "Unable to query SQL.",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
},
"500": {
"description": "Failed to process data from SQL.",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
}
}
},
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Marks a source as deleted based on its ID value.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/sources/{id}/disable": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Disables a source from processing.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
2022-12-11 09:48:44 -08:00
"/sources/{id}/enable": {
"post": {
"tags": [
2022-12-11 09:48:44 -08:00
"Source"
],
2022-12-11 09:48:44 -08:00
"summary": "Enables a source to continue processing.",
"parameters": [
{
"type": "string",
2022-12-11 09:48:44 -08:00
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/subscriptions": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Subscription"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
2022-12-11 09:48:44 -08:00
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSubscriptionResults"
}
},
"400": {
"description": "Unable to reach SQL.",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
},
"500": {
"description": "Failed to process data from SQL.",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
}
}
}
},
2022-12-11 09:48:44 -08:00
"/subscriptions/by/SourceId": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Subscription"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "query",
"required": true
}
],
2022-12-11 09:48:44 -08:00
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSubscriptionResults"
}
}
}
}
},
2022-12-11 09:48:44 -08:00
"/subscriptions/by/discordId": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Subscription"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "query",
"required": true
}
],
2022-12-11 09:48:44 -08:00
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSubscriptionResults"
}
},
"400": {
"description": "Unable to reach SQL or Data problems",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
},
"500": {
"description": "Data problems",
"schema": {
"$ref": "#/definitions/routes.ApiError"
}
}
}
}
},
2023-01-21 12:20:33 -08:00
"/subscriptions/details": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Subscription"
],
"summary": "Returns the top 50 entries with full deatils on the source and output.",
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSubscriptionDetails"
}
}
}
}
},
"/subscriptions/discord/webhook/delete": {
"delete": {
"tags": [
"Subscription"
],
"summary": "Removes a Discord WebHook Subscription based on the Subscription ID.",
"parameters": [
{
"type": "string",
2023-01-21 12:20:33 -08:00
"description": "id",
"name": "id",
"in": "query",
"required": true
}
],
"responses": {}
}
},
2023-01-21 12:20:33 -08:00
"/subscriptions/discord/webhook/new": {
"post": {
"tags": [
"Subscription"
],
"summary": "Creates a new subscription to link a post from a Source to a DiscordWebHook.",
"parameters": [
{
"type": "string",
"description": "discordWebHookId",
"name": "discordWebHookId",
"in": "query",
"required": true
},
{
"type": "string",
"description": "sourceId",
"name": "sourceId",
"in": "query",
"required": true
}
],
"responses": {}
}
}
2022-12-11 09:48:44 -08:00
},
"definitions": {
"models.DiscordQueueDto": {
"type": "object",
"properties": {
"articleId": {
"type": "string"
},
"id": {
"type": "string"
}
}
},
2023-01-21 12:20:33 -08:00
"models.DiscordWebHooksDto": {
"type": "object",
"properties": {
"ID": {
"type": "string"
},
"channel": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"server": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
2022-12-11 09:48:44 -08:00
"models.SourceDto": {
"type": "object",
"properties": {
"deleted": {
"type": "boolean"
},
"enabled": {
"type": "boolean"
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"site": {
"type": "string"
},
"source": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"type": {
"type": "string"
},
"url": {
"type": "string"
},
"value": {
"type": "string"
}
}
},
2023-01-21 12:20:33 -08:00
"models.SubscriptionDetails": {
"type": "object",
"properties": {
"discordwebhook": {
"$ref": "#/definitions/models.DiscordWebHooksDto"
},
"id": {
"type": "string"
},
"source": {
"$ref": "#/definitions/models.SourceDto"
}
}
},
2022-12-11 09:48:44 -08:00
"models.SubscriptionDto": {
"type": "object",
"properties": {
"discordwebhookid": {
"type": "string"
},
"id": {
"type": "string"
},
"sourceid": {
"type": "string"
}
}
},
"routes.ApiError": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"status": {
"type": "integer"
}
}
},
"routes.GetSourceResult": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"$ref": "#/definitions/models.SourceDto"
},
"status": {
"type": "integer"
}
}
},
"routes.ListDiscordWebHooksQueueResults": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.DiscordQueueDto"
}
},
"status": {
"type": "integer"
}
}
},
"routes.ListSourcesResults": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SourceDto"
}
},
"status": {
"type": "integer"
}
}
},
2023-01-21 12:20:33 -08:00
"routes.ListSubscriptionDetails": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SubscriptionDetails"
}
},
"status": {
"type": "integer"
}
}
},
2022-12-11 09:48:44 -08:00
"routes.ListSubscriptionResults": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SubscriptionDto"
}
},
"status": {
"type": "integer"
}
}
}
}
}