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