mirror of
https://github.com/anyproto/anytype-heart.git
synced 2025-06-11 02:13:41 +09:00
GO-4848: Add app_name param to display_code endpoint
This commit is contained in:
parent
50f6b2819e
commit
b40b2817e0
4 changed files with 30 additions and 3 deletions
|
@ -36,6 +36,15 @@ const docTemplate = `{
|
|||
"auth"
|
||||
],
|
||||
"summary": "Open a modal window with a code in Anytype Desktop app",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "The name of the app that requests the code",
|
||||
"name": "app_name",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Challenge ID",
|
||||
|
|
|
@ -30,6 +30,15 @@
|
|||
"auth"
|
||||
],
|
||||
"summary": "Open a modal window with a code in Anytype Desktop app",
|
||||
"parameters": [
|
||||
{
|
||||
"type": "string",
|
||||
"description": "The name of the app that requests the code",
|
||||
"name": "app_name",
|
||||
"in": "query",
|
||||
"required": true
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
"200": {
|
||||
"description": "Challenge ID",
|
||||
|
|
|
@ -338,6 +338,12 @@ paths:
|
|||
post:
|
||||
consumes:
|
||||
- application/json
|
||||
parameters:
|
||||
- description: The name of the app that requests the code
|
||||
in: query
|
||||
name: app_name
|
||||
required: true
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
|
|
@ -14,12 +14,15 @@ import (
|
|||
// @Tags auth
|
||||
// @Accept json
|
||||
// @Produce json
|
||||
// @Success 200 {object} DisplayCodeResponse "Challenge ID"
|
||||
// @Failure 502 {object} util.ServerError "Internal server error"
|
||||
// @Param app_name query string true "The name of the app that requests the code"
|
||||
// @Success 200 {object} DisplayCodeResponse "Challenge ID"
|
||||
// @Failure 502 {object} util.ServerError "Internal server error"
|
||||
// @Router /auth/display_code [post]
|
||||
func DisplayCodeHandler(s *AuthService) gin.HandlerFunc {
|
||||
return func(c *gin.Context) {
|
||||
challengeId, err := s.GenerateNewChallenge(c.Request.Context(), "api-test")
|
||||
appName := c.Query("app_name")
|
||||
|
||||
challengeId, err := s.GenerateNewChallenge(c.Request.Context(), appName)
|
||||
code := util.MapErrorCode(err, util.ErrToCode(ErrFailedGenerateChallenge, http.StatusInternalServerError))
|
||||
|
||||
if code != http.StatusOK {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue