diff --git a/docs/docs.go b/docs/docs.go index 8b66d8ba..59ead983 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -104,6 +104,76 @@ const docTemplate = `{ } } }, + "/admin/invites": { + "get": { + "description": "This endpoint is used to list all estuary invites.", + "produces": [ + "application/json" + ], + "tags": [ + "content" + ], + "summary": "Get Estuary invites", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + } + } + }, + "post": { + "description": "This endpoint is used to create an estuary invite.", + "produces": [ + "application/json" + ], + "tags": [ + "content" + ], + "summary": "Create an Estuary invite", + "parameters": [ + { + "type": "string", + "description": "Invite code to be created", + "name": "code", + "in": "path" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + } + } + } + }, "/admin/peering/peers": { "get": { "description": "This endpoint can be used to list all peers on Peering Service", diff --git a/docs/swagger.json b/docs/swagger.json index 71dec341..efd849a2 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -97,6 +97,76 @@ } } }, + "/admin/invites": { + "get": { + "description": "This endpoint is used to list all estuary invites.", + "produces": [ + "application/json" + ], + "tags": [ + "content" + ], + "summary": "Get Estuary invites", + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + } + } + }, + "post": { + "description": "This endpoint is used to create an estuary invite.", + "produces": [ + "application/json" + ], + "tags": [ + "content" + ], + "summary": "Create an Estuary invite", + "parameters": [ + { + "type": "string", + "description": "Invite code to be created", + "name": "code", + "in": "path" + } + ], + "responses": { + "200": { + "description": "OK", + "schema": { + "type": "string" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/util.HttpError" + } + } + } + } + }, "/admin/peering/peers": { "get": { "description": "This endpoint can be used to list all peers on Peering Service", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 084769c2..cd447788 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -232,6 +232,52 @@ paths: summary: List autoretrieve servers tags: - autoretrieve + /admin/invites: + get: + description: This endpoint is used to list all estuary invites. + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + "400": + description: Bad Request + schema: + $ref: '#/definitions/util.HttpError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/util.HttpError' + summary: Get Estuary invites + tags: + - content + post: + description: This endpoint is used to create an estuary invite. + parameters: + - description: Invite code to be created + in: path + name: code + type: string + produces: + - application/json + responses: + "200": + description: OK + schema: + type: string + "400": + description: Bad Request + schema: + $ref: '#/definitions/util.HttpError' + "500": + description: Internal Server Error + schema: + $ref: '#/definitions/util.HttpError' + summary: Create an Estuary invite + tags: + - content /admin/peering/peers: delete: description: This endpoint can be used to remove a Peer from the Peering Service diff --git a/handlers.go b/handlers.go index cebaaaf3..2efe357c 100644 --- a/handlers.go +++ b/handlers.go @@ -1955,6 +1955,15 @@ type getInvitesResp struct { CreatedAt string `json:"createdAt"` } +// handleAdminGetInvites godoc +// @Summary Get Estuary invites +// @Description This endpoint is used to list all estuary invites. +// @Tags content +// @Produce json +// @Success 200 {object} string +// @Failure 400 {object} util.HttpError +// @Failure 500 {object} util.HttpError +// @Router /admin/invites [get] func (s *Server) handleAdminGetInvites(c echo.Context) error { var invites []getInvitesResp if err := s.DB.Model(&util.InviteCode{}). @@ -1969,6 +1978,16 @@ func (s *Server) handleAdminGetInvites(c echo.Context) error { return c.JSON(http.StatusOK, invites) } +// handleAdminCreateInvite godoc +// @Summary Create an Estuary invite +// @Description This endpoint is used to create an estuary invite. +// @Tags content +// @Produce json +// @Success 200 {object} string +// @Failure 400 {object} util.HttpError +// @Failure 500 {object} util.HttpError +// @Param code path string false "Invite code to be created" +// @Router /admin/invites [post] func (s *Server) handleAdminCreateInvite(c echo.Context, u *util.User) error { code := c.Param("code") invite := &util.InviteCode{