feat: regenerated go oapi
This commit is contained in:
parent
bd868bb724
commit
128a33824a
3 changed files with 11 additions and 64 deletions
|
|
@ -226,7 +226,7 @@ paths:
|
||||||
'500':
|
'500':
|
||||||
description: Unknown server error
|
description: Unknown server error
|
||||||
security:
|
security:
|
||||||
XsrfAuthHeader: []
|
- XsrfAuthHeader: []
|
||||||
'/users/{user_id}/titles':
|
'/users/{user_id}/titles':
|
||||||
get:
|
get:
|
||||||
operationId: getUserTitles
|
operationId: getUserTitles
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
JwtAuthCookiesScopes = "JwtAuthCookies.Scopes"
|
JwtAuthCookiesScopes = "JwtAuthCookies.Scopes"
|
||||||
|
XsrfAuthHeaderScopes = "XsrfAuthHeader.Scopes"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Defines values for ReleaseSeason.
|
// Defines values for ReleaseSeason.
|
||||||
|
|
@ -174,12 +175,6 @@ type UserTitleMini struct {
|
||||||
// UserTitleStatus User's title status
|
// UserTitleStatus User's title status
|
||||||
type UserTitleStatus string
|
type UserTitleStatus string
|
||||||
|
|
||||||
// AccessToken defines model for accessToken.
|
|
||||||
type AccessToken = string
|
|
||||||
|
|
||||||
// CsrfToken defines model for csrfToken.
|
|
||||||
type CsrfToken = string
|
|
||||||
|
|
||||||
// Cursor defines model for cursor.
|
// Cursor defines model for cursor.
|
||||||
type Cursor = string
|
type Cursor = string
|
||||||
|
|
||||||
|
|
@ -229,17 +224,6 @@ type UpdateUserJSONBody struct {
|
||||||
UserDesc *string `json:"user_desc,omitempty"`
|
UserDesc *string `json:"user_desc,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateUserParams defines parameters for UpdateUser.
|
|
||||||
type UpdateUserParams struct {
|
|
||||||
// AccessToken JWT access token.
|
|
||||||
AccessToken AccessToken `form:"access_token" json:"access_token"`
|
|
||||||
|
|
||||||
// XSRFTOKEN Anti-CSRF token (Double Submit Cookie pattern).
|
|
||||||
// Stored in non-HttpOnly cookie, readable by JavaScript.
|
|
||||||
// Must be echoed in `X-XSRF-TOKEN` header for state-changing requests (POST/PUT/PATCH/DELETE).
|
|
||||||
XSRFTOKEN CsrfToken `form:"XSRF-TOKEN" json:"XSRF-TOKEN"`
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetUserTitlesParams defines parameters for GetUserTitles.
|
// GetUserTitlesParams defines parameters for GetUserTitles.
|
||||||
type GetUserTitlesParams struct {
|
type GetUserTitlesParams struct {
|
||||||
Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"`
|
Cursor *Cursor `form:"cursor,omitempty" json:"cursor,omitempty"`
|
||||||
|
|
@ -297,7 +281,7 @@ type ServerInterface interface {
|
||||||
GetUsersId(c *gin.Context, userId string, params GetUsersIdParams)
|
GetUsersId(c *gin.Context, userId string, params GetUsersIdParams)
|
||||||
// Partially update a user account
|
// Partially update a user account
|
||||||
// (PATCH /users/{user_id})
|
// (PATCH /users/{user_id})
|
||||||
UpdateUser(c *gin.Context, userId int64, params UpdateUserParams)
|
UpdateUser(c *gin.Context, userId int64)
|
||||||
// Get user titles
|
// Get user titles
|
||||||
// (GET /users/{user_id}/titles)
|
// (GET /users/{user_id}/titles)
|
||||||
GetUserTitles(c *gin.Context, userId string, params GetUserTitlesParams)
|
GetUserTitles(c *gin.Context, userId string, params GetUserTitlesParams)
|
||||||
|
|
@ -524,46 +508,7 @@ func (siw *ServerInterfaceWrapper) UpdateUser(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
c.Set(JwtAuthCookiesScopes, []string{})
|
c.Set(XsrfAuthHeaderScopes, []string{})
|
||||||
|
|
||||||
// Parameter object where we will unmarshal all parameters from the context
|
|
||||||
var params UpdateUserParams
|
|
||||||
|
|
||||||
{
|
|
||||||
var cookie string
|
|
||||||
|
|
||||||
if cookie, err = c.Cookie("access_token"); err == nil {
|
|
||||||
var value AccessToken
|
|
||||||
err = runtime.BindStyledParameterWithOptions("simple", "access_token", cookie, &value, runtime.BindStyledParameterOptions{Explode: true, Required: true})
|
|
||||||
if err != nil {
|
|
||||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter access_token: %w", err), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
params.AccessToken = value
|
|
||||||
|
|
||||||
} else {
|
|
||||||
siw.ErrorHandler(c, fmt.Errorf("Query argument access_token is required, but not found"), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
{
|
|
||||||
var cookie string
|
|
||||||
|
|
||||||
if cookie, err = c.Cookie("XSRF-TOKEN"); err == nil {
|
|
||||||
var value CsrfToken
|
|
||||||
err = runtime.BindStyledParameterWithOptions("simple", "XSRF-TOKEN", cookie, &value, runtime.BindStyledParameterOptions{Explode: true, Required: true})
|
|
||||||
if err != nil {
|
|
||||||
siw.ErrorHandler(c, fmt.Errorf("Invalid format for parameter XSRF-TOKEN: %w", err), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
params.XSRFTOKEN = value
|
|
||||||
|
|
||||||
} else {
|
|
||||||
siw.ErrorHandler(c, fmt.Errorf("Query argument XSRF-TOKEN is required, but not found"), http.StatusBadRequest)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, middleware := range siw.HandlerMiddlewares {
|
for _, middleware := range siw.HandlerMiddlewares {
|
||||||
middleware(c)
|
middleware(c)
|
||||||
|
|
@ -572,7 +517,7 @@ func (siw *ServerInterfaceWrapper) UpdateUser(c *gin.Context) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
siw.Handler.UpdateUser(c, userId, params)
|
siw.Handler.UpdateUser(c, userId)
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetUserTitles operation middleware
|
// GetUserTitles operation middleware
|
||||||
|
|
@ -745,6 +690,8 @@ func (siw *ServerInterfaceWrapper) DeleteUserTitle(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.Set(XsrfAuthHeaderScopes, []string{})
|
||||||
|
|
||||||
for _, middleware := range siw.HandlerMiddlewares {
|
for _, middleware := range siw.HandlerMiddlewares {
|
||||||
middleware(c)
|
middleware(c)
|
||||||
if c.IsAborted() {
|
if c.IsAborted() {
|
||||||
|
|
@ -811,6 +758,8 @@ func (siw *ServerInterfaceWrapper) UpdateUserTitle(c *gin.Context) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
c.Set(XsrfAuthHeaderScopes, []string{})
|
||||||
|
|
||||||
for _, middleware := range siw.HandlerMiddlewares {
|
for _, middleware := range siw.HandlerMiddlewares {
|
||||||
middleware(c)
|
middleware(c)
|
||||||
if c.IsAborted() {
|
if c.IsAborted() {
|
||||||
|
|
@ -999,7 +948,6 @@ func (response GetUsersId500Response) VisitGetUsersIdResponse(w http.ResponseWri
|
||||||
|
|
||||||
type UpdateUserRequestObject struct {
|
type UpdateUserRequestObject struct {
|
||||||
UserId int64 `json:"user_id"`
|
UserId int64 `json:"user_id"`
|
||||||
Params UpdateUserParams
|
|
||||||
Body *UpdateUserJSONRequestBody
|
Body *UpdateUserJSONRequestBody
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1476,11 +1424,10 @@ func (sh *strictHandler) GetUsersId(ctx *gin.Context, userId string, params GetU
|
||||||
}
|
}
|
||||||
|
|
||||||
// UpdateUser operation middleware
|
// UpdateUser operation middleware
|
||||||
func (sh *strictHandler) UpdateUser(ctx *gin.Context, userId int64, params UpdateUserParams) {
|
func (sh *strictHandler) UpdateUser(ctx *gin.Context, userId int64) {
|
||||||
var request UpdateUserRequestObject
|
var request UpdateUserRequestObject
|
||||||
|
|
||||||
request.UserId = userId
|
request.UserId = userId
|
||||||
request.Params = params
|
|
||||||
|
|
||||||
var body UpdateUserJSONRequestBody
|
var body UpdateUserJSONRequestBody
|
||||||
if err := ctx.ShouldBindJSON(&body); err != nil {
|
if err := ctx.ShouldBindJSON(&body); err != nil {
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ patch:
|
||||||
Fields not provided in the request body remain unchanged.
|
Fields not provided in the request body remain unchanged.
|
||||||
operationId: updateUser
|
operationId: updateUser
|
||||||
security:
|
security:
|
||||||
XsrfAuthHeader: []
|
- XsrfAuthHeader: []
|
||||||
parameters:
|
parameters:
|
||||||
# - $ref: '../parameters/xsrf_token_header.yaml'
|
# - $ref: '../parameters/xsrf_token_header.yaml'
|
||||||
- name: user_id
|
- name: user_id
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue