newsbot-api/docs/swagger.json

952 lines
30 KiB
JSON

{
"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": {}
}
},
"/discord/webhooks": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Discord",
"Webhook"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
"responses": {}
}
},
"/discord/webhooks/by/serverAndChannel": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Discord",
"Webhook"
],
"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": {}
}
},
"/discord/webhooks/new": {
"post": {
"tags": [
"Discord",
"Webhook"
],
"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": {}
}
},
"/discord/webhooks/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Discord",
"Webhook"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
},
"delete": {
"tags": [
"Discord",
"Webhook"
],
"summary": "Deletes a record by ID.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
},
"patch": {
"tags": [
"Discord",
"Webhook"
],
"summary": "Updates a valid discord webhook ID based on the body given.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/discord/webhooks/{id}/disable": {
"post": {
"tags": [
"Discord",
"Webhook"
],
"summary": "Disables a Webhook from being used.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/discord/webhooks/{id}/enable": {
"post": {
"tags": [
"Discord",
"Webhook"
],
"summary": "Enables a source to continue processing.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/hello/{who}": {
"get": {
"produces": [
"text/plain"
],
"tags": [
"Debug"
],
"summary": "Responds back with \"Hello x\" depending on param passed in.",
"parameters": [
{
"type": "string",
"description": "Who",
"name": "who",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/helloworld": {
"get": {
"produces": [
"text/plain"
],
"tags": [
"Debug"
],
"summary": "Responds back with \"Hello world!\"",
"responses": {}
}
},
"/ping": {
"get": {
"produces": [
"text/plain"
],
"tags": [
"Debug"
],
"summary": "Sends back \"pong\". Good to test with.",
"responses": {}
}
},
"/queue/discord/webhooks": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Queue"
],
"summary": "Returns the top 100 entries from the queue to be processed.",
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListDiscordWebHooksQueueResults"
}
}
}
}
},
"/settings/{key}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Settings"
],
"summary": "Returns a object based on the Key that was given.",
"parameters": [
{
"type": "string",
"description": "Settings Key value",
"name": "key",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/sources": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Source"
],
"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",
"description": "Source Name",
"name": "source",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSourcesResults"
}
},
"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",
"description": "dadjokes",
"name": "name",
"in": "query",
"required": true
},
{
"type": "string",
"description": "reddit",
"name": "source",
"in": "query",
"required": true
}
],
"responses": {}
}
},
"/sources/new/reddit": {
"post": {
"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": {}
}
},
"/sources/new/twitch": {
"post": {
"tags": [
"Source"
],
"summary": "Creates a new twitch source to monitor.",
"parameters": [
{
"type": "string",
"description": "name",
"name": "name",
"in": "query",
"required": true
}
],
"responses": {}
}
},
"/sources/new/youtube": {
"post": {
"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": {}
}
},
"/sources/{id}": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Returns a single entity by ID",
"parameters": [
{
"type": "string",
"description": "uuid",
"name": "id",
"in": "path",
"required": true
}
],
"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": [
"Source"
],
"summary": "Marks a source as deleted based on its ID value.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/sources/{id}/disable": {
"post": {
"tags": [
"Source"
],
"summary": "Disables a source from processing.",
"parameters": [
{
"type": "string",
"description": "id",
"name": "id",
"in": "path",
"required": true
}
],
"responses": {}
}
},
"/sources/{id}/enable": {
"post": {
"tags": [
"Source"
],
"summary": "Enables a source to continue processing.",
"parameters": [
{
"type": "string",
"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.",
"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"
}
}
}
}
},
"/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
}
],
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSubscriptionResults"
}
}
}
}
},
"/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
}
],
"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"
}
}
}
}
},
"/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",
"description": "id",
"name": "id",
"in": "query",
"required": true
}
],
"responses": {}
}
},
"/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": {}
}
}
},
"definitions": {
"models.DiscordQueueDto": {
"type": "object",
"properties": {
"articleId": {
"type": "string"
},
"id": {
"type": "string"
}
}
},
"models.DiscordWebHooksDto": {
"type": "object",
"properties": {
"ID": {
"type": "string"
},
"channel": {
"type": "string"
},
"enabled": {
"type": "boolean"
},
"server": {
"type": "string"
},
"url": {
"type": "string"
}
}
},
"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"
}
}
},
"models.SubscriptionDetails": {
"type": "object",
"properties": {
"discordwebhook": {
"$ref": "#/definitions/models.DiscordWebHooksDto"
},
"id": {
"type": "string"
},
"source": {
"$ref": "#/definitions/models.SourceDto"
}
}
},
"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"
}
}
},
"routes.ListSubscriptionDetails": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SubscriptionDetails"
}
},
"status": {
"type": "integer"
}
}
},
"routes.ListSubscriptionResults": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SubscriptionDto"
}
},
"status": {
"type": "integer"
}
}
}
}
}