feat: added GetUserTitle route
This commit is contained in:
parent
a25a912ead
commit
ad1c567b42
8 changed files with 733 additions and 402 deletions
|
|
@ -220,6 +220,7 @@ paths:
|
|||
description: Unknown server error
|
||||
'/users/{user_id}/titles':
|
||||
get:
|
||||
operationId: getUserTitles
|
||||
summary: Get user titles
|
||||
parameters:
|
||||
- $ref: '#/components/parameters/cursor'
|
||||
|
|
@ -360,6 +361,38 @@ paths:
|
|||
description: Conflict — title already assigned to user (if applicable)
|
||||
'500':
|
||||
description: Internal server error
|
||||
'/users/{user_id}/titles/{title_id}':
|
||||
get:
|
||||
operationId: getUserTitle
|
||||
summary: Get user title
|
||||
parameters:
|
||||
- name: user_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
- name: title_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: User titles
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/UserTitleMini'
|
||||
'204':
|
||||
description: No user title found
|
||||
'400':
|
||||
description: Request params are not correct
|
||||
'404':
|
||||
description: User or title not found
|
||||
'500':
|
||||
description: Unknown server error
|
||||
patch:
|
||||
operationId: updateUserTitle
|
||||
summary: Update a usertitle
|
||||
|
|
@ -367,12 +400,16 @@ paths:
|
|||
parameters:
|
||||
- name: user_id
|
||||
in: path
|
||||
description: ID of the user to assign the title to
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
example: 123
|
||||
- name: title_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
|
|
@ -380,16 +417,11 @@ paths:
|
|||
schema:
|
||||
type: object
|
||||
properties:
|
||||
title_id:
|
||||
type: integer
|
||||
format: int64
|
||||
status:
|
||||
$ref: '#/components/schemas/UserTitleStatus'
|
||||
rate:
|
||||
type: integer
|
||||
format: int32
|
||||
required:
|
||||
- title_id
|
||||
responses:
|
||||
'200':
|
||||
description: Title successfully updated
|
||||
|
|
@ -414,13 +446,12 @@ paths:
|
|||
parameters:
|
||||
- name: user_id
|
||||
in: path
|
||||
description: ID of the user to assign the title to
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
- name: title_id
|
||||
in: query
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
|
|
|
|||
708
api/api.gen.go
708
api/api.gen.go
|
|
@ -218,13 +218,8 @@ type UpdateUserJSONBody struct {
|
|||
UserDesc *string `json:"user_desc,omitempty"`
|
||||
}
|
||||
|
||||
// DeleteUserTitleParams defines parameters for DeleteUserTitle.
|
||||
type DeleteUserTitleParams struct {
|
||||
TitleId int64 `form:"title_id" json:"title_id"`
|
||||
}
|
||||
|
||||
// GetUsersUserIdTitlesParams defines parameters for GetUsersUserIdTitles.
|
||||
type GetUsersUserIdTitlesParams struct {
|
||||
// GetUserTitlesParams defines parameters for GetUserTitles.
|
||||
type GetUserTitlesParams struct {
|
||||
Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"`
|
||||
Sort *TitleSort `form:"sort,omitempty" json:"sort,omitempty"`
|
||||
SortForward *bool `form:"sort_forward,omitempty" json:"sort_forward,omitempty"`
|
||||
|
|
@ -241,15 +236,6 @@ type GetUsersUserIdTitlesParams struct {
|
|||
Fields *string `form:"fields,omitempty" json:"fields,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateUserTitleJSONBody defines parameters for UpdateUserTitle.
|
||||
type UpdateUserTitleJSONBody struct {
|
||||
Rate *int32 `json:"rate,omitempty"`
|
||||
|
||||
// Status User's title status
|
||||
Status *UserTitleStatus `json:"status,omitempty"`
|
||||
TitleId int64 `json:"title_id"`
|
||||
}
|
||||
|
||||
// AddUserTitleJSONBody defines parameters for AddUserTitle.
|
||||
type AddUserTitleJSONBody struct {
|
||||
Rate *int32 `json:"rate,omitempty"`
|
||||
|
|
@ -259,15 +245,23 @@ type AddUserTitleJSONBody struct {
|
|||
TitleId int64 `json:"title_id"`
|
||||
}
|
||||
|
||||
// UpdateUserTitleJSONBody defines parameters for UpdateUserTitle.
|
||||
type UpdateUserTitleJSONBody struct {
|
||||
Rate *int32 `json:"rate,omitempty"`
|
||||
|
||||
// Status User's title status
|
||||
Status *UserTitleStatus `json:"status,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateUserJSONRequestBody defines body for UpdateUser for application/json ContentType.
|
||||
type UpdateUserJSONRequestBody UpdateUserJSONBody
|
||||
|
||||
// UpdateUserTitleJSONRequestBody defines body for UpdateUserTitle for application/json ContentType.
|
||||
type UpdateUserTitleJSONRequestBody UpdateUserTitleJSONBody
|
||||
|
||||
// AddUserTitleJSONRequestBody defines body for AddUserTitle for application/json ContentType.
|
||||
type AddUserTitleJSONRequestBody AddUserTitleJSONBody
|
||||
|
||||
// UpdateUserTitleJSONRequestBody defines body for UpdateUserTitle for application/json ContentType.
|
||||
type UpdateUserTitleJSONRequestBody UpdateUserTitleJSONBody
|
||||
|
||||
// ServerInterface represents all server handlers.
|
||||
type ServerInterface interface {
|
||||
// Get titles
|
||||
|
|
@ -282,18 +276,21 @@ type ServerInterface interface {
|
|||
// Partially update a user account
|
||||
// (PATCH /users/{user_id})
|
||||
UpdateUser(c *gin.Context, userId int64)
|
||||
// Delete a usertitle
|
||||
// (DELETE /users/{user_id}/titles)
|
||||
DeleteUserTitle(c *gin.Context, userId int64, params DeleteUserTitleParams)
|
||||
// Get user titles
|
||||
// (GET /users/{user_id}/titles)
|
||||
GetUsersUserIdTitles(c *gin.Context, userId string, params GetUsersUserIdTitlesParams)
|
||||
// Update a usertitle
|
||||
// (PATCH /users/{user_id}/titles)
|
||||
UpdateUserTitle(c *gin.Context, userId int64)
|
||||
GetUserTitles(c *gin.Context, userId string, params GetUserTitlesParams)
|
||||
// Add a title to a user
|
||||
// (POST /users/{user_id}/titles)
|
||||
AddUserTitle(c *gin.Context, userId int64)
|
||||
// Delete a usertitle
|
||||
// (DELETE /users/{user_id}/titles/{title_id})
|
||||
DeleteUserTitle(c *gin.Context, userId int64, titleId int64)
|
||||
// Get user title
|
||||
// (GET /users/{user_id}/titles/{title_id})
|
||||
GetUserTitle(c *gin.Context, userId int64, titleId int64)
|
||||
// Update a usertitle
|
||||
// (PATCH /users/{user_id}/titles/{title_id})
|
||||
UpdateUserTitle(c *gin.Context, userId int64, titleId int64)
|
||||
}
|
||||
|
||||
// ServerInterfaceWrapper converts contexts to parameters.
|
||||
|
|
@ -505,50 +502,8 @@ func (siw *ServerInterfaceWrapper) UpdateUser(c *gin.Context) {
|
|||
siw.Handler.UpdateUser(c, userId)
|
||||
}
|
||||
|
||||
// DeleteUserTitle operation middleware
|
||||
func (siw *ServerInterfaceWrapper) DeleteUserTitle(c *gin.Context) {
|
||||
|
||||
var err error
|
||||
|
||||
// ------------- Path parameter "user_id" -------------
|
||||
var userId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "user_id", c.Param("user_id"), &userId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter user_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// Parameter object where we will unmarshal all parameters from the context
|
||||
var params DeleteUserTitleParams
|
||||
|
||||
// ------------- Required query parameter "title_id" -------------
|
||||
|
||||
if paramValue := c.Query("title_id"); paramValue != "" {
|
||||
|
||||
} else {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Query argument title_id is required, but not found"), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
err = runtime.BindQueryParameter("form", true, true, "title_id", c.Request.URL.Query(), ¶ms.TitleId)
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter title_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
for _, middleware := range siw.HandlerMiddlewares {
|
||||
middleware(c)
|
||||
if c.IsAborted() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
siw.Handler.DeleteUserTitle(c, userId, params)
|
||||
}
|
||||
|
||||
// GetUsersUserIdTitles operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetUsersUserIdTitles(c *gin.Context) {
|
||||
// GetUserTitles operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetUserTitles(c *gin.Context) {
|
||||
|
||||
var err error
|
||||
|
||||
|
|
@ -562,7 +517,7 @@ func (siw *ServerInterfaceWrapper) GetUsersUserIdTitles(c *gin.Context) {
|
|||
}
|
||||
|
||||
// Parameter object where we will unmarshal all parameters from the context
|
||||
var params GetUsersUserIdTitlesParams
|
||||
var params GetUserTitlesParams
|
||||
|
||||
// ------------- Optional query parameter "cursor" -------------
|
||||
|
||||
|
|
@ -667,31 +622,7 @@ func (siw *ServerInterfaceWrapper) GetUsersUserIdTitles(c *gin.Context) {
|
|||
}
|
||||
}
|
||||
|
||||
siw.Handler.GetUsersUserIdTitles(c, userId, params)
|
||||
}
|
||||
|
||||
// UpdateUserTitle operation middleware
|
||||
func (siw *ServerInterfaceWrapper) UpdateUserTitle(c *gin.Context) {
|
||||
|
||||
var err error
|
||||
|
||||
// ------------- Path parameter "user_id" -------------
|
||||
var userId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "user_id", c.Param("user_id"), &userId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter user_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
for _, middleware := range siw.HandlerMiddlewares {
|
||||
middleware(c)
|
||||
if c.IsAborted() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
siw.Handler.UpdateUserTitle(c, userId)
|
||||
siw.Handler.GetUserTitles(c, userId, params)
|
||||
}
|
||||
|
||||
// AddUserTitle operation middleware
|
||||
|
|
@ -718,6 +649,105 @@ func (siw *ServerInterfaceWrapper) AddUserTitle(c *gin.Context) {
|
|||
siw.Handler.AddUserTitle(c, userId)
|
||||
}
|
||||
|
||||
// DeleteUserTitle operation middleware
|
||||
func (siw *ServerInterfaceWrapper) DeleteUserTitle(c *gin.Context) {
|
||||
|
||||
var err error
|
||||
|
||||
// ------------- Path parameter "user_id" -------------
|
||||
var userId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "user_id", c.Param("user_id"), &userId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter user_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Path parameter "title_id" -------------
|
||||
var titleId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "title_id", c.Param("title_id"), &titleId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter title_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
for _, middleware := range siw.HandlerMiddlewares {
|
||||
middleware(c)
|
||||
if c.IsAborted() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
siw.Handler.DeleteUserTitle(c, userId, titleId)
|
||||
}
|
||||
|
||||
// GetUserTitle operation middleware
|
||||
func (siw *ServerInterfaceWrapper) GetUserTitle(c *gin.Context) {
|
||||
|
||||
var err error
|
||||
|
||||
// ------------- Path parameter "user_id" -------------
|
||||
var userId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "user_id", c.Param("user_id"), &userId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter user_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Path parameter "title_id" -------------
|
||||
var titleId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "title_id", c.Param("title_id"), &titleId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter title_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
for _, middleware := range siw.HandlerMiddlewares {
|
||||
middleware(c)
|
||||
if c.IsAborted() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
siw.Handler.GetUserTitle(c, userId, titleId)
|
||||
}
|
||||
|
||||
// UpdateUserTitle operation middleware
|
||||
func (siw *ServerInterfaceWrapper) UpdateUserTitle(c *gin.Context) {
|
||||
|
||||
var err error
|
||||
|
||||
// ------------- Path parameter "user_id" -------------
|
||||
var userId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "user_id", c.Param("user_id"), &userId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter user_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
// ------------- Path parameter "title_id" -------------
|
||||
var titleId int64
|
||||
|
||||
err = runtime.BindStyledParameterWithOptions("simple", "title_id", c.Param("title_id"), &titleId, runtime.BindStyledParameterOptions{Explode: false, Required: true})
|
||||
if err != nil {
|
||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter title_id: %w", err), http.StatusBadRequest)
|
||||
return
|
||||
}
|
||||
|
||||
for _, middleware := range siw.HandlerMiddlewares {
|
||||
middleware(c)
|
||||
if c.IsAborted() {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
siw.Handler.UpdateUserTitle(c, userId, titleId)
|
||||
}
|
||||
|
||||
// GinServerOptions provides options for the Gin server.
|
||||
type GinServerOptions struct {
|
||||
BaseURL string
|
||||
|
|
@ -749,10 +779,11 @@ func RegisterHandlersWithOptions(router gin.IRouter, si ServerInterface, options
|
|||
router.GET(options.BaseURL+"/titles/:title_id", wrapper.GetTitle)
|
||||
router.GET(options.BaseURL+"/users/:user_id", wrapper.GetUsersId)
|
||||
router.PATCH(options.BaseURL+"/users/:user_id", wrapper.UpdateUser)
|
||||
router.DELETE(options.BaseURL+"/users/:user_id/titles", wrapper.DeleteUserTitle)
|
||||
router.GET(options.BaseURL+"/users/:user_id/titles", wrapper.GetUsersUserIdTitles)
|
||||
router.PATCH(options.BaseURL+"/users/:user_id/titles", wrapper.UpdateUserTitle)
|
||||
router.GET(options.BaseURL+"/users/:user_id/titles", wrapper.GetUserTitles)
|
||||
router.POST(options.BaseURL+"/users/:user_id/titles", wrapper.AddUserTitle)
|
||||
router.DELETE(options.BaseURL+"/users/:user_id/titles/:title_id", wrapper.DeleteUserTitle)
|
||||
router.GET(options.BaseURL+"/users/:user_id/titles/:title_id", wrapper.GetUserTitle)
|
||||
router.PATCH(options.BaseURL+"/users/:user_id/titles/:title_id", wrapper.UpdateUserTitle)
|
||||
}
|
||||
|
||||
type GetTitlesRequestObject struct {
|
||||
|
|
@ -967,162 +998,55 @@ func (response UpdateUser500Response) VisitUpdateUserResponse(w http.ResponseWri
|
|||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitleRequestObject struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
Params DeleteUserTitleParams
|
||||
}
|
||||
|
||||
type DeleteUserTitleResponseObject interface {
|
||||
VisitDeleteUserTitleResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type DeleteUserTitle200Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle200Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(200)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle401Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle401Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(401)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle403Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle403Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(403)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle404Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle404Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(404)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle500Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle500Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(500)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUsersUserIdTitlesRequestObject struct {
|
||||
type GetUserTitlesRequestObject struct {
|
||||
UserId string `json:"user_id"`
|
||||
Params GetUsersUserIdTitlesParams
|
||||
Params GetUserTitlesParams
|
||||
}
|
||||
|
||||
type GetUsersUserIdTitlesResponseObject interface {
|
||||
VisitGetUsersUserIdTitlesResponse(w http.ResponseWriter) error
|
||||
type GetUserTitlesResponseObject interface {
|
||||
VisitGetUserTitlesResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type GetUsersUserIdTitles200JSONResponse struct {
|
||||
type GetUserTitles200JSONResponse struct {
|
||||
Cursor CursorObj `json:"cursor"`
|
||||
Data []UserTitle `json:"data"`
|
||||
}
|
||||
|
||||
func (response GetUsersUserIdTitles200JSONResponse) VisitGetUsersUserIdTitlesResponse(w http.ResponseWriter) error {
|
||||
func (response GetUserTitles200JSONResponse) VisitGetUserTitlesResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(200)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetUsersUserIdTitles204Response struct {
|
||||
type GetUserTitles204Response struct {
|
||||
}
|
||||
|
||||
func (response GetUsersUserIdTitles204Response) VisitGetUsersUserIdTitlesResponse(w http.ResponseWriter) error {
|
||||
func (response GetUserTitles204Response) VisitGetUserTitlesResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(204)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUsersUserIdTitles400Response struct {
|
||||
type GetUserTitles400Response struct {
|
||||
}
|
||||
|
||||
func (response GetUsersUserIdTitles400Response) VisitGetUsersUserIdTitlesResponse(w http.ResponseWriter) error {
|
||||
func (response GetUserTitles400Response) VisitGetUserTitlesResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(400)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUsersUserIdTitles404Response struct {
|
||||
type GetUserTitles404Response struct {
|
||||
}
|
||||
|
||||
func (response GetUsersUserIdTitles404Response) VisitGetUsersUserIdTitlesResponse(w http.ResponseWriter) error {
|
||||
func (response GetUserTitles404Response) VisitGetUserTitlesResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(404)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUsersUserIdTitles500Response struct {
|
||||
type GetUserTitles500Response struct {
|
||||
}
|
||||
|
||||
func (response GetUsersUserIdTitles500Response) VisitGetUsersUserIdTitlesResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(500)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitleRequestObject struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
Body *UpdateUserTitleJSONRequestBody
|
||||
}
|
||||
|
||||
type UpdateUserTitleResponseObject interface {
|
||||
VisitUpdateUserTitleResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type UpdateUserTitle200JSONResponse UserTitleMini
|
||||
|
||||
func (response UpdateUserTitle200JSONResponse) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(200)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type UpdateUserTitle400Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle400Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(400)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle401Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle401Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(401)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle403Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle403Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(403)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle404Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle404Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(404)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle500Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle500Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
func (response GetUserTitles500Response) VisitGetUserTitlesResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(500)
|
||||
return nil
|
||||
}
|
||||
|
|
@ -1193,6 +1117,164 @@ func (response AddUserTitle500Response) VisitAddUserTitleResponse(w http.Respons
|
|||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitleRequestObject struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
TitleId int64 `json:"title_id"`
|
||||
}
|
||||
|
||||
type DeleteUserTitleResponseObject interface {
|
||||
VisitDeleteUserTitleResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type DeleteUserTitle200Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle200Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(200)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle401Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle401Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(401)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle403Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle403Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(403)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle404Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle404Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(404)
|
||||
return nil
|
||||
}
|
||||
|
||||
type DeleteUserTitle500Response struct {
|
||||
}
|
||||
|
||||
func (response DeleteUserTitle500Response) VisitDeleteUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(500)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUserTitleRequestObject struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
TitleId int64 `json:"title_id"`
|
||||
}
|
||||
|
||||
type GetUserTitleResponseObject interface {
|
||||
VisitGetUserTitleResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type GetUserTitle200JSONResponse UserTitleMini
|
||||
|
||||
func (response GetUserTitle200JSONResponse) VisitGetUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(200)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type GetUserTitle204Response struct {
|
||||
}
|
||||
|
||||
func (response GetUserTitle204Response) VisitGetUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(204)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUserTitle400Response struct {
|
||||
}
|
||||
|
||||
func (response GetUserTitle400Response) VisitGetUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(400)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUserTitle404Response struct {
|
||||
}
|
||||
|
||||
func (response GetUserTitle404Response) VisitGetUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(404)
|
||||
return nil
|
||||
}
|
||||
|
||||
type GetUserTitle500Response struct {
|
||||
}
|
||||
|
||||
func (response GetUserTitle500Response) VisitGetUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(500)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitleRequestObject struct {
|
||||
UserId int64 `json:"user_id"`
|
||||
TitleId int64 `json:"title_id"`
|
||||
Body *UpdateUserTitleJSONRequestBody
|
||||
}
|
||||
|
||||
type UpdateUserTitleResponseObject interface {
|
||||
VisitUpdateUserTitleResponse(w http.ResponseWriter) error
|
||||
}
|
||||
|
||||
type UpdateUserTitle200JSONResponse UserTitleMini
|
||||
|
||||
func (response UpdateUserTitle200JSONResponse) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.Header().Set("Content-Type", "application/json")
|
||||
w.WriteHeader(200)
|
||||
|
||||
return json.NewEncoder(w).Encode(response)
|
||||
}
|
||||
|
||||
type UpdateUserTitle400Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle400Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(400)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle401Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle401Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(401)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle403Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle403Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(403)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle404Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle404Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(404)
|
||||
return nil
|
||||
}
|
||||
|
||||
type UpdateUserTitle500Response struct {
|
||||
}
|
||||
|
||||
func (response UpdateUserTitle500Response) VisitUpdateUserTitleResponse(w http.ResponseWriter) error {
|
||||
w.WriteHeader(500)
|
||||
return nil
|
||||
}
|
||||
|
||||
// StrictServerInterface represents all server handlers.
|
||||
type StrictServerInterface interface {
|
||||
// Get titles
|
||||
|
|
@ -1207,18 +1289,21 @@ type StrictServerInterface interface {
|
|||
// Partially update a user account
|
||||
// (PATCH /users/{user_id})
|
||||
UpdateUser(ctx context.Context, request UpdateUserRequestObject) (UpdateUserResponseObject, error)
|
||||
// Delete a usertitle
|
||||
// (DELETE /users/{user_id}/titles)
|
||||
DeleteUserTitle(ctx context.Context, request DeleteUserTitleRequestObject) (DeleteUserTitleResponseObject, error)
|
||||
// Get user titles
|
||||
// (GET /users/{user_id}/titles)
|
||||
GetUsersUserIdTitles(ctx context.Context, request GetUsersUserIdTitlesRequestObject) (GetUsersUserIdTitlesResponseObject, error)
|
||||
// Update a usertitle
|
||||
// (PATCH /users/{user_id}/titles)
|
||||
UpdateUserTitle(ctx context.Context, request UpdateUserTitleRequestObject) (UpdateUserTitleResponseObject, error)
|
||||
GetUserTitles(ctx context.Context, request GetUserTitlesRequestObject) (GetUserTitlesResponseObject, error)
|
||||
// Add a title to a user
|
||||
// (POST /users/{user_id}/titles)
|
||||
AddUserTitle(ctx context.Context, request AddUserTitleRequestObject) (AddUserTitleResponseObject, error)
|
||||
// Delete a usertitle
|
||||
// (DELETE /users/{user_id}/titles/{title_id})
|
||||
DeleteUserTitle(ctx context.Context, request DeleteUserTitleRequestObject) (DeleteUserTitleResponseObject, error)
|
||||
// Get user title
|
||||
// (GET /users/{user_id}/titles/{title_id})
|
||||
GetUserTitle(ctx context.Context, request GetUserTitleRequestObject) (GetUserTitleResponseObject, error)
|
||||
// Update a usertitle
|
||||
// (PATCH /users/{user_id}/titles/{title_id})
|
||||
UpdateUserTitle(ctx context.Context, request UpdateUserTitleRequestObject) (UpdateUserTitleResponseObject, error)
|
||||
}
|
||||
|
||||
type StrictHandlerFunc = strictgin.StrictGinHandlerFunc
|
||||
|
|
@ -1351,18 +1436,18 @@ func (sh *strictHandler) UpdateUser(ctx *gin.Context, userId int64) {
|
|||
}
|
||||
}
|
||||
|
||||
// DeleteUserTitle operation middleware
|
||||
func (sh *strictHandler) DeleteUserTitle(ctx *gin.Context, userId int64, params DeleteUserTitleParams) {
|
||||
var request DeleteUserTitleRequestObject
|
||||
// GetUserTitles operation middleware
|
||||
func (sh *strictHandler) GetUserTitles(ctx *gin.Context, userId string, params GetUserTitlesParams) {
|
||||
var request GetUserTitlesRequestObject
|
||||
|
||||
request.UserId = userId
|
||||
request.Params = params
|
||||
|
||||
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.DeleteUserTitle(ctx, request.(DeleteUserTitleRequestObject))
|
||||
return sh.ssi.GetUserTitles(ctx, request.(GetUserTitlesRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "DeleteUserTitle")
|
||||
handler = middleware(handler, "GetUserTitles")
|
||||
}
|
||||
|
||||
response, err := handler(ctx, request)
|
||||
|
|
@ -1370,71 +1455,8 @@ func (sh *strictHandler) DeleteUserTitle(ctx *gin.Context, userId int64, params
|
|||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.Status(http.StatusInternalServerError)
|
||||
} else if validResponse, ok := response.(DeleteUserTitleResponseObject); ok {
|
||||
if err := validResponse.VisitDeleteUserTitleResponse(ctx.Writer); err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
} else if response != nil {
|
||||
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
||||
// GetUsersUserIdTitles operation middleware
|
||||
func (sh *strictHandler) GetUsersUserIdTitles(ctx *gin.Context, userId string, params GetUsersUserIdTitlesParams) {
|
||||
var request GetUsersUserIdTitlesRequestObject
|
||||
|
||||
request.UserId = userId
|
||||
request.Params = params
|
||||
|
||||
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.GetUsersUserIdTitles(ctx, request.(GetUsersUserIdTitlesRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "GetUsersUserIdTitles")
|
||||
}
|
||||
|
||||
response, err := handler(ctx, request)
|
||||
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.Status(http.StatusInternalServerError)
|
||||
} else if validResponse, ok := response.(GetUsersUserIdTitlesResponseObject); ok {
|
||||
if err := validResponse.VisitGetUsersUserIdTitlesResponse(ctx.Writer); err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
} else if response != nil {
|
||||
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateUserTitle operation middleware
|
||||
func (sh *strictHandler) UpdateUserTitle(ctx *gin.Context, userId int64) {
|
||||
var request UpdateUserTitleRequestObject
|
||||
|
||||
request.UserId = userId
|
||||
|
||||
var body UpdateUserTitleJSONRequestBody
|
||||
if err := ctx.ShouldBindJSON(&body); err != nil {
|
||||
ctx.Status(http.StatusBadRequest)
|
||||
ctx.Error(err)
|
||||
return
|
||||
}
|
||||
request.Body = &body
|
||||
|
||||
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.UpdateUserTitle(ctx, request.(UpdateUserTitleRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "UpdateUserTitle")
|
||||
}
|
||||
|
||||
response, err := handler(ctx, request)
|
||||
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.Status(http.StatusInternalServerError)
|
||||
} else if validResponse, ok := response.(UpdateUserTitleResponseObject); ok {
|
||||
if err := validResponse.VisitUpdateUserTitleResponse(ctx.Writer); err != nil {
|
||||
} else if validResponse, ok := response.(GetUserTitlesResponseObject); ok {
|
||||
if err := validResponse.VisitGetUserTitlesResponse(ctx.Writer); err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
} else if response != nil {
|
||||
|
|
@ -1476,3 +1498,95 @@ func (sh *strictHandler) AddUserTitle(ctx *gin.Context, userId int64) {
|
|||
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
||||
// DeleteUserTitle operation middleware
|
||||
func (sh *strictHandler) DeleteUserTitle(ctx *gin.Context, userId int64, titleId int64) {
|
||||
var request DeleteUserTitleRequestObject
|
||||
|
||||
request.UserId = userId
|
||||
request.TitleId = titleId
|
||||
|
||||
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.DeleteUserTitle(ctx, request.(DeleteUserTitleRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "DeleteUserTitle")
|
||||
}
|
||||
|
||||
response, err := handler(ctx, request)
|
||||
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.Status(http.StatusInternalServerError)
|
||||
} else if validResponse, ok := response.(DeleteUserTitleResponseObject); ok {
|
||||
if err := validResponse.VisitDeleteUserTitleResponse(ctx.Writer); err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
} else if response != nil {
|
||||
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
||||
// GetUserTitle operation middleware
|
||||
func (sh *strictHandler) GetUserTitle(ctx *gin.Context, userId int64, titleId int64) {
|
||||
var request GetUserTitleRequestObject
|
||||
|
||||
request.UserId = userId
|
||||
request.TitleId = titleId
|
||||
|
||||
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.GetUserTitle(ctx, request.(GetUserTitleRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "GetUserTitle")
|
||||
}
|
||||
|
||||
response, err := handler(ctx, request)
|
||||
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.Status(http.StatusInternalServerError)
|
||||
} else if validResponse, ok := response.(GetUserTitleResponseObject); ok {
|
||||
if err := validResponse.VisitGetUserTitleResponse(ctx.Writer); err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
} else if response != nil {
|
||||
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
||||
// UpdateUserTitle operation middleware
|
||||
func (sh *strictHandler) UpdateUserTitle(ctx *gin.Context, userId int64, titleId int64) {
|
||||
var request UpdateUserTitleRequestObject
|
||||
|
||||
request.UserId = userId
|
||||
request.TitleId = titleId
|
||||
|
||||
var body UpdateUserTitleJSONRequestBody
|
||||
if err := ctx.ShouldBindJSON(&body); err != nil {
|
||||
ctx.Status(http.StatusBadRequest)
|
||||
ctx.Error(err)
|
||||
return
|
||||
}
|
||||
request.Body = &body
|
||||
|
||||
handler := func(ctx *gin.Context, request interface{}) (interface{}, error) {
|
||||
return sh.ssi.UpdateUserTitle(ctx, request.(UpdateUserTitleRequestObject))
|
||||
}
|
||||
for _, middleware := range sh.middlewares {
|
||||
handler = middleware(handler, "UpdateUserTitle")
|
||||
}
|
||||
|
||||
response, err := handler(ctx, request)
|
||||
|
||||
if err != nil {
|
||||
ctx.Error(err)
|
||||
ctx.Status(http.StatusInternalServerError)
|
||||
} else if validResponse, ok := response.(UpdateUserTitleResponseObject); ok {
|
||||
if err := validResponse.VisitUpdateUserTitleResponse(ctx.Writer); err != nil {
|
||||
ctx.Error(err)
|
||||
}
|
||||
} else if response != nil {
|
||||
ctx.Error(fmt.Errorf("unexpected response type: %T", response))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@ paths:
|
|||
$ref: "./paths/users-id.yaml"
|
||||
/users/{user_id}/titles:
|
||||
$ref: "./paths/users-id-titles.yaml"
|
||||
/users/{user_id}/titles/{title_id}:
|
||||
$ref: "./paths/users-id-titles-id.yaml"
|
||||
|
||||
components:
|
||||
parameters:
|
||||
|
|
|
|||
107
api/paths/users-id-titles-id.yaml
Normal file
107
api/paths/users-id-titles-id.yaml
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
get:
|
||||
summary: Get user title
|
||||
operationId: getUserTitle
|
||||
parameters:
|
||||
- in: path
|
||||
name: user_id
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
- in: path
|
||||
name: title_id
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: User titles
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '../schemas/UserTitleMini.yaml'
|
||||
'204':
|
||||
description: No user title found
|
||||
'400':
|
||||
description: Request params are not correct
|
||||
'404':
|
||||
description: User or title not found
|
||||
'500':
|
||||
description: Unknown server error
|
||||
|
||||
patch:
|
||||
summary: Update a usertitle
|
||||
description: User updating title list of watched
|
||||
operationId: updateUserTitle
|
||||
parameters:
|
||||
- in: path
|
||||
name: user_id
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
- in: path
|
||||
name: title_id
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
status:
|
||||
$ref: '../schemas/enums/UserTitleStatus.yaml'
|
||||
rate:
|
||||
type: integer
|
||||
format: int32
|
||||
responses:
|
||||
'200':
|
||||
description: Title successfully updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '../schemas/UserTitleMini.yaml'
|
||||
'400':
|
||||
description: Invalid request body (missing fields, invalid types, etc.)
|
||||
'401':
|
||||
description: Unauthorized — missing or invalid auth token
|
||||
'403':
|
||||
description: Forbidden — user not allowed to update title
|
||||
'404':
|
||||
description: User or Title not found
|
||||
'500':
|
||||
description: Internal server error
|
||||
|
||||
delete:
|
||||
summary: Delete a usertitle
|
||||
description: User deleting title from list of watched
|
||||
operationId: deleteUserTitle
|
||||
parameters:
|
||||
- in: path
|
||||
name: user_id
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
- in: path
|
||||
name: title_id
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
responses:
|
||||
'200':
|
||||
description: Title successfully deleted
|
||||
'401':
|
||||
description: Unauthorized — missing or invalid auth token
|
||||
'403':
|
||||
description: Forbidden — user not allowed to delete title
|
||||
'404':
|
||||
description: User or Title not found
|
||||
'500':
|
||||
description: Internal server error
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
get:
|
||||
summary: Get user titles
|
||||
operationId: getUserTitles
|
||||
parameters:
|
||||
- $ref: '../parameters/cursor.yaml'
|
||||
- $ref: "../parameters/title_sort.yaml"
|
||||
|
|
@ -138,88 +139,5 @@ post:
|
|||
description: User or Title not found
|
||||
'409':
|
||||
description: Conflict — title already assigned to user (if applicable)
|
||||
'500':
|
||||
description: Internal server error
|
||||
|
||||
patch:
|
||||
summary: Update a usertitle
|
||||
description: User updating title list of watched
|
||||
operationId: updateUserTitle
|
||||
parameters:
|
||||
- name: user_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
description: ID of the user to assign the title to
|
||||
example: 123
|
||||
requestBody:
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- title_id
|
||||
properties:
|
||||
title_id:
|
||||
type: integer
|
||||
format: int64
|
||||
status:
|
||||
$ref: '../schemas/enums/UserTitleStatus.yaml'
|
||||
rate:
|
||||
type: integer
|
||||
format: int32
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: Title successfully updated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '../schemas/UserTitleMini.yaml'
|
||||
'400':
|
||||
description: Invalid request body (missing fields, invalid types, etc.)
|
||||
'401':
|
||||
description: Unauthorized — missing or invalid auth token
|
||||
'403':
|
||||
description: Forbidden — user not allowed to update title
|
||||
'404':
|
||||
description: User or Title not found
|
||||
'500':
|
||||
description: Internal server error
|
||||
|
||||
delete:
|
||||
summary: Delete a usertitle
|
||||
description: User deleting title from list of watched
|
||||
operationId: deleteUserTitle
|
||||
parameters:
|
||||
- name: user_id
|
||||
in: path
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
description: ID of the user to assign the title to
|
||||
- in: query
|
||||
name: title_id
|
||||
required: true
|
||||
schema:
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
|
||||
responses:
|
||||
'200':
|
||||
description: Title successfully deleted
|
||||
# '400':
|
||||
# description: Invalid request body (missing fields, invalid types, etc.)
|
||||
'401':
|
||||
description: Unauthorized — missing or invalid auth token
|
||||
'403':
|
||||
description: Forbidden — user not allowed to delete title
|
||||
'404':
|
||||
description: User or Title not found
|
||||
'500':
|
||||
description: Internal server error
|
||||
Loading…
Add table
Add a link
Reference in a new issue