newsbot-api/docs/swagger.yaml

769 lines
17 KiB
YAML

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