newsbot-api/docs/swagger.yaml

900 lines
22 KiB
YAML

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