newsbot-api/docs/docs.go
James Tombleson ada453e08a
Features/delete source and first dto (#36)
* updated db, added dto for ListSources, and added delete source

* updated from model > models

* updated to models

* sources now sends back a standard message

* updated subscription routes to have beter logid and swagger details

* moved the dto objects back to modles given they are not bound to the database

* cleaned up how we return the error

* cleaned up swag and updated models to take from the base apistatusmodel. less human errors this way

* cleaned up swag and updated models

* swag updated

* updated queue to return a router and also renamed it as it will hold all queue info later on

* removed config tag

* added subscription details route

* article routes have been moved to support dto

* updated discordwebhooks to use dto

* updated discordwebhookqueue to return details on the items via dto

* removed the example routes

* updated sources to use dto

* subscriptions moved to dto

* generated swag
2023-01-22 10:12:55 -08:00

1151 lines
36 KiB
Go

// Package docs GENERATED BY SWAG; DO NOT EDIT
// This file was generated by swaggo/swag
package docs
import "github.com/swaggo/swag"
const docTemplate = `{
"schemes": {{ marshal .Schemes }},
"swagger": "2.0",
"info": {
"description": "{{escape .Description}}",
"title": "{{.Title}}",
"contact": {},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/articles": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Lists the top 50 records",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/routes.ArticlesListResults"
}
}
}
}
},
"/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": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/routes.ArticlesListResults"
}
}
}
}
},
"/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": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/routes.ArticleGetResults"
}
}
}
}
},
"/articles/{ID}/details": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Articles"
],
"summary": "Returns an article and source based on defined ID.",
"parameters": [
{
"type": "string",
"description": "uuid",
"name": "ID",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/routes.ArticleDetailsResult"
}
}
}
}
},
"/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": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/routes.ListDiscordWebhooks"
}
}
}
}
},
"/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}": {
"delete": {
"tags": [
"Discord",
"Webhook"
],
"summary": "Deletes a record by ID.",
"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": {}
}
},
"/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": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/routes.GetDiscordWebhook"
}
}
}
},
"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": {}
}
},
"/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"
}
}
}
}
},
"/sources": {
"get": {
"produces": [
"application/json"
],
"tags": [
"Source"
],
"summary": "Lists the top 50 records",
"responses": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.ListSources"
}
},
"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.ListSources"
}
},
"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": {
"200": {
"description": "ok",
"schema": {
"$ref": "#/definitions/routes.GetSource"
}
},
"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"
}
}
}
}
},
"/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.GetSource"
}
},
"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.ListSubscriptions"
}
},
"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.ListSubscriptions"
}
}
}
}
},
"/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.ListSubscriptions"
}
},
"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.ArticleDetailsDto": {
"type": "object",
"properties": {
"authorImage": {
"type": "string"
},
"authorName": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"pubdate": {
"type": "string"
},
"source": {
"$ref": "#/definitions/models.SourceDto"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"thumbnail": {
"type": "string"
},
"title": {
"type": "string"
},
"url": {
"type": "string"
},
"video": {
"type": "string"
},
"videoHeight": {
"type": "integer"
},
"videoWidth": {
"type": "integer"
}
}
},
"models.ArticleDto": {
"type": "object",
"properties": {
"authorImage": {
"type": "string"
},
"authorName": {
"type": "string"
},
"description": {
"type": "string"
},
"id": {
"type": "string"
},
"pubdate": {
"type": "string"
},
"sourceid": {
"type": "string"
},
"tags": {
"type": "array",
"items": {
"type": "string"
}
},
"thumbnail": {
"type": "string"
},
"title": {
"type": "string"
},
"url": {
"type": "string"
},
"video": {
"type": "string"
},
"videoHeight": {
"type": "integer"
},
"videoWidth": {
"type": "integer"
}
}
},
"models.DiscordQueueDetailsDto": {
"type": "object",
"properties": {
"article": {
"$ref": "#/definitions/models.ArticleDetailsDto"
},
"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.SubscriptionDetailsDto": {
"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.ArticleDetailsResult": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"$ref": "#/definitions/models.ArticleDetailsDto"
},
"status": {
"type": "integer"
}
}
},
"routes.ArticleGetResults": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"$ref": "#/definitions/models.ArticleDto"
},
"status": {
"type": "integer"
}
}
},
"routes.ArticlesListResults": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.ArticleDto"
}
},
"status": {
"type": "integer"
}
}
},
"routes.GetDiscordWebhook": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"$ref": "#/definitions/models.DiscordWebHooksDto"
},
"status": {
"type": "integer"
}
}
},
"routes.GetSource": {
"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.DiscordQueueDetailsDto"
}
},
"status": {
"type": "integer"
}
}
},
"routes.ListDiscordWebhooks": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.DiscordWebHooksDto"
}
},
"status": {
"type": "integer"
}
}
},
"routes.ListSources": {
"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.SubscriptionDetailsDto"
}
},
"status": {
"type": "integer"
}
}
},
"routes.ListSubscriptions": {
"type": "object",
"properties": {
"message": {
"type": "string"
},
"payload": {
"type": "array",
"items": {
"$ref": "#/definitions/models.SubscriptionDto"
}
},
"status": {
"type": "integer"
}
}
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "0.1",
Host: "",
BasePath: "/api",
Schemes: []string{},
Title: "NewsBot collector",
Description: "",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}