moving new rss to accept a body request #12
35
docs/docs.go
35
docs/docs.go
@ -719,18 +719,13 @@ const docTemplate = `{
|
|||||||
"summary": "Creates a new rss source to monitor.",
|
"summary": "Creates a new rss source to monitor.",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"description": "body",
|
||||||
"description": "Site Name",
|
"name": "request",
|
||||||
"name": "name",
|
"in": "body",
|
||||||
"in": "query",
|
"required": true,
|
||||||
"required": true
|
"schema": {
|
||||||
},
|
"$ref": "#/definitions/domain.NewSourceParamRequest"
|
||||||
{
|
}
|
||||||
"type": "string",
|
|
||||||
"description": "RSS Url",
|
|
||||||
"name": "url",
|
|
||||||
"in": "query",
|
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -863,7 +858,7 @@ const docTemplate = `{
|
|||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "uuid",
|
"description": "id",
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
@ -1435,6 +1430,20 @@ const docTemplate = `{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"domain.NewSourceParamRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"domain.RefreshTokenRequest": {
|
"domain.RefreshTokenRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -710,18 +710,13 @@
|
|||||||
"summary": "Creates a new rss source to monitor.",
|
"summary": "Creates a new rss source to monitor.",
|
||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "string",
|
"description": "body",
|
||||||
"description": "Site Name",
|
"name": "request",
|
||||||
"name": "name",
|
"in": "body",
|
||||||
"in": "query",
|
"required": true,
|
||||||
"required": true
|
"schema": {
|
||||||
},
|
"$ref": "#/definitions/domain.NewSourceParamRequest"
|
||||||
{
|
}
|
||||||
"type": "string",
|
|
||||||
"description": "RSS Url",
|
|
||||||
"name": "url",
|
|
||||||
"in": "query",
|
|
||||||
"required": true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"responses": {
|
"responses": {
|
||||||
@ -854,7 +849,7 @@
|
|||||||
"parameters": [
|
"parameters": [
|
||||||
{
|
{
|
||||||
"type": "integer",
|
"type": "integer",
|
||||||
"description": "uuid",
|
"description": "id",
|
||||||
"name": "id",
|
"name": "id",
|
||||||
"in": "path",
|
"in": "path",
|
||||||
"required": true
|
"required": true
|
||||||
@ -1426,6 +1421,20 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"domain.NewSourceParamRequest": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"name": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"tags": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
"domain.RefreshTokenRequest": {
|
"domain.RefreshTokenRequest": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
|
@ -99,6 +99,15 @@ definitions:
|
|||||||
type:
|
type:
|
||||||
type: string
|
type: string
|
||||||
type: object
|
type: object
|
||||||
|
domain.NewSourceParamRequest:
|
||||||
|
properties:
|
||||||
|
name:
|
||||||
|
type: string
|
||||||
|
tags:
|
||||||
|
type: string
|
||||||
|
url:
|
||||||
|
type: string
|
||||||
|
type: object
|
||||||
domain.RefreshTokenRequest:
|
domain.RefreshTokenRequest:
|
||||||
properties:
|
properties:
|
||||||
refreshToken:
|
refreshToken:
|
||||||
@ -487,7 +496,7 @@ paths:
|
|||||||
/v1/sources/{id}:
|
/v1/sources/{id}:
|
||||||
get:
|
get:
|
||||||
parameters:
|
parameters:
|
||||||
- description: uuid
|
- description: id
|
||||||
in: path
|
in: path
|
||||||
name: id
|
name: id
|
||||||
required: true
|
required: true
|
||||||
@ -688,16 +697,12 @@ paths:
|
|||||||
/v1/sources/new/rss:
|
/v1/sources/new/rss:
|
||||||
post:
|
post:
|
||||||
parameters:
|
parameters:
|
||||||
- description: Site Name
|
- description: body
|
||||||
in: query
|
in: body
|
||||||
name: name
|
name: request
|
||||||
required: true
|
required: true
|
||||||
type: string
|
schema:
|
||||||
- description: RSS Url
|
$ref: '#/definitions/domain.NewSourceParamRequest'
|
||||||
in: query
|
|
||||||
name: url
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
responses:
|
responses:
|
||||||
"200":
|
"200":
|
||||||
description: ok
|
description: ok
|
||||||
|
@ -11,9 +11,9 @@ type GetSourceBySourceAndNameParamRequest struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type NewSourceParamRequest struct {
|
type NewSourceParamRequest struct {
|
||||||
Name string `query:"name"`
|
Name string `json:"name"`
|
||||||
Url string `query:"url"`
|
Url string `json:"url"`
|
||||||
Tags string `query:"tags"`
|
Tags string `json:"tags"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type RefreshTokenRequest struct {
|
type RefreshTokenRequest struct {
|
||||||
|
@ -397,8 +397,7 @@ func (s *Handler) newTwitchSource(c echo.Context) error {
|
|||||||
|
|
||||||
// NewRssSource
|
// NewRssSource
|
||||||
// @Summary Creates a new rss source to monitor.
|
// @Summary Creates a new rss source to monitor.
|
||||||
// @Param name query string true "Site Name"
|
// @Param request body domain.NewSourceParamRequest true "body"
|
||||||
// @Param url query string true "RSS Url"
|
|
||||||
// @Tags Source
|
// @Tags Source
|
||||||
// @Router /v1/sources/new/rss [post]
|
// @Router /v1/sources/new/rss [post]
|
||||||
// @Success 200 {object} domain.SourcesResponse "ok"
|
// @Success 200 {object} domain.SourcesResponse "ok"
|
||||||
@ -419,8 +418,8 @@ func (s *Handler) newRssSource(c echo.Context) error {
|
|||||||
return c.JSON(http.StatusUnauthorized, p)
|
return c.JSON(http.StatusUnauthorized, p)
|
||||||
}
|
}
|
||||||
|
|
||||||
var param domain.NewSourceParamRequest
|
param := domain.NewSourceParamRequest{}
|
||||||
err = c.Bind(¶m)
|
err = (&echo.DefaultBinder{}).BindBody(c, ¶m)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
p.BaseResponse.Message = err.Error()
|
p.BaseResponse.Message = err.Error()
|
||||||
return c.JSON(http.StatusBadRequest, p)
|
return c.JSON(http.StatusBadRequest, p)
|
||||||
|
Loading…
Reference in New Issue
Block a user